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

David Nelms

Usenet Archive
Joined
Dec 23, 2003
Messages
1
Reaction score
0
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 said:
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

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
 

Latest threads

Back
Top