Valued Contributor
Posts: 95
Registered: ‎04-04-2012
Message 1 of 2 (140 Views)
Accepted Solution

Selecting Entities in multiple layers

140 Views, 1 Replies
01-15-2013 01:58 AM

ObjectARX 2007


Is it possible to select entities of multiple layers?

I've looked at...


...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?

Posts: 1,406
Registered: ‎04-09-2008
Message 2 of 2 (138 Views)

Re: Selecting Entities in multiple layers

01-15-2013 02:53 AM in reply to: dynamicscope

What about:

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


Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.