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

Entities Selection, using acedSSGet function or another function

7 REPLIES 7
Reply
Message 1 of 8
Anonymous
1740 Views, 7 Replies

Entities Selection, using acedSSGet function or another function

Hi All,

I am trying to use the function acedSSGet(...) in order to get a specific
selection set of entities ONLY from the current space (MS, Layout1,
Layout2...).

The help says: "if you use the "X" option, acedSSGet() scans the entire
drawing database."
I used the Selection code "A" (ALL) that is supposed to give me a different
result.

In AutoCAD the "select objects: All" returns all the entities in the current
space.

How can I get the selection?
Do you have any suggestions?

Thanks a lot,
Nirit
7 REPLIES 7
Message 2 of 8
jlobo2
in reply to: Anonymous

Hi Nirit,

 

Am stuck in the same problem. Was wondering if you got any solution for the same?

 

I am using acedSSGet(_T("A"), NULL, NULL, NULL, nameOfSelectionSet); to get everything in the selectionSet.

Then accessing it by 

 

for(long cnt = 0; cnt < lengthOfSelectionSet; cnt++)
{

    acedSSName(nameOfSelectionSet, cnt, nameOfEntity);

    acdbGetObjectId(idOfEntity, nameOfEntity); // Here it does not return the id 

}

 

 

Message 3 of 8
nick83
in reply to: Anonymous

sample for crossing polygon.
//...
ads_name ent;
struct resbuf lookAt;
lookAt.restype = 67;
lookAt.resval.rint = model_or_layout() ? 0 : 1; // 0 - modelspase, 1 - current paperspace
lookAt.rbnext = NULL;
if(acedSSGet(_T("_cp"), pointlist, NULL, &lookAt, ent) != RTNORM)
{
acutPrintf(_T("\n terminated by user"));
return;
}

// here you can use set of selected entities from "ent"
//...
Message 4 of 8
jlobo2
in reply to: Anonymous

Thanks for your reply Nick,

 

What points do pointList represent?

 

What I am trying to do is, access all the entities in the current drawing, when the user runs a particular ObjectArx program and then do some changes in the Block References.

 

Do you think of any other way to achieve the same.

 

Thanks

Message 5 of 8
nick83
in reply to: jlobo2

this variant is for selecting entities within a polygon

if(acedSSGet(_T("_cp"), pointlist, NULL, &lookAt, ent) != RTNORM)

 if you want to select everything for curret space, your code have to be

if(acedSSGet(_T("_a"), NULL, NULL, &lookAt, ent) != RTNORM)

 

PS: don't forget, that all of needed elements MUST be visible on the screen. so, you need to "zoom all" before using acedSSGet

 

Message 6 of 8
jlobo2
in reply to: Anonymous

Thanks Nick,

 

Appreciate your help.

Message 7 of 8
maisoui
in reply to: jlobo2

Hi,

 

Another approach is to loop on entities in current space block table record. Are you really needed acedSSGet?

Here's a small example (for Model Space) :

 

Acad::ErrorStatus es;

//get model space block
AcDbBlockTableRecordPointer pBlockTableRecord(ACDB_MODEL_SPACE, m_pDatabase, AcDb::kForRead);
if((es = pBlockTableRecord.openStatus()) == Acad::eOk)
{
	//loop on each entities in model space
	AcDbBlockTableRecordIterator * pIterator = NULL;
	if((es = pBlockTableRecord->newIterator(pIterator)) == Acad::eOk)
	{
		for(pIterator->start(); !pIterator->done(); pIterator->step())
		{
			if((es = pIterator->getEntityId(entityId)) != Acad::eOk)
				continue;

			//...
		}

		delete pIterator;
	}
}

 Regards,

 

 

 

--
Jonathan
Message 8 of 8
jlobo2
in reply to: Anonymous

Hey Jonathan,

 

Thanks for your reply.

While using acedSSGet(); I was having some difficulty to get the exact Entity Id, So I did go ahead and implement the Model Space approach instead of Selection Set.

 

Was just curious to know, if there was something missed while using acedssGet, since it would make things simple, as it would a single line code.

 

Appreciate your help Jonathan.

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

Post to forums  

Autodesk Design & Make Report

”Boost