Dimension style for 2 decimal place precision?

Dimension style for 2 decimal place precision?

jake_egley
Advocate Advocate
168 Views
3 Replies
Message 1 of 4

Dimension style for 2 decimal place precision?

jake_egley
Advocate
Advocate

I'm using @JelteDeJong's rule to place the overall dimensions on a drawing view linked here. I want to modify the following line to add a dimension style so that the dimensions created have a two place precision (x.xx). Does anyone know the dimension style? Thanks

 

Dim pointText = ThisApplication.TransientGeometry.CreatePoint2d(textX, textY)
        _sheet.DrawingDimensions.GeneralDimensions.AddLinear(
            pointText, pointLeft, pointRight, DimensionTypeEnum.kVerticalDimensionType)
Jake Egley
Inventor 2022
0 Likes
Accepted solutions (1)
169 Views
3 Replies
Replies (3)
Message 2 of 4

J-Camper
Advisor
Advisor

You can capture the LinearGeneralDimension created and then set the style:

Dim pointText = ThisApplication.TransientGeometry.CreatePoint2d(textX, textY)
Dim lgd As LinearGeneralDimension= _sheet.DrawingDimensions.GeneralDimensions.AddLinear(
            pointText, pointLeft, pointRight, DimensionTypeEnum.kVerticalDimensionType)
lgd.Style = 'Your DimensionsStyle Object

 

There is an example in the help that goes over a creating the DimensionStyle.  It's in VBA, but just remove the "Set" part of lines where they exist and it will work in iLogic: https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=DrawingDimension_Sample 

 

Editing the style will affect all dimensions that use the style, so if you only want to change those dimensions you are creating, then you can adjust the LinearGeneralDimension.Precision property for each dimension.

 

Message 3 of 4

cidhelp
Advocate
Advocate

you can also set the precision directly to the dimension object:

Dim lgd As LinearGeneralDimension= _sheet.DrawingDimensions.GeneralDimensions.AddLinear(
            pointText, pointLeft, pointRight, DimensionTypeEnum.kVerticalDimensionType)
lgd.Precision = 0

 

Message 4 of 4

jake_egley
Advocate
Advocate
Accepted solution

Final Code to make it two decimal places is here:

 

        Dim pointText = ThisApplication.TransientGeometry.CreatePoint2d(textX, textY)
        Dim lgd As LinearGeneralDimension = _sheet.DrawingDimensions.GeneralDimensions.AddLinear(
            pointText, pointLeft, pointRight, DimensionTypeEnum.kHorizontalDimensionType, True, oDimStyle)
		lgd.Style.LinearPrecision = kTwoDecimalPlacesLinearPrecision
Jake Egley
Inventor 2022
0 Likes