NX9 - Journal Code Help Needed.... again. :o)
NX9 - Journal Code Help Needed.... again. :o)
(OP)
When in drafting, there seems to be some who like to see the borders around the views and some who don't. I thought it would be a good idea if I created a button to toggle the view borders on and off. I can record a journal to turn it on and one to turn it off, but I was wondering if someone could show me the way to use the "IF" correctly so one journal will turn it on or off depending on what the setting already is?
Just to make it clear, the same file will often be worked on by different people. That is why this is any kind of problem. Also, I find myself now working on something that I am constantly going back and forth turning the borders on and off.
Just to make it clear, the same file will often be worked on by different people. That is why this is any kind of problem. Also, I find myself now working on something that I am constantly going back and forth turning the borders on and off.





RE: NX9 - Journal Code Help Needed.... again. :o)
CODE
Option Strict Off Imports System Imports NXOpen Module Module1 Sub Main() Dim theSession As Session = Session.GetSession() If IsNothing(theSession.Parts.BaseWork) Then 'active part required Return End If Dim workPart As Part = theSession.Parts.Work Dim lw As ListingWindow = theSession.ListingWindow lw.Open() Const undoMarkName As String = "toggle drafting view borders" Dim markId1 As Session.UndoMarkId markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName) Dim preferencesBuilder1 As Drafting.PreferencesBuilder preferencesBuilder1 = workPart.SettingsManager.CreatePreferencesBuilder() preferencesBuilder1.ViewWorkflow.DisplayBorders = Not preferencesBuilder1.ViewWorkflow.DisplayBorders Dim nXObject1 As NXObject nXObject1 = preferencesBuilder1.Commit() preferencesBuilder1.Destroy() lw.Close() End Sub Public Function GetUnloadOption(ByVal dummy As String) As Integer 'Unloads the image immediately after execution within NX GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately End Function End Modulewww.nxjournaling.com
RE: NX9 - Journal Code Help Needed.... again. :o)
This is awesome. I didn't know there was a toggle in code. Im gonna have to study this some to see how I get it to work for other things. lol
RE: NX9 - Journal Code Help Needed.... again. :o)
www.nxjournaling.com