几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(VB.NET/C#) (http://www.dimcax.com/hust/forumdisplay.php?f=176)
-   -   【转帖】在c#下插入块 (http://www.dimcax.com/hust/showthread.php?t=9427)

yang686526 2009-04-20 09:20 PM

【转帖】在c#下插入块
 
在c#下插入块
www.dimcax.com
在c#下插入块 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();
}
}
}
}
对于块对像,除了将块分解外。还有没有其它方法取得块中对像。
lisp vba arx .net开发都会一点。可惜都不精。希望和大家共同学习进步。
在vb.net下插入块怎么写


所有的时间均为北京时间。 现在的时间是 06:47 AM.