Navisworks API

Reply
Distinguished Contributor
bthatcher
Posts: 749
Registered: ‎12-12-2003
Message 1 of 4 (208 Views)

Limit selection to specific objects

208 Views, 3 Replies
01-22-2013 11:59 AM

I would like to limit the selection to spicific objects. A portion of the model is transparent and I would like to be able to select objects through the transparent objects. Is that posible? Thanks. 

ADN Support Specialist
xiaodong.liang
Posts: 1,305
Registered: ‎06-12-2011
Message 2 of 4 (201 Views)

Re: Limit selection to specific objects

01-23-2013 05:58 PM in reply to: bthatcher

Hi,

 

I'd suggest you take a look at Find API of Navisworks. here is one post which you could get started with.

http://adndevblog.typepad.com/aec/2012/05/navisworks-net-api-find-item.html

 

e.g. for your question, one way could be:

 

   Document oDoc =
               Autodesk.Navisworks.Api.Application.ActiveDocument;

           IEnumerable<ModelItem> items =
                   from x in oDoc.Models[1].RootItem.
                       DescendantsAndSelf
                   where x.HasGeometry && x.Geometry.ActiveTransparency >0
                   select x;
           // highlight the items
           oDoc.CurrentSelection.CopyFrom(items);

 

 

 

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Distinguished Contributor
bthatcher
Posts: 749
Registered: ‎12-12-2003
Message 3 of 4 (186 Views)

Re: Limit selection to specific objects

01-31-2013 11:53 AM in reply to: xiaodong.liang

I'm not sure I've explained myself clearly. I have a model with several modelItemCollections. Some of the modelItems are have a 95% transparency, the rest no transparency. I want to select on the screen but only be able to pick the non-transparent modelItems. They are part of thier own modelItemCollection. So in the attached image, if the user clicked where the red arrow is, they woukd get the cyan modelItem, even though that modelItem is behind the transparent modelItem denoted with the red boundry. Thanks.

ADN Support Specialist
xiaodong.liang
Posts: 1,305
Registered: ‎06-12-2011
Message 4 of 4 (162 Views)

Re: Limit selection to specific objects

02-19-2013 02:36 AM in reply to: bthatcher

Hi,

 

I see. you want to cusmomize the selection when user is selecting. Sorry, in current releases, the picking behavior cannot be customized. Even though you could get OnCurrentSelectionChanged(/Chaning), API does not allow you to change the selection in the events. 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!