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: 

how to extend selection range to geometry and hide Not selected items

5 REPLIES 5
Reply
Message 1 of 6
VanessaGrimoult
632 Views, 5 Replies

how to extend selection range to geometry and hide Not selected items

hy, i am beginner with NAV API i try to developp plugin making selection from a list of ID the search and selection are OK, but when i want select one item in the 3D view to consult properties it select all items of my selection. i think i just have to extend the selection range to geometry (like in Naviswork) how can i do this in my code ? code: Dim MySearch As Autodesk.Navisworks.Api.Search = New Search Dim MySearchResult As New ModelItemCollection Dim hidden As New ModelItemCollection Dim visible As New ModelItemCollection Try MysearchResult.Clear() MySearch.SearchConditions.Clear() MySearch.Selection.SelectAll() For Each Item As String In MaListeDeRP Dim sc As SearchCondition = SearchCondition.HasPropertyByDisplayName("Propriétés DCNS", "RP").EqualValue(VariantData.FromDisplayString(Item)) Dim groupe As New List(Of SearchCondition) groupe.Add(sc) MySearch.SearchConditions.AddGroup(groupe) Next MySearchResult.CopyFrom(MySearch.FindAll(MonDocument, False)) 'add in current selection If Not MySearchResult.IsEmpty Then MonDocument.CurrentSelection.Clear() For Each Item As ModelItem In MySearchResult. MonDocument.CurrentSelection.Add(Item) Next thanks for answer
5 REPLIES 5
Message 2 of 6

sorry for the "Hard" text to read,

here is a better one:

i try to developp plugin making selection from a list of ID,

the search and selection are OK, but when i want select one item in the 3D view to consult properties,

it select all items of my selection.

i think i just have to extend the selection range to geometry (like in Naviswork) how can i do this in my code ?

code:

#####################################################################################

 

Dim MySearch As Autodesk.Navisworks.Api.Search = New Search

Dim MySearchResult As New ModelItemCollection

 

Try

MysearchResult.Clear()

MySearch.SearchConditions.Clear()

MySearch.Selection.SelectAll()

 

For Each Item As String In MaListeDeRP

Dim sc As SearchCondition = SearchCondition.HasPropertyByDisplayName("PropriétésXXXX", "RP").EqualValue(VariantData.FromDisplayString(Item)) Dim groupe As New List(Of SearchCondition)

groupe.Add(sc)

MySearch.SearchConditions.AddGroup(groupe)

Next

 

MySearchResult.CopyFrom(MySearch.FindAll(MonDocument, False))

'add in current selection

If Not MySearchResult.IsEmpty Then

MonDocument.CurrentSelection.Clear()

For Each Item As ModelItem In MySearchResult

MonDocument.CurrentSelection.Add(Item)

Next

###############################################################################################################

thanks for answer

 

Message 3 of 6

Hi,

I am confusing on what you said "but when i want select one item in the 3D view to consult properties, it select all items of my selection." . Assume you got some items from the search result, now you click a single item in the view? , and all items of the search result will be selected as well?
If possible, could you share small video on the process? you can post the video on dropbox and share the link here. The forum does not support big attachment.
Message 4 of 6

hi, yes i have already read this blog, this is my code: ''''fist i made a search -> MySearchResult and after: Dim PresenterPlugin As Autodesk.Navisworks.Api.Interop.ComApi.InwOwPresenterElement = Nothing For Each plugin In state.Plugins If plugin.ObjectName = "nwOwPresenterElement" Then PresenterPlugin = plugin MsgBox(PresenterPlugin.ToString, MsgBoxStyle.OkOnly, "Détection Presenter Plugin") Exit For Else MsgBox(" Presenter Plugin non détecté") End If Next PresenterPlugin.UserMaterials.AddFromArchive("Brique") Dim MaSelection As Autodesk.Navisworks.Api.Interop.ComApi.InwOpSelection2 MaSelection = Autodesk.Navisworks.Api.ComApi.ComApiBridge.ToInwOpSelection(MySearchResult) If state.CurrentSelection.Paths().Count > 0 Then For Each path As InwOaPath In state.CurrentSelection.Paths() PresenterPlugin.MaterialMappings.AddMapping("Brique", path, False) Next Else MsgBox("la selection est vide") End If the plugin presenter is found, the texture is added to palette but it is not apply to my model, i don't understand why. is there anything else to do before? i use this code in a plugin, and use Navisworks Simulate 2013 thanks vanessa
Message 5 of 6

sorry, this is my code: Dim PresenterPlugin As Autodesk.Navisworks.Api.Interop.ComApi.InwOwPresenterElement = Nothing For Each plugin In state.Plugins If plugin.ObjectName = "nwOwPresenterElement" Then PresenterPlugin = plugin MsgBox(PresenterPlugin.ToString, MsgBoxStyle.OkOnly, "Détection Presenter Plugin") Exit For Else MsgBox(" Presenter Plugin non détecté") End If Next PresenterPlugin.UserMaterials.AddFromArchive("Brique") Dim MaSelection As Autodesk.Navisworks.Api.Interop.ComApi.InwOpSelection2 MaSelection = Autodesk.Navisworks.Api.ComApi.ComApiBridge.ToInwOpSelection(MySearchResult) If state.CurrentSelection.Paths().Count > 0 Then For Each path As InwOaPath In state.CurrentSelection.Paths() PresenterPlugin.MaterialMappings.AddMapping("Brique", path, False) next else MsgBox("la selection est vide") endif the plugin presenter is found, the texture is added to palette but it is not apply to my model, i don't understand why. is there anything else to do before? i use this code in a plugin, and use Navisworks Simulate 2013 thanks vanessa
Message 6 of 6

i am sorry that i can't delete my 2 first post!!!!! this is the good subject: what i want to do: i developp a plugin to select a list of ID from csv file-> this is ok but, if, in the user's Navisworks application the option "define the selection range on geometrie" is not selected, (you can see that in the video joined), the user can't select a single item in the 3D view. (all the items are "blue") so i want to force this option in my code, and i don' find how. i hope it's more clear with the video!! vanessa

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

Post to forums  

Rail Community


 

Autodesk Design & Make Report