Submitted by baschuve on Tue, 04/26/2016 - 07:32
Forums:
Is there an existing NX Journal that can create NX model views? We need to generate several model views with specific "PMI" titles. Using NX10.0.3.5 MP1. Thank you.
Is there an existing NX Journal that can create NX model views? We need to generate several model views with specific "PMI" titles. Using NX10.0.3.5 MP1. Thank you.
re: create model view
Record a journal while performing a View -> operation -> save as command. Saving a new model view is only a few lines of code.
re: create model view
I think you already have a solution.
Only as a tip: if you want the views only to be created if they are not yet exiting. You can check this with using some program code from GTAC examples.
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities
Module report_all_view_names
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim thisView As NXOpen.Tag
Dim viewName As String
Dim partTag As NXOpen.Tag
Try
partTag = theSession.Parts.Work.Tag
Catch ex As Exception
If partTag = NXOpen.Tag.Null Then
MsgBox("You need an open part to run this program.", MsgBoxStyle.OKOnly)
Exit Sub
End If
End Try
ufs.Ui.ExitListingWindow()
Do
ufs.Obj.CycleObjsInPart(partTag, UFConstants.UF_view_type, thisView)
If NXOpen.Tag.Null <> thisView Then
ufs.Obj.AskName(thisView, viewName)
ufs.Ui.OpenListingWindow()
ufs.Ui.WriteListingWindow("View: " & viewName & vbCrLf)
End If
Loop While NXOpen.Tag.Null <> thisView
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = UFConstants.UF_UNLOAD_IMMEDIATELY
End Function
End Module