Jump to content

Recommended Posts

Posted

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".

Posted

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

Posted

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.

Posted

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

Posted

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!

Posted

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 ;

  • 2 months later...
Posted

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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...