spadazenon
Mechanical
- Mar 28, 2010
- 49
Dear all,
When I try to run this journal, it should make the subassembly as the workpart, before the message in the msgbox displays. I cannot make it work. The message displays before the subassembly becomes the workpart. Can anyone help me out here?
---------------------------------
' NX 11.0.0.33
' Journal created by spada on Mon Jan 23 20:52:55 2017 GTB 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
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Make Work Part")
Dim component1 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT SUBASM-A 1"), NXOpen.Assemblies.Component)
Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
theSession.Parts.SetWorkComponent(component1, NXOpen.PartCollection.RefsetOption.Entire, NXOpen.PartCollection.WorkComponentOption.Visible, partLoadStatus1)
workPart = theSession.Parts.Work ' SUBASM-A
partLoadStatus1.Dispose()
theSession.SetUndoMarkName(markId1, "Make Work Part")
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
msgbox("This should display after the subassembly becomes workpart")
End Sub
End Module
When I try to run this journal, it should make the subassembly as the workpart, before the message in the msgbox displays. I cannot make it work. The message displays before the subassembly becomes the workpart. Can anyone help me out here?
---------------------------------
' NX 11.0.0.33
' Journal created by spada on Mon Jan 23 20:52:55 2017 GTB 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
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Make Work Part")
Dim component1 As NXOpen.Assemblies.Component = CType(workPart.ComponentAssembly.RootComponent.FindObject("COMPONENT SUBASM-A 1"), NXOpen.Assemblies.Component)
Dim partLoadStatus1 As NXOpen.PartLoadStatus = Nothing
theSession.Parts.SetWorkComponent(component1, NXOpen.PartCollection.RefsetOption.Entire, NXOpen.PartCollection.WorkComponentOption.Visible, partLoadStatus1)
workPart = theSession.Parts.Work ' SUBASM-A
partLoadStatus1.Dispose()
theSession.SetUndoMarkName(markId1, "Make Work Part")
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
msgbox("This should display after the subassembly becomes workpart")
End Sub
End Module