NX Open- get names of all model views (as string)
NX Open- get names of all model views (as string)
(OP)
Hi,
I am trying to use NX Open/journal (with visual basic) to get the names of all my modeling views, and store it as a string array. This would be all the standard views and any custom views the user added. I am new to vb and nx open so bear with me.
This is what I have so far but this gives me errors:
Dim ViewNames() As String
Dim views As ModelingViewCollection
views = workPart.ModelingViews
ViewNames()=views
Thanks,
Ryan
I am trying to use NX Open/journal (with visual basic) to get the names of all my modeling views, and store it as a string array. This would be all the standard views and any custom views the user added. I am new to vb and nx open so bear with me.
This is what I have so far but this gives me errors:
Dim ViewNames() As String
Dim views As ModelingViewCollection
views = workPart.ModelingViews
ViewNames()=views
Thanks,
Ryan





RE: NX Open- get names of all model views (as string)
CODE
Imports System
Imports NXOpen
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
Dim ViewNames() As String
Dim i as Integer
i = 0
Dim views As ModelingViewCollection
views = workPart.ModelingViews
'iterate through the view collection, adding each view name to the string array
for each vw as ModelingView in views
redim preserve ViewNames(i)
ViewNames(i) = vw.Name
i = i + 1
next
'echo the contents of the string array
i = 0
for i = LBound(ViewNames) to UBound(ViewNames)
msgbox(ViewNames(i))
next
End Sub
End Module
RE: NX Open- get names of all model views (as string)
Works perfect. Thanks so much!!