本帖最后由 作者 于 2006-7-18 9:12:03 编辑
各位大侠,我有几个问题请教,一直没解决,请各位帮忙
)(感谢高手批评,第一次发帖一着急贴错了,现更正如下)
(1)在CAD的模型控件直接点击选中一个实体,ARX怎样得到这个实体的句柄
(2)如果这个不能实现,那么我的下面的用选择集的程序有什么问题,为什么pEntity为空,如何再获得VBA里的Handle值
AcDbObject * pEntity; Acad::ErrorStatus es; long n=0
ads_name ssname; AcDbObjectId eId; acedSSGet(NULL,NULL,NULL,NULL,ssname); if(acedSSLength(ssname,&n)!=RTNORM) { acutPrintf("\\n获取选择集长度出错!"); return; } ads_name ent; for(long i=0;i<=n;i++) { if(acedSSName(ssname,i,ent)!=RTNORM) { acutPrintf("\\n获取选择集内第%d个实体出错!",i);
return; }
acdbGetObjectId(eId, ent); acdbOpenObject(pEntity, eId, AcDb::kForWrite); } acedSSFree(ssname);
(3)用VBA获得对象数据的如下程序如何用ARX实现?
Public Function GetOD(acadObject As AcadEntity) Dim AcadMap As Object Dim prj As Project Dim odTbl As odTable Dim odRds As ODRecords Set AcadMap = ThisDrawing.Application.GetInterfaceObject("AutoCADMap.Application.2") Set prj = AcadMap.Projects(ThisDrawing) prj.ProjectOptions.DontAddObjectsToSaveSet = True Set odTbl = prj.ODTables.Item("ObjectInfo") Set odRds = odTbl.GetODRecords boolVal = odRds.Init(acadObject, True, False)
GetOD = odRds.Record.Item(1).Value End Function |