Deselect all objects programmatically

Deselect all objects programmatically

Anonymous
Not applicable
3,678 Views
4 Replies
Message 1 of 5

Deselect all objects programmatically

Anonymous
Not applicable

Hi all, 

I am trying to deselect all objects in document programmatically, using ObjectARX.

But the single way I found is using a command "AI_DESELECT".
Command is not always suitable. In some cases I need to deselect objects synchronously and perform another action right after this.

Maybe there is something similar to Autodesk.AutoCAD.Internal.Utils.SelectObjects(objectIds);

 

I know about events command begin/end, they can be used in case, I won't find another solution.

 

Thanks for any help!

 

0 Likes
Accepted solutions (1)
3,679 Views
4 Replies
Replies (4)
Message 2 of 5

nick83
Advocate
Advocate
acedSSSetFirst(NULL, NULL);

but there are some limitations:

1. The addCommand() optional flags ACRX_CMD_USEPICKSET and ACRX_CMD_REDRAW must be used in order for acedSSSetFirst() to work.

2*. Do not call acedSSSetFirst() when AutoCAD is in the middle of executing a command.

 

 

* - help file says this, but in fact:

AcDbObjectId eId;
//... do something usefull :)
ads_name cablePreselect, en1;
acedSSAdd(0,0,cablePreselect);
acdbGetAdsName(en1,eId);
acedSSAdd(en1,cablePreselect,cablePreselect);
acedSSSetFirst(cablePreselect, NULL);
techElectricitytech_cablewsblock(); // that's one of acrxEntryPoint.cpp functions, that work with preselected objects
acedSSSetFirst(NULL, NULL);
acedSSFree (cablePreselect);
//... continue current function

 

0 Likes
Message 3 of 5

Anonymous
Not applicable

Thank you for the reply, but I need the solution on C#.

I am sorry that I did not specified that in post.

0 Likes
Message 4 of 5

Anonymous
Not applicable
Accepted solution

Seems that I found a solution:
To pass empty array of ObjectId into SetImpliedSelection method


doc.Editor.SetImpliedSelection(new ObjectId[0]);

Message 5 of 5

Alexander.Rivilis
Mentor
Mentor

@Anonymous wrote:

Thank you for the reply, but I need the solution on C#.

I am sorry that I did not specified that in post.


You selected wrong forum for question about AutoCAD .NET API. The appropriate forum here: .NET

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

0 Likes