Finally – it took a while but here is a generic routine in VBA (Excel) that allows you to find all the properties. I have my own class that “just works” called findNavis, but this should help others on how to get and list [to the debug window] all the tabs of the properties window in Navis.
I want the dwg (LcOaNode::SourceFile) and the AutoCAD handle (LcOpDwgEntityAttrib::Value) and the stuff in brackets is the attribute name::property name. Here is the vba code (I did this from Excel)
[vb]
Sub PrintActiveNodeInfoForSelectedItems()
Dim nw As New findNavis
If (nw.isValid) Then
Dim i As Long
Dim results As InwOpSelection
Set results = nw.mstate.CurrentSelection
‘results.SelectAll ‘ this selects everything – but it makes all the other commands below work
Debug.Print ""
Debug.Print ""
Debug.Print ""
Debug.Print "Found this many items" & results.paths.count
For i = 1 To results.paths.count
Debug.Print "**new"
‘*****START
‘http://forums.augi.com/showthread.php?100059-Navisworks-API-How-to-%28VBA-VB6-NET%29
Dim propn As InwGUIPropertyNode2
Dim prop As InwOaProperty
Dim propvec As InwOaPropertyVec
Debug.Print nw.mstate.SmartTagText(results.paths(i))
Set propn = nw.mstate.GetGUIPropertyNode(results.paths(i), True)
Dim ga As Variant
Dim gai As InwGUIAttribute
Dim gaa As Variant
For Each ga In propn.GUIAttributes
Set gai = ga
Debug.Print "attribute:" & gai.ClassName & " " & gai.name Beep
For Each gaa In gai.Properties
Set prop = gaa
Debug.Print " Property:" & prop.username & "->" & prop.value
‘LcOpDwgEntityAttrib
Next
Next
‘ Set propvec = mstate.ObjectFactory(eObjectType_nwOaPropertyVec)
‘ Set prop = mstate.ObjectFactory(eObjectType_nwOaProperty)
‘ prop.name = "Mark No"
‘ prop.username = "Mark No"
‘ prop.value = i
‘ propvec.Properties.Add prop
‘ propn.SetUserDefined 0, "CT", "CT", propvec
‘********END
Next
End If
End Sub
[/vb]
smashed this with another post and got good results. please notice the two filter statements that I should convert and pass as arguments. The filter statements dump a smaller chunk of the rather large amount of properties now exposed in NW 2018 from Revit that could be considered as “noise” – the materials properties. enjoy!
Sub PrintActiveNodeInfoForSelectedItems()
Dim nwObj As NavisworksAutomationAPI15.Document
Set nwObj = GetObject(, “Navisworks.Document.15”) ‘nw 2018
nwObj.Visible = True
nwObj.StayOpen ‘ YOU HAVE TO DO THIS and do it following the line above… why?
‘because the “GetObject” above says “attach onto the existing running copy of navisworks” …
‘and if you don’t do this stayopen thing, the ability to attach to it disappears.
‘You have been warned – took me HOURS to figure this stupid tidbit out) –
‘I had to restart navis all the time, which … is stupid for live automation (it is ok to do it for background processing)
Dim nw As New findNavis
Set nw.mstate = nwObj.State
If 1 = 1 Then ‘(nw.isvalid) Then
Dim i As Long
Dim results As InwOpSelection
Set results = nw.mstate.CurrentSelection
‘results.SelectAll ‘ this selects everything – but it makes all the other commands below work
Debug.Print “”
Debug.Print “”
Debug.Print “”
Debug.Print “Found this many items” & amp; results.Paths.Count
For i = 1 To results.Paths.Count
Debug.Print “**new”
””””””’Dim nwGeo As InwOaNode
””””””’Set nwGeo = nw.mstate
‘*****START
‘http://forums.augi.com/showthread.php?100059-Navisworks-API-How-to-%28VBA-VB6-NET%29
Dim propn As InwGUIPropertyNode2
Dim prop As InwOaProperty
Dim propvec As InwOaPropertyVec
Debug.Print nw.mstate.SmartTagText(results.Paths(i))
Set propn = nw.mstate.GetGUIPropertyNode(results.Paths(i), True)
Dim ga As Variant
Dim gai As InwGUIAttribute
Dim gaa As Variant
For Each ga In propn.GUIAttributes
Set gai = ga
Dim topLevel As Integer
Dim Setfilter As Integer
topLevel = 0
Setfilter = 1
If Setfilter = 1 Then ‘ filter for only the properties titles i want.
If gai.ClassName = “LcOaNode” Or gai.ClassName = “LcRevitData_Element” Or gai.ClassName = “LcRevitId” Or gai.ClassName = “LcRevitData_Parameter” Then
Debug.Print “attribute:” & amp; gai.ClassName & amp; ” ” & amp; gai.Name; ” Beep”
If topLevel = 1 Then
For Each gaa In gai.Properties
Set prop = gaa
Debug.Print ” Property:” & amp; prop.UserName & amp; “->” & amp; prop.Value
‘LcOpDwgEntityAttrib
Next
End If
End If
Else
Debug.Print “attribute:” & amp; gai.ClassName & amp; ” ” & amp; gai.Name; ” Beep”
If topLevel = 1 Then
For Each gaa In gai.Properties
Set prop = gaa
Debug.Print ” Property:” & amp; prop.UserName & amp; “->” & amp; prop.Value
‘LcOpDwgEntityAttrib
Next
End If
End If
Next
‘ Set propvec = mstate.ObjectFactory(eObjectType_nwOaPropertyVec)
‘ Set prop = mstate.ObjectFactory(eObjectType_nwOaProperty)
‘ prop.name = “Mark No”
‘ prop.username = “Mark No”
‘ prop.value = i
‘ propvec.Properties.Add prop
‘ propn.SetUserDefined 0, “CT”, “CT”, propvec
‘********END
Next
End If
End Sub
oh also… love the simple findNavis class although I wonder how it could be extended? you will notice I bypassed the isValid test and will probably use another method to test the class object that is contains something…