NX9 VB / Journal to Change Application / Module
NX9 VB / Journal to Change Application / Module
(OP)
Has anyone managed to find some VB code to change from one application to another?
Specifically, I'd like to change to the Modeling application before taking some other actions.
Recording a journal sets an undo mark but doesn't actually record the change.
I stumbled across the fact that I can change to Drafting by opening a drawing sheet but getting to Modeling (or Gateway might work) has eluded me.
Thanks
Specifically, I'd like to change to the Modeling application before taking some other actions.
Recording a journal sets an undo mark but doesn't actually record the change.
I stumbled across the fact that I can change to Drafting by opening a drawing sheet but getting to Modeling (or Gateway might work) has eluded me.
Thanks





RE: NX9 VB / Journal to Change Application / Module
www.nxjournaling.com
RE: NX9 VB / Journal to Change Application / Module
I'm sure it would help if I could get our IT to install the help files, but knowing the right words to search for sure helps too.
For anyone else looking for this (I found the question unanswered in a lot of places), a working line of code is:
RE: NX9 VB / Journal to Change Application / Module
This line of code is not executed until the journal finishes (verified by placing a MsgBox after this line). I want it to execute immediately so I can orient the view afterwords in the same journal.
Does anyone know how to do that?
Thanks
RE: NX9 VB / Journal to Change Application / Module
However, that probably won't prevent you from doing what you want to do.
www.nxjournaling.com
RE: NX9 VB / Journal to Change Application / Module
With the Journal set to just go to modeling and orient, it will work two or three times and then start failing as it tries to orient before changing applications (from drafting). It would be less frustrating if it were consistent instead of teasing me the first few times. Exiting NX and restarting resets the "two or three" counter.
Oh well, it works as a macro so I'll just leave it as that. I was trying to move all of our macros and GRIPs into VB.
Thank you for the information.
RE: NX9 VB / Journal to Change Application / Module
CODE
Option Strict Off Imports System Imports NXOpen Imports NXOpen.UF Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() Dim theUfSession As UFSession = UFSession.GetUFSession() If IsNothing(theSession.Parts.Work) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Const undoMarkName As String = "orient modeling view" Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName) Dim currentDisplayState As Integer theUfSession.Draw.AskDisplayState(currentDisplayState) theUfSession.Draw.SetDisplayState(1) workPart.ModelingViews.WorkView.Orient(View.Canned.Trimetric, View.ScaleAdjustment.Fit) theUfSession.Draw.SetDisplayState(currentDisplayState) End Sub End Modulewww.nxjournaling.com
RE: NX9 VB / Journal to Change Application / Module
With your code I can insert my save steps between your Orient and final SetDisplayState and it achieves my goal.