LISP Routine for Changing Text Dimensions by X amount (VBA?)

Discussion in 'AutoCAD' started by David Nelms, Dec 23, 2003.

  1. David Nelms

    David Nelms Guest

    We have a standalone program for the steel industry that creates DXF files
    to use in ACAD. The dimensions shown are in dtext (which we prefer). Many
    times we have changes that are by an "x" amount each time. So if you have 20
    dimensions that have to be changed by 5'-2 each time, you are changing each
    one at the time. Another added wrinkle is that the font be used with it is a
    custom font that has sixteenths mapped in (I.e. %%131=1/16, %%%132=1/8,
    etc.). I have searched for a routine that would allow be to enter in the
    amount I want to change the dimension and it would rewrite the dim (text)
    for me in the new value. Assuming there isn't already a routine out there
    for something like this, what text searching tools does VBA/LISP have in
    analyzing a string? I know that in VB there are some.

    Does anyone have any suggestions or starting points?

    David Nelms
     
    David Nelms, Dec 23, 2003
    #1
  2. Hi David,

    There are some Autolisp functions like WCMATCH and VLISP functions like
    VL-STRING-POSITION that you can use to check for the characters. I found
    them under the "Autolisp Reference" in the help files. You may have to do a
    search on "wcmatch" and "vl-string" to see what's available.

    To do what you want to do, try breaking it into functions that correspond to
    the steps you would take. The tasks might look like the following, though
    the order may not be the same:

    Input the value that you want to add to the text
    Convert the value to a decimal number (call it *XBase* for example)
    Select the text object or objects that you want to add the value to
    set up a loop to iterate through each text object
    get the text string from the text object
    convert the characters in the string to fractional values that Autocad can
    understand as numbers
    convert the text value to a decimal number
    add the numeric value and the *XBase* value to get the new text value to
    be used
    convert the decimal text value back to a string
    substitute the special characters for any fractions that were present
    update the text object with the new string
    (next text object...)

    Hope this was a helpful starting point. If you need any help, you know
    where to reach me..

    -Rick Francken
     
    Rick Francken, Dec 29, 2003
    #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.