![]() |
jig 一次插入多个块
jig 一次插入多个块
www.dimcax.com jig 一次插入多个块 namespace blockjig { public class blockjig:entityjig { point3d mcenterpt, mactualpoint; public blockjig(blockreference br) : base(br) { mcenterpt = br.position; } protected override samplerstatus sampler(jigprompts prompts) { jigpromptoptions jigopts = new jigpromptoptions(); jigopts.userinputcontrols = (userinputcontrols.accept3dcoordinates | userinputcontrols.nozeroresponseaccepted | userinputcontrols.nonegativeresponseaccepted); jigopts.message = "\nenter insert point:"; promptpointresult dres = prompts.acquirepoint(jigopts); if (mactualpoint == dres.value) { return samplerstatus.nochange; } else { mactualpoint = dres.value; } return samplerstatus.ok; } protected override bool update() { mcenterpt = mactualpoint; try { ((blockreference)entity).position = mcenterpt; } catch (system.exception) { return false; } return true; } public entity getentity() { return entity; } [commandmethod("insertblocksample")] public void insertentitybypickpoint() { string blockpath = @"c:\program files\autocad , openmode.forwrite); btr.appendentity(entjig.getentity()); tr.addnewlycreateddbobject(entjig.getentity(), true); doc.transactionmanager.queueforgraphicsflush(); } isfirstinsert = false; } tr.commit(); } } } } } } 为什么运行刚输入命令就报有致命错误。环境是vs public void insertentitybypickpoint() { string blockpath = @"c:\program files\autocad , openmode.forwrite); btr.appendentity(entjig.getentity()); tr.addnewlycreateddbobject(entjig.getentity(), true); doc.transactionmanager.queueforgraphicsflush(); } isfirstinsert = false; } tr.commit(); } } } } } } 这样子貌似就可以了 烦恼自己调试一下子看看 |
所有的时间均为北京时间。 现在的时间是 05:07 AM. |