几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   jig 一次插入多个块 (http://www.dimcax.com/hust/showthread.php?t=8917)

yang686526 2009-04-20 11:23 AM

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.