Quick and dirty load Arial & Romant before changing then they are alwyas there.


Registered forum members do not see this ad.
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 atThis is my code:Cannot find text style "CT_ROMANT".
My question is, why does the macro stop enterring the code in the macro?Code:^C^C-RENAME;S;CT_ARIAL;ARIAL;^C^C-RENAME;S;CT_ROMANT;ROMANT;
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".




Quick and dirty load Arial & Romant before changing then they are alwyas there.
A man who never made mistakes never made anything


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.
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:
Considering:Code:^C^C^P(if (not _YourLispFunctionName)(load "YourLispFile.lsp"));_YourLispFunctionName ^P
HTHCode:(setq oTextStyles (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object))))
"Potential has a shelf life." - Margaret Atwood


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!




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 ;
A man who never made mistakes never made anything


Registered forum members do not see this ad.
I ended up splitting this into 2 buttons:
andCode:^C^C-RENAME;S;CT_ROMANT;ROMANT;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.Code:^C^C-RENAME;S;CT_ARIAL;ARIAL;
Thanks for help.
Bookmarks