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: 

Select same properties

4 REPLIES 4
Reply
Message 1 of 5
Wouiss
852 Views, 4 Replies

Select same properties

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

 

4 REPLIES 4
Message 2 of 5
venom_projects
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

Message 3 of 5

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.

 

Message 4 of 5
ngombault
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

Message 5 of 5
venom_projects
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

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

Post to forums  

Rail Community


Autodesk Design & Make Report