moog3
Marine/Ocean
- Nov 29, 2022
- 63
Can someone please show me how to add an input box into this journal.
I've used a journal I found in this thread thread561-489980 and modified it with my drafting preferences.
I'd like to have an input box show up when you run the journal, it asks "enter scale value"
then it'll multiply the "TEXTSIZE" value by this amount and run the rest of the code.
It's so I can make BIG dimensions, then switch back to standard size. IE, x10, & x1 to get back to standard.
I can easily create buttons of specific scale values, but would prefer a single button , such as this.
here's the code...
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
' ----------------------------------------------
' modified by me to scale dimensions
' to get another text style use these numbers
'
'arial=1 blockfont=2 full_leroy=3 leroy=4 arial unicode MS=5 helios=6 arial=7 tahoma=8 Nx ANSII Symbols=9
'ideas_century=10 High_tower_text=11 ideas_din=12 ideas_helvetica=13 ideas_iges_1002=14 ideas_korean=15 ideas_prc=16
'aurira_lt=61 ballfont=62 agency FB=63 AMGDT=66 franklin gothic book=93 helios_con_lt=98
'
' Menu: Preferences->Drafting...
' ----------------------------------------------
'alter TEXTSIZE to scale dimension
Dim TEXTSIZE = 2.75
Dim TEXTSIZEHALF = TEXTSIZE/2.2
Dim FONTNUMBER = 98
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim preferencesBuilder1 As NXOpen.Drafting.PreferencesBuilder = Nothing
preferencesBuilder1 = workPart.SettingsManager.CreatePreferencesBuilder()
preferencesBuilder1.AnnotationStyle.LetteringStyle.DimensionTextSize = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LetteringStyle.GeneralTextSize = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LineArrowStyle.ArrowheadLength = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LineArrowStyle.TextOverStubFactor = TEXTSIZE/55
preferencesBuilder1.AnnotationStyle.LineArrowStyle.StubLength = TEXTSIZE*1.0909090909090909090909090909091
preferencesBuilder1.AnnotationStyle.LineArrowStyle.TextToLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.FirstPosToExtensionLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.SecondPosToExtensionLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.LinePastArrowDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.DatumLengthPastArrow = TEXTSIZEHALF*2.4
preferencesBuilder1.AnnotationStyle.LetteringStyle.ToleranceTextSize = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LetteringStyle.TwoLineToleranceTextSize = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LetteringStyle.AppendedTextSize = TEXTSIZE
Dim nXObject1 As NXObject
nXObject1 = preferencesBuilder1.Commit()
theSession.SetUndoMarkName(markId1, "Drafting Preferences")
preferencesBuilder1.Destroy()
' ----------------------------------------------
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim preferencesBuilder2 As NXOpen.Drafting.PreferencesBuilder = Nothing
preferencesBuilder2 = workPart.SettingsManager.CreatePreferencesBuilder()
Dim fontIndex1 As Integer = Nothing
'preferencesBuilder2.AnnotationStyle.LetteringStyle.GeneralTextFont = FONTNUMBER
Dim fontIndex2 As Integer = Nothing
preferencesBuilder2.AnnotationStyle.LetteringStyle.DimensionTextFont = FONTNUMBER
Dim nXObject2 As NXOpen.NXObject = Nothing
nXObject2 = preferencesBuilder2.Commit()
theSession.SetUndoMarkName(markId2, "Drafting Preferences")
preferencesBuilder2.Destroy()
End Sub
End Module
Any help, much appreciated...
I've used a journal I found in this thread thread561-489980 and modified it with my drafting preferences.
I'd like to have an input box show up when you run the journal, it asks "enter scale value"
then it'll multiply the "TEXTSIZE" value by this amount and run the rest of the code.
It's so I can make BIG dimensions, then switch back to standard size. IE, x10, & x1 to get back to standard.
I can easily create buttons of specific scale values, but would prefer a single button , such as this.
here's the code...
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
' ----------------------------------------------
' modified by me to scale dimensions
' to get another text style use these numbers
'
'arial=1 blockfont=2 full_leroy=3 leroy=4 arial unicode MS=5 helios=6 arial=7 tahoma=8 Nx ANSII Symbols=9
'ideas_century=10 High_tower_text=11 ideas_din=12 ideas_helvetica=13 ideas_iges_1002=14 ideas_korean=15 ideas_prc=16
'aurira_lt=61 ballfont=62 agency FB=63 AMGDT=66 franklin gothic book=93 helios_con_lt=98
'
' Menu: Preferences->Drafting...
' ----------------------------------------------
'alter TEXTSIZE to scale dimension
Dim TEXTSIZE = 2.75
Dim TEXTSIZEHALF = TEXTSIZE/2.2
Dim FONTNUMBER = 98
Dim markId1 As NXOpen.Session.UndoMarkId = Nothing
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim preferencesBuilder1 As NXOpen.Drafting.PreferencesBuilder = Nothing
preferencesBuilder1 = workPart.SettingsManager.CreatePreferencesBuilder()
preferencesBuilder1.AnnotationStyle.LetteringStyle.DimensionTextSize = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LetteringStyle.GeneralTextSize = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LineArrowStyle.ArrowheadLength = TEXTSIZE
preferencesBuilder1.AnnotationStyle.LineArrowStyle.TextOverStubFactor = TEXTSIZE/55
preferencesBuilder1.AnnotationStyle.LineArrowStyle.StubLength = TEXTSIZE*1.0909090909090909090909090909091
preferencesBuilder1.AnnotationStyle.LineArrowStyle.TextToLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.FirstPosToExtensionLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.SecondPosToExtensionLineDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.LinePastArrowDistance = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LineArrowStyle.DatumLengthPastArrow = TEXTSIZEHALF*2.4
preferencesBuilder1.AnnotationStyle.LetteringStyle.ToleranceTextSize = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LetteringStyle.TwoLineToleranceTextSize = TEXTSIZEHALF
preferencesBuilder1.AnnotationStyle.LetteringStyle.AppendedTextSize = TEXTSIZE
Dim nXObject1 As NXObject
nXObject1 = preferencesBuilder1.Commit()
theSession.SetUndoMarkName(markId1, "Drafting Preferences")
preferencesBuilder1.Destroy()
' ----------------------------------------------
Dim markId2 As NXOpen.Session.UndoMarkId = Nothing
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim preferencesBuilder2 As NXOpen.Drafting.PreferencesBuilder = Nothing
preferencesBuilder2 = workPart.SettingsManager.CreatePreferencesBuilder()
Dim fontIndex1 As Integer = Nothing
'preferencesBuilder2.AnnotationStyle.LetteringStyle.GeneralTextFont = FONTNUMBER
Dim fontIndex2 As Integer = Nothing
preferencesBuilder2.AnnotationStyle.LetteringStyle.DimensionTextFont = FONTNUMBER
Dim nXObject2 As NXOpen.NXObject = Nothing
nXObject2 = preferencesBuilder2.Commit()
theSession.SetUndoMarkName(markId2, "Drafting Preferences")
preferencesBuilder2.Destroy()
End Sub
End Module
Any help, much appreciated...