Community
Navisworks API
Welcome to Autodesk’s Navisworks API Forums. Share your knowledge, ask questions, and explore popular Navisworks API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Selecting all the lines in a file using the API

2 REPLIES 2
Reply
Message 1 of 3
genscripter
344 Views, 2 Replies

Selecting all the lines in a file using the API

I was trying to make a modelitemcollection of all the lines in a file.  I thought this would work, because this is how I can get all the lines thru the UI, but it doesn't appear to work in the API's.  Anyone know what I'm doing wrong?

 

 

 

Search sss = new Search();
sss.Selection.SelectAll();
sss.SearchConditions.Add(SearchCondition.HasPropertyByDisplayName("Geometry", "Lines").EqualValue(VariantData.FromDisplayString("Yes")));
ModelItemCollection lines = sss.FindAll(Autodesk.Navisworks.Api.Application.ActiveDocument, false);

 

 

 

Thanks

0001D LLC. Where Design, Genetics, and Technology Overlap www.0001design.com
Tags (2)
2 REPLIES 2
Message 2 of 3

Hi,

could you provide more info such as a model? It is hard to diagnose what happened with the code because it might be related with your specific model.

or, at least, please share the snapshots showing:
- the properties panel when you selected the object. It can help to know what the properties look like
- the Find Condition you defined in UI. It can help to know what the condition looks like.

I doubt the value type is not a DisplayString.. you could verify by selecting the object, iterating its properties by API, and checking the value type.
Message 3 of 3

I think I have a better idea. Forget I posted any code, and could you post how you would find all the lines in a NV file?
0001D LLC. Where Design, Genetics, and Technology Overlap www.0001design.com

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

Post to forums  

Rail Community


Autodesk Design & Make Report