admin 发表于 2024-3-29 22:52:41

炸开组

void GroupExplode()
{
   AcString groupName;
   if (acedGetString(FALSE, 采用T("\nName of Group to explode: "), groupName) != RTNORM)
       return;
   AcDbObjectId idGroupDict = acdbCurDwg()->groupDictionaryId();
   AcDbDictionaryPointer pGroupDict(idGroupDict, AcDb::kForWrite);
   if (pGroupDict.openStatus() == Acad::eOk)
   {
       AcDbObjectId idGroup;
       if (pGroupDict->getAt(groupName, idGroup) == Acad::eOk)
       {
         AcDbObjectPointer<AcDbGroup> pGroup(idGroup, AcDb::kForWrite);
         if (pGroup.openStatus() == Acad::eOk)
         {
         if (pGroup->numEntities() > 0) pGroup->clear();
         pGroup->erase();
         }
       }
       else
       {
         acutPrintf(采用T("\nGroup '%s' not found in this dwg-file"), groupName.kACharPtr());
       }
   }
}
页: [1]
查看完整版本: 炸开组