怎样分解一个组!就象CAD的命令GROUP的E选项?
如题?回复
回复void EraseGroup(const char * pGroupName)<BR>{<BR> AcDbDictionary *pGrpDict;<BR> AcDbObjectId pGrpId;
acdbHostApplicationServices()->workingDatabase()->getGroupDictionary(pGrpDict, AcDb::kForWrite);
if (pGrpDict->getAt(pGroupName,pGrpId) == Acad::eOk)<BR> {<BR> AcDbObjectPointer <AcDbGroup> pGrp(pGrpId, AcDb::kForWrite);
pGrp->erase();<BR> pGrpDict->remove(pGrpId);<BR> pGrpDict->close();<BR> pGrp->close();<BR> }<BR> pGrpDict->close();
return;<BR>} 谢谢王斑竹!
我选择一个组实体!这样得到组的名称!
就象void EraseGroup(const char * pGroupName)里的pGroupName?<BR>
回复
选择一个实体,删除Group:ads_name ent;<BR> AcDbObjectId objId;<BR> int ret;<BR> ads_point pt;
<BR> ret = acedEntSel("\n请选择一个组实体:", ent, pt);<BR> acdbGetObjectId(objId, ent);<BR> AcDbObjectPointer <AcDbEntity> pEnt (objId, AcDb::kForRead );
CString strGrpName;
<BR> //assert(pEnt!=NULL);<BR> AcDbVoidPtrArray* pReactors = pEnt->reactors();<BR> if (pReactors != NULL)<BR> {<BR> for (int i = 0; i < pReactors->length(); i++)<BR> {<BR> void* pV = pReactors->at(i);<BR> if (pV != NULL & acdbIsPersistentReactor(pV))<BR> {<BR> AcDbObjectId rId = acdbPersistentReactorObjectId(pV);<BR> pEnt->close();<BR> AcDbObjectPointer<AcDbGroup> pGroup(rId, AcDb::kForWrite );<BR> strGrpName = pGroup->name(); //得到组名(在这里没什么用)<BR> pGroup->erase();<BR> }<BR> }<BR> }
acedAlert("ok");
assert(strGrpName != NULL); 明白了!
再次感谢!
页:
[1]