PDA

View Full Version : Creating Macros??



dtessier
28th Jul 2005, 06:01 pm
I am relatively new in writing macros in AutoCAD, but do have experience with VBA in Excel. I am needing to alter a large number of drawings in the following way:

1) Change all font in the drawing to a different font style
ie. Before: test, After: test

2) All font that is aligned vertically to be aligned horizontally
ie. Before: t After: test
e
s
t

3)Delete all blocks in the drawing, and also in the block library.

4)Delete drawing borders.

Would anyone know of any macros that might do this or something similiar to this, that I might be able to alter. I would normally do this by hand, but since there are a large number of drawings that I must do this for, I would prefer to do it with a macro. Thank you in advance for your time and consideration.

Dustin[/b]

CarlB
31st Jul 2005, 07:14 am
I can suggest a few lisp statements for some of the tasks. Once you complete the routine, run it in a batch process to operate on multiple drawings. Or, modify your acad.lsp to start the routine on starting drawing. The last lines in the routine could be to save and close the drawing. Then open multiple drawings at one time.

1. lisp to select all text and mtext

(setq alltext (ssget "x" '((0 . *text))))
(setq ecount 0)
(repeat (sslength alltext)
(setq ename (ssname ecount alltext))
(etc...stuff to substitute one font for another)
)

2. same as 1, check alignment codes, if vertical change to horiz, left justified.

3.
(setq allblocks (ssget "x" (0 . "insert")))
(command "erase" allblocks "")
(command "purge" "block" etc.....)


4. dunno...what type of object is the border?

dtessier
4th Aug 2005, 03:43 pm
I will leave the batching process for now, as I would like to get it to run correctly on one drawing to start....


As I had mentioned, I am not familiar with lisp statements. Do you place the code in the same place as you would with macros??? I'm just not sure how to test the code that you had offered? I hope this makes sense, and thank you for taking the time to reply...
Dustin