ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to use G option in acedssget global function

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
walker2010cs
627 Views, 5 Replies

how to use G option in acedssget global function

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

5 REPLIES 5
Message 2 of 6
moogalm
in reply to: walker2010cs

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 ();
			}
		}
	}

 

 

Message 3 of 6
walker2010cs
in reply to: moogalm

I was very excited when you reply,and thanks for your example,could you say something more about using G mode in acedssget and give me a example? i dont know how to fill parameters when using G mode in acedssget,thanks
Message 4 of 6
moogalm
in reply to: walker2010cs

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.

 

 

Message 5 of 6
walker2010cs
in reply to: moogalm

hi ,how to fill the parameters then acedSSget will prompt me for Group name when using G mode,i really want to know this,thanks
Message 6 of 6
walker2010cs
in reply to: moogalm

thanks for your answer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost