i have created a group named "mycs",but use int res=acedSSGet(_T("G"),NULL,NULL,NULL,ss); it always return RTERROR and CAD neither prompt me to input a group name,please gei me a sample for get a circle set from the group "mycs",thanks
Solved! Go to Solution.
Solved by moogalm. Go to Solution.
Hi there,
Sorry , acedssget isn't working as expected 😞 , nonetheless , I have a workround for you to traverse the group dictionary and get entities of particular group[MYCS] and perform your desired operation.
here is a sample code which does move operation of MYCS group of entities.
static void asdkTEST() { Acad::ErrorStatus es; AcDbObjectIdArray groupIds; // scan all groups and check to see if our group exists in any of them. If they do, // get the groupIds list. AcDbDictionary *dict = NULL; ACHAR* pszGroupName = _T("MYCS"); AcDbDatabase* pdb = acdbHostApplicationServices()->workingDatabase(); // get the ACAD_GROUP dictionary es = pdb->getGroupDictionary(dict, AcDb::kForRead); // if we got it ok if (es == Acad::eOk) { // create a new dictionary iterator AcDbDictionaryIterator *dictIterator = dict->newIterator (); // loop and get all the dictionary entries for (; !dictIterator->done (); dictIterator->next ()) { AcDbGroup *group = NULL; ACHAR* pszReturnedName = _T(""); // get the dictionary "group" entry if( (es = dictIterator->getObject ((AcDbObject *&)group, AcDb::kForRead) ) != Acad::eOk) return; // if we got it ok if(( es = group->getName(pszReturnedName)) != Acad::eOk) return ; if (!wcscmp(pszReturnedName,pszGroupName)) { // get the all entities in the group group->allEntityIds (groupIds); // clean up group->close(); //we found our group ,we 'll cut slack our iterations break; } } // clean up delete dictIterator; dict->close (); } /*performing move operation on my group of entities*/ AcGeMatrix3d matrix; // set up the translation matrix to move matrix.setToTranslation (AcGeVector3d (0, 100, 0)); // hard coded. // now move the entities using transformBy for (int i=0; i<groupIds.length (); ++i) { AcDbEntity *ent = NULL; // open the entity for read es = acdbOpenObject (ent, groupIds[i], AcDb::kForWrite); // if it opened ok if (es == Acad::eOk) { // do the move ent->transformBy (matrix); // now close the entity ent->close (); } } }
Hi There,
acedSSget should prompt user for Group name as per objectARX documentation ,and it is not working as expected ,hence I proposed a workround for you.