JAYDEE66
Aerospace
- Jan 6, 2020
- 13
I have several macros that change the layer settings based on the category names. They work regardless of the layers I want turned on and off.
I wanted to start using journals to accomplish this however when the category name is selected the journal file has the layer numbers not the layer category.
here is an example
' NX 12.0.0.27
' Journal created by jdower on Mon Jan 6 11:25:00 2020 Central Standard Time
'
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Format->Layer Settings...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
theSession.SetUndoMarkName(markId1, "Layer Settings Dialog")
Dim stateArray1(6) As NXOpen.Layer.StateInfo
stateArray1(0) = New NXOpen.Layer.StateInfo(1, NXOpen.Layer.State.Selectable)
stateArray1(1) = New NXOpen.Layer.StateInfo(100, NXOpen.Layer.State.Selectable)
stateArray1(2) = New NXOpen.Layer.StateInfo(101, NXOpen.Layer.State.Selectable)
stateArray1(3) = New NXOpen.Layer.StateInfo(110, NXOpen.Layer.State.Selectable)
stateArray1(4) = New NXOpen.Layer.StateInfo(111, NXOpen.Layer.State.Selectable)
stateArray1(5) = New NXOpen.Layer.StateInfo(112, NXOpen.Layer.State.Selectable)
stateArray1(6) = New NXOpen.Layer.StateInfo(113, NXOpen.Layer.State.Selectable)
workPart.Layers.ChangeStates(stateArray1, False)
theSession.SetUndoMarkName(markId1, "Layer Settings")
theSession.DeleteUndoMark(markId1, Nothing)
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
thanks in advance for any help
I wanted to start using journals to accomplish this however when the category name is selected the journal file has the layer numbers not the layer category.
here is an example
' NX 12.0.0.27
' Journal created by jdower on Mon Jan 6 11:25:00 2020 Central Standard Time
'
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: Format->Layer Settings...
' ----------------------------------------------
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
theSession.SetUndoMarkName(markId1, "Layer Settings Dialog")
Dim stateArray1(6) As NXOpen.Layer.StateInfo
stateArray1(0) = New NXOpen.Layer.StateInfo(1, NXOpen.Layer.State.Selectable)
stateArray1(1) = New NXOpen.Layer.StateInfo(100, NXOpen.Layer.State.Selectable)
stateArray1(2) = New NXOpen.Layer.StateInfo(101, NXOpen.Layer.State.Selectable)
stateArray1(3) = New NXOpen.Layer.StateInfo(110, NXOpen.Layer.State.Selectable)
stateArray1(4) = New NXOpen.Layer.StateInfo(111, NXOpen.Layer.State.Selectable)
stateArray1(5) = New NXOpen.Layer.StateInfo(112, NXOpen.Layer.State.Selectable)
stateArray1(6) = New NXOpen.Layer.StateInfo(113, NXOpen.Layer.State.Selectable)
workPart.Layers.ChangeStates(stateArray1, False)
theSession.SetUndoMarkName(markId1, "Layer Settings")
theSession.DeleteUndoMark(markId1, Nothing)
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
thanks in advance for any help