Get Dim Text as 'Rendered' by AutoCAD

Discussion in 'AutoCAD' started by wtabke, Feb 3, 2005.

  1. wtabke

    wtabke Guest

    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
     
    wtabke, Feb 3, 2005
    #1
  2. wtabke

    wtabke Guest

    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
     
    wtabke, Feb 7, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.