Get Dim Text as 'Rendered' by AutoCAD

Get Dim Text as 'Rendered' by AutoCAD

Anonymous
Not applicable
305 Views
1 Reply
Message 1 of 2

Get Dim Text as 'Rendered' by AutoCAD

Anonymous
Not applicable
Hello,

Is it possible to get the text from a dimension as it would be displayed on the screen by AutoCAD so I can then set the textoverride?

I have tried for the last two days and have not had any success. I can loop thru the dim entities/dim blocks and find the mtext, get the measured value and set the textoverride - no problem

What I am having trouble with are dims that have an existing override '<>.38 TYP', a measured distance of .3788831 and a dimscale that does not display any decimal places.

AutoCAD properly displays '.38 TYP' but I need to put that into the textoverrride instead of '<>.38 TYP'


Thanks,
Bill
0 Likes
306 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Hello All,

I do quite a bit of VB programming - not a lot with AutoCAD - so is this just not possible/reasonable - or - is it so simple I should be embarrassed for asking???

I am currently looping thru all entities and if the current entity is a dim, it is passed to a function that builds a text string that is what (I hope) the dim would look like on screen:

DimMeasurement$ = CStr(CurrDim.Measurement)

If CurrDim.SuppressLeadingZeros = True Then
FormatLeadingZero$ = ""
Else
FormatLeadingZero$ = "0"
End If

Select Case CurrDim.PrimaryUnitsPrecision
Case acDimPrecisionZero
FormatDimPrecision$ = ""
Case acDimPrecisionOne
FormatDimPrecision$ = "0"
Case acDimPrecisionTwo
FormatDimPrecision$ = "00"
Case acDimPrecisionThree
FormatDimPrecision$ = "000"
Case acDimPrecisionFour
FormatDimPrecision$ = "0000"
Case acDimPrecisionFive
FormatDimPrecision$ = "00000"
Case acDimPrecisionSix
FormatDimPrecision$ = "000000"
Case acDimPrecisionSeven
FormatDimPrecision$ = "0000000"
Case acDimPrecisionEight
FormatDimPrecision$ = "00000000"
Case Else
FormatDimPrecision$ = "00000000"
End Select

NewDimText$ = Format(DimMeasurement, FormatLeadingZero$ & DecimalSep$ & FormatDimPrecision$)

I know that Angular Dims will need special handling to format deg/min/sec's - but does this seem like a reasonable approach?

Thanks,
Bill
0 Likes