查看单个帖子
旧 2009-04-21, 04:51 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】源程序:用arx.net将dwg文件以块的方式插入cad中

源程序:用arx.net将dwg文件以块的方式插入cad中
www.dimcax.com
源程序:用arx.net将dwg文件以块的方式插入cad中
public class testinsert { [commandmethod("testinsert")] static public void doit() { document doc = application.documentmanager.mdiactivedocument; editor ed = doc.editor; promptresult res = ed.getstring("give me a file to insert"); if (res.status != promptstatus.ok) return; string fname = res.stringresult; if (!file.exists(fname)) fname = hostapplicationservices.current.findfile(fname, doc.database, findfilehint.default); using (database db = new database(false, false)) { //read drawing db.readdwgfile(fname, fileshare.read, true, null); using (transaction t = doc.transactionmanager.starttransaction()) { //insert it as a new block objectid idbtr = doc.database.insert("test", db, false); //create a ref to the block blocktable bt = (blocktable)t.getobject(doc.database.blocktableid, openmode.forread); blocktablerecord btr = (blocktablerecord)t.getobject(bt[blocktablerecord.modelspace], openmode.forwrite); using (blockreference bref = new blockreference(point3d.origin, idbtr)) { btr.appendentity(bref); t.addnewlycreateddbobject(bref, true); } t.commit(); } } } } 请问各位大侠,在这个基础上加一个将块打碎的功能应该用什么函数?谢谢
使用blockreference的explodetoownerspace属性
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)