Selecting Entities in multiple layers

Selecting Entities in multiple layers

Anonymous
Not applicable
622 Views
1 Reply
Message 1 of 2

Selecting Entities in multiple layers

Anonymous
Not applicable

ObjectARX 2007

 

Is it possible to select entities of multiple layers?

I've looked at...

http://through-the-interface.typepad.com/through_the_interface/2008/07/conditional-sel.html

...and tried the following code.

 

string[] layerNames = {"1", "2", "3"};
TypedValue[] tdv = new TypedValue[(layerNames.Length * 3) + 2];

int i = 0;
tdv[i++] = new TypedValue((int)DxfCode.Operator, "<or");
foreach (string ln in layerNames)
{
    tdv[i] = new TypedValue((int)DxfCode.Operator, "<and");
    tdv[i + 1] = new TypedValue((int)DxfCode.LayerName, ln);
    tdv[i + 2] = new TypedValue((int)DxfCode.Operator, "and>");
    i += 3;
}
tdv[i - 2] = new TypedValue((int)DxfCode.Operator, "or>");

SelectionFilter sf = new SelectionFilter(tdv);
PromptSelectionResult psr = ed.SelectAll(sf);

 This code gives me an error in the PromptSelectionResult.

What would cause the erro?

Or would there be a better way?

0 Likes
Accepted solutions (1)
623 Views
1 Reply
Reply (1)
Message 2 of 2

Alexander.Rivilis
Mentor
Mentor
Accepted solution

What about:

TypedValue((int)DxfCode.LayerName, "1,2,3");

?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | 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