![]() |
【转帖】急需帮助@cad二次开发错误!
急需帮助@cad二次开发错误!
www.dimcax.com 急需帮助@cad二次开发错误! 我在cad命令行里加载dll,能够生成需要的图形.保存!问题出在我全部关闭cad时.cad 出现如图所示情况!.请大侠帮忙一下!谢谢!(虽然下次打开cad都没问题,但是每次都出现这样的对话框,感觉很烦人!希望高手能告知破解的方法! 不胜感激! 附上代码!(主要就是在当前cad 图形中加入圆,加入外部块,文字等) using system; using system.collections.generic; using system.text; using autodesk.autocad.applicationservices; using autodesk.autocad.editorinput; using autodesk.autocad.runtime; using autodesk.autocad.geometry; using system.io; using autodesk.autocad.databaseservices; namespace classlibrary2 { public class class1 { [commandmethod("helloworld")] public void helloworld() { int kk; editor ed = application.documentmanager.mdiactivedocument.editor; string name1; ed.writemessage("hello world"); circle circle; //这个是我们要加入到模型空间的圆 blocktablerecord btr;//要加入圆,我们必须打开模型空间 blocktable bt; //要打开模型空间,我们必须通过块表(blocktable)来访问它 //我们使用一个名为‘transaction’的对象,把函数中有关数据库的操作封装起来 transaction trans; //使用transactionmanager的starttransaction()成员来开始事务处理 trans = hostapplicationservices.workingdatabase.transactionmanager.starttransaction(); //现在创建圆……请仔细看这些参数——注意创建point3d对象的‘new’和vector3d的静态成员zaxis circle = new circle(new point3d(10, 10, 0), vector3d.zaxis, 2); circle.colorindex = 2; bt = (blocktable)trans.getobject(hostapplicationservices.workingdatabase.blocktableid, openmode.forread); //使用当前的空间id来获取块表记录——注意我们是打开它用来写入 btr = (blocktablerecord)trans.getobject(hostapplicationservices.workingdatabase.currentspaceid, openmode.forwrite); //现在使用btr对象来加入圆 btr.appendentity(circle); trans.addnewlycreateddbobject(circle, true); //并确定事务处理知道要加入圆! dbtext mytext = new dbtext(); mytext.textstring = "b3-052-01-00"; mytext.horizontalmode = texthorizontalmode.textleft; mytext.verticalmode = textverticalmode.textverticalmid; mytext.alignmentpoint = new point3d(3.286, 88.7556, 0); mytext.height = 12; mytext.widthfactor = 2; btr.appendentity(mytext); |
所有的时间均为北京时间。 现在的时间是 06:11 PM. |