How to get sketch dimensions whose decimal values are greater then 2

Hi

below is code which lists sketch dimension, but How to get sketch dimensions whose decimal place values are greater then 2, can you please help, thanks in advance

Imports System
Imports NXOpen
Imports NXOpen.Annotations

Module M1

Sub Main ()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow

lw.Open()

Dim Allexpval As string
Dim skt_exp As NXOpen.Expression()
For Each skt As Sketch In workPart.Sketches

If skt.IsInternal then
continue for
End if

skt_exp = skt.GetAllExpressions()
For Each exp As Expression In skt_exp
Allexpval = exp.Value & VBNewLine & AllexpVal

Next
Next

lw.writeline(AllexpVal)

End Sub

End Module

If I understand the question, you want to report each dimension in a sketch where the number of decimal places is set greater than 2? If so, try the code below:

Imports System
Imports NXOpen
Imports NXOpen.Annotations

Module sketch_dims

Dim theSession As Session = Session.GetSession()
Dim lw As ListingWindow = theSession.ListingWindow

Sub Main()

Dim workPart As Part = theSession.Parts.Work
lw.Open()

For Each skt As Sketch In workPart.Sketches

If skt.IsInternal Then
Continue For
End If
Dim tempSketchFeature As Features.SketchFeature = skt.Feature
lw.WriteLine(tempSketchFeature.GetFeatureName)

Dim mySketchDimConstraints() As SketchConstraint = skt.GetAllConstraintsOfType(Sketch.ConstraintClass.Dimension, Sketch.ConstraintType.NoCon)
For Each tempConstraint As SketchDimensionalConstraint In mySketchDimConstraints
Dim tempDim As Annotations.Dimension = tempConstraint.AssociatedDimension
Dim mainText() As String
Dim dualText() As String
tempDim.GetDimensionText(mainText, dualText)

Dim editSettingsBuilder1 As NXOpen.Annotations.EditSettingsBuilder = Nothing
editSettingsBuilder1 = workPart.SettingsManager.CreateAnnotationEditSettingsBuilder({tempDim})

If editSettingsBuilder1.AnnotationStyle.DimensionStyle.DimensionValuePrecision > 2 Then
lw.WriteLine(mainText(0))
End If
editSettingsBuilder1.Destroy()

Next
lw.WriteLine("")
Next

End Sub

End Module

Thank you so much for your quick reply, yes your understanding is correct, In sketch If I have dimension 25.12345 and 45, it should display only 25.12345,

Thanks for sharing the code but it is displaying only sketch names not the dimension values (like 25.12345) can you please check and help me

Thanks Once again

What version of NX are you using? Are you using the new sketcher?

I wrote and tested the code on NX 1919 (old sketch).

Hi, I am Using NX11

Thanks

I may have misunderstood your question then. To be clear, the code I posted looks for sketch dimensions where the dimension style is set to show more than 2 decimal places. It does not look at the underlying value of the dimension.

Perhaps you are interested in values such as 1.23456 but not 1.23000? When set to display 2 decimal places, both dimensions would show as 1.23.