Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = theSession.ListingWindow
Sub Main()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
lw.Open()
'get work part preferences
Dim arrowLengthA As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.ArrowheadLength
Dim arrowAngleB As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.ArrowheadIncludedAngle
Dim dotDiameterC As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.DotArrowheadDiameter
Dim stubSizeD As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.StubLength
Dim extensionLengthE As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.LinePastArrowDistance
Dim extensionAngleF As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.ObliqueExtensionLineAngle
Dim dimTextToLineG As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.TextToLineDistance
Dim extLine1GapH As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.FirstPosToExtLineDist
Dim extLine2GapJ As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.SecondPosToExtLineDist
Dim datumArrowExtensionK As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.DatumLengthPastArrow
Dim textOverStubGapL As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.TextOverStubSpaceFactor
Dim textOverLeaderGapM As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.TextOverLeaderGapFactor
Dim allAroundSymbolIdN As Double = workPart.Annotations.Preferences.GetLineAndArrowPreferences.AllAroundSymbol
'get customer default preferences
Dim cdArrowLengthA As Double
Dim cdArrowAngleB As Double
Dim cdDotDiameterC As Double
Dim cdStubSizeD As Double
Dim cdExtensionLengthE As Double
Dim cdExtensionAngleF As Double
Dim cdDimTextToLineG As Double
Dim cdExtLine1GapH As Double
Dim cdExtLine2GapJ As Double
Dim cdDatumArrowExtensionK As Double
Dim cdTextOverStubGapL As Double
Dim cdTextOverLeaderGapM As Double
Dim cdAllAroundSymbolIdN As Double
If workPart.PartUnits = BasePart.Units.Millimeters Then
'metric part units
cdArrowLengthA = theSession.OptionsManager.GetRealValue("Drafting_arrowSize_MU")
cdDotDiameterC = theSession.OptionsManager.GetRealValue("Drafting_dotDiameter_MU")
cdStubSizeD = theSession.OptionsManager.GetRealValue("Drafting_stubbSize_MU")
cdExtensionLengthE = theSession.OptionsManager.GetRealValue("Drafting_lineArrow_MU")
cdDimTextToLineG = theSession.OptionsManager.GetRealValue("Drafting_textLine_MU")
cdExtLine1GapH = theSession.OptionsManager.GetRealValue("Drafting_pointLine1_MU")
cdExtLine2GapJ = theSession.OptionsManager.GetRealValue("Drafting_pointLine2_MU")
cdDatumArrowExtensionK = theSession.OptionsManager.GetRealValue("Drafting_datumExtLine_MU")
cdAllAroundSymbolIdN = theSession.OptionsManager.GetRealValue("Drafting_allAroundSymbolSize_MU")
Else
'english part units
cdArrowLengthA = theSession.OptionsManager.GetRealValue("Drafting_arrowSize_EU")
cdDotDiameterC = theSession.OptionsManager.GetRealValue("Drafting_dotDiameter_EU")
cdStubSizeD = theSession.OptionsManager.GetRealValue("Drafting_stubbSize_EU")
cdExtensionLengthE = theSession.OptionsManager.GetRealValue("Drafting_lineArrow_EU")
cdDimTextToLineG = theSession.OptionsManager.GetRealValue("Drafting_textLine_EU")
cdExtLine1GapH = theSession.OptionsManager.GetRealValue("Drafting_pointLine1_EU")
cdExtLine2GapJ = theSession.OptionsManager.GetRealValue("Drafting_pointLine2_EU")
cdDatumArrowExtensionK = theSession.OptionsManager.GetRealValue("Drafting_datumExtLine_EU")
cdAllAroundSymbolIdN = theSession.OptionsManager.GetRealValue("Drafting_allAroundSymbolSize_EU")
End If
cdArrowAngleB = theSession.OptionsManager.GetRealValue("Drafting_includedAngle")
cdExtensionAngleF = theSession.OptionsManager.GetRealValue("Drafting_extensionLineAngle")
cdTextOverStubGapL = theSession.OptionsManager.GetRealValue("Drafting_textOverStubFactor")
cdTextOverLeaderGapM = theSession.OptionsManager.GetRealValue("Drafting_textOverLeaderGapFactor")
lw.WriteLine("Compare value of Customer Default (CD) setting to Part File (PF)")
lw.WriteLine("")
PrintResult("Arrowhead length (A)", cdArrowLengthA, arrowLengthA)
PrintResult("Arrowhead included angle (B)", cdArrowAngleB, arrowAngleB)
PrintResult("Dot diameter size (C)", cdDotDiameterC, dotDiameterC)
PrintResult("Stub Length (D)", cdStubSizeD, stubSizeD)
PrintResult("Line past arrow (E)", cdExtensionLengthE, extensionLengthE)
PrintResult("Extension line angle (F)", cdExtensionAngleF, extensionAngleF)
PrintResult("Gap text to line (G)", cdDimTextToLineG, dimTextToLineG)
PrintResult("Extension line 1 gap (H)", cdExtLine1GapH, extLine1GapH)
PrintResult("Extension line 2 gap (J)", cdExtLine2GapJ, extLine2GapJ)
PrintResult("Datum extension (K)", cdDatumArrowExtensionK, datumArrowExtensionK)
PrintResult("Text over stub factor (L)", cdTextOverStubGapL, textOverStubGapL)
PrintResult("Text over leader factor (M)", cdTextOverLeaderGapM, textOverLeaderGapM)
PrintResult("All around symbol size ID (N)", cdAllAroundSymbolIdN, allAroundSymbolIdN)
lw.Close()
End Sub
Sub PrintResult(ByVal title As String, ByVal CdValue As Double, ByVal PfValue As Double)
lw.WriteLine(title)
If PfValue.Equals(CdValue) Then
lw.WriteLine(" $$ Huzzah! they match $$")
Else
lw.WriteLine(" ## Oh no! they don't match ##")
End If
lw.WriteLine("CD value: " & CdValue.ToString)
lw.WriteLine("PF value: " & PfValue.ToString)
lw.WriteLine("")
End Sub
End Module