.NET

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

Selecting Entities in multiple layers

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

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?

What about:

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

?

Moderator
Alexander.Rivilis
Posts: 1,457
Registered: ‎04-09-2008
Message 2 of 2 (145 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.