Navisworks API

Reply
Contributor
Wouiss
Posts: 15
Registered: ‎08-06-2011
Message 1 of 5 (263 Views)

Select same properties

263 Views, 4 Replies
10-13-2011 05:11 AM

Hi!

In the Select and Search panel, you have the option to select the object with the same <property>. Inside my model, there is like 20 properties for example: equip #, iso #, line # etc.

 

Can I select which property I want the model to look at when I click on Select same -> properties

When I select a pipe for example, I would like to select all the pipe that as the same line #. When I click on select same - properties, nothing happend. Why? Is it because all the properties need to be the same to be selected?

 

I know I can get all pipes with same line # if I select that line # inside the selection tree-->properties tab--> line # but I need something quicker than that.

 

I tried to changed the selection resolution but no one is made for my need. In a perfect world, I would like to add another tab to the selection resolution for line #!

 

Does anyone have a solution to do it through the API?

 

Thanks

 

Member
venom_projects
Posts: 3
Registered: ‎01-25-2013
Message 2 of 5 (185 Views)

Re: Select same properties

01-25-2013 10:13 AM in reply to: Wouiss

I see this is an older thread but was wondering the exact same thing, does anybody have an answer for this?

 

Thanks

Doug

ADN Support Specialist
xiaodong.liang
Posts: 1,271
Registered: ‎06-12-2011
Message 3 of 5 (178 Views)

Re: Select same properties

01-28-2013 07:26 PM in reply to: venom_projects

Hi,

 

I do not fully understand what the question is, but I'd recommend with the two blogs

 

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

http://adndevblog.typepad.com/aec/2012/07/use-search-api.html

 

API has much flexible methods to do search. Hope you could find some clues. If you still need help, please elaborate the question and share some neccessary samples.

 



Xiaodong Liang
Developer Technical Services
Autodesk Developer Network

Active Contributor
ngombault
Posts: 45
Registered: ‎11-14-2012
Message 4 of 5 (167 Views)

Re: Select same properties

01-31-2013 08:38 PM in reply to: xiaodong.liang

Hi Doug,

 

I wrote a plugin to do something very similar to what you are looking for, the core code is dead simple:

    Private Sub SelectAllWithPropertyValue(ByVal CategoryName As String, ByVal PropertyName As String, ByVal Value As VariantData)
        Try
        Dim S As Search = New Search With {.PruneBelowMatch = False, .Locations = SearchLocations.DescendantsAndSelf}
            S.Selection.SelectAll()
            Dim ADoc As Document = Autodesk.Navisworks.Api.Application.ActiveDocument
            S.SearchConditions.Add(SearchCondition.HasPropertyByDisplayName(CategoryName, PropertyName).CompareWith(SearchConditionComparison.Equal, Value))
            ADoc.CurrentSelection.CopyFrom(S.FindAll(ADoc, False))
        Catch ex As Exception
            MessageBox.Show(Autodesk.Navisworks.Api.Application.Gui.MainWindow, ex.Message)
        End Try
    End Sub

 where categoryname, propertyname and value help you find all the objects you want.

 

I spent a lot of time trying to get this automatically triggered on user selection of either the tree or the 3D, so that it looks exactly like a selection resolution, unfortunately I ran into some limitation of the API where an event handler of the "selection change" event is not allowed to modify the selection itself (even if remove the handler, modify the selection, add the handler back)

 

-Nic

Member
venom_projects
Posts: 3
Registered: ‎01-25-2013
Message 5 of 5 (158 Views)

Re: Select same properties

02-05-2013 01:34 PM in reply to: Wouiss

Thanks for the respones, I may have posted in the wrong section I guess as I only have the Navis Viewer. As per your responses it appears that there is no way to accomplish this in the viewer at this time, and I dont have access to insert API code...

 

Thanks

Doug

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