YZ Posted April 1, 2012 Posted April 1, 2012 I'm trying to create a macro that will tidy up third party drawings to our drafting standard. When I do this manually in the command line it works. Even if the style does not exist in the drawing I thought that the second ^C^C ought to deal with it. But the macro seems to stall at Cannot find text style "CT_ROMANT". This is my code: ^C^C-RENAME;S;CT_ARIAL;ARIAL;^C^C-RENAME;S;CT_ROMANT;ROMANT; My question is, why does the macro stop enterring the code in the macro? This is what returns in my command line: Enter object type to rename [block/Dimstyle/LAyer/LType/Material/multileadeRstyle/Style/Tablestyle/Ucs/VIew/ VPort]: S Enter old text style name: CT_ROMANT Cannot find text style "CT_ROMANT". Quote
BIGAL Posted April 3, 2012 Posted April 3, 2012 Quick and dirty load Arial & Romant before changing then they are alwyas there. Quote
YZ Posted April 3, 2012 Author Posted April 3, 2012 Thanks for the response Bigal. The fonts are already in all my templates. The third party software exports dwg files and adds a prefix to all the fonts. It is super unhelpful and so I manually select it and then change it to Arial. The macro was trying to rename it before it goes into the template so that the font is recognised as an AutoCAD standard. I'm wondering if I need to set it to pause for a few miliseconds to wait for the message before it proceeds. Quote
BlackBox Posted April 3, 2012 Posted April 3, 2012 Why not have your Macro call a LISP function instead, which provides error handling, and can interact with the vla-* Text Style Object and rename programmatically (if needed), or simply import if not already available... Just a thought. Pseudo code: ^C^C^P(if (not _YourLispFunctionName)(load "YourLispFile.lsp"));_YourLispFunctionName ^P Considering: (setq oTextStyles (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)))) HTH Quote
YZ Posted April 3, 2012 Author Posted April 3, 2012 I'd love to Renderman, but only have LT so no LISP. I'm dreaming of a world where DIESEL can handle IF statements. Bliss! Quote
BIGAL Posted April 4, 2012 Posted April 4, 2012 Go back to your first line and remove the second ^c^c needs a extra return here had a play but could not get it to continue not surewhy not try a space vs a ; Quote
YZ Posted June 21, 2012 Author Posted June 21, 2012 I ended up splitting this into 2 buttons: ^C^C-RENAME;S;CT_ROMANT;ROMANT; and ^C^C-RENAME;S;CT_ARIAL;ARIAL; I use them in conjunction with other buttons that all start with ^C^C so even if it spits an error that "Style does not exist" the macros plow on regardless. Thanks for help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.