+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Senior Member
    Computer Details
    YZ's Computer Details
    Operating System:
    Windows XP
    CPU:
    Intel Duo Core E6550 @ 2.33GHz
    RAM:
    1.98 GHz, 3.23GB RAM
    Graphics:
    Intel G33/31 Express Chipset Family
    Monitor:
    LG Flatron W2343T
    Discipline
    Surveying
    YZ's Discipline Details
    Occupation
    CAD Operator and Manager; Land Survey, Civil Design
    Discipline
    Surveying
    Details
    Topographic ground surveys for architects and engineers; Subdivisions in NSW; Civil Engineering Design.
    Using
    AutoCAD LT 2012
    Join Date
    Oct 2007
    Location
    Sydney
    Posts
    256

    Default Macro stalls if Style to Rename does not exist in dwg

    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 at
    Cannot find text style "CT_ROMANT".
    This is my code:
    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".

  2. #2
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,791

    Default

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

  3. #3
    Senior Member
    Computer Details
    YZ's Computer Details
    Operating System:
    Windows XP
    CPU:
    Intel Duo Core E6550 @ 2.33GHz
    RAM:
    1.98 GHz, 3.23GB RAM
    Graphics:
    Intel G33/31 Express Chipset Family
    Monitor:
    LG Flatron W2343T
    Discipline
    Surveying
    YZ's Discipline Details
    Occupation
    CAD Operator and Manager; Land Survey, Civil Design
    Discipline
    Surveying
    Details
    Topographic ground surveys for architects and engineers; Subdivisions in NSW; Civil Engineering Design.
    Using
    AutoCAD LT 2012
    Join Date
    Oct 2007
    Location
    Sydney
    Posts
    256

    Default

    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.

  4. #4
    Forum Deity BlackBox's Avatar
    Using
    Civil 3D 2011
    Join Date
    Nov 2009
    Posts
    3,953

    Default

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

  5. #5
    Senior Member
    Computer Details
    YZ's Computer Details
    Operating System:
    Windows XP
    CPU:
    Intel Duo Core E6550 @ 2.33GHz
    RAM:
    1.98 GHz, 3.23GB RAM
    Graphics:
    Intel G33/31 Express Chipset Family
    Monitor:
    LG Flatron W2343T
    Discipline
    Surveying
    YZ's Discipline Details
    Occupation
    CAD Operator and Manager; Land Survey, Civil Design
    Discipline
    Surveying
    Details
    Topographic ground surveys for architects and engineers; Subdivisions in NSW; Civil Engineering Design.
    Using
    AutoCAD LT 2012
    Join Date
    Oct 2007
    Location
    Sydney
    Posts
    256

    Default

    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!

  6. #6
    Forum Deity
    Using
    Civil 3D 2013
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    3,791

    Default

    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

  7. #7
    Senior Member
    Computer Details
    YZ's Computer Details
    Operating System:
    Windows XP
    CPU:
    Intel Duo Core E6550 @ 2.33GHz
    RAM:
    1.98 GHz, 3.23GB RAM
    Graphics:
    Intel G33/31 Express Chipset Family
    Monitor:
    LG Flatron W2343T
    Discipline
    Surveying
    YZ's Discipline Details
    Occupation
    CAD Operator and Manager; Land Survey, Civil Design
    Discipline
    Surveying
    Details
    Topographic ground surveys for architects and engineers; Subdivisions in NSW; Civil Engineering Design.
    Using
    AutoCAD LT 2012
    Join Date
    Oct 2007
    Location
    Sydney
    Posts
    256

    Default

    Registered forum members do not see this ad.

    I ended up splitting this into 2 buttons:

    Code:
    ^C^C-RENAME;S;CT_ROMANT;ROMANT;
    and
    Code:
    ^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.

Similar Threads

  1. Parking Design: Stalls on a corner
    By Hitman6267 in forum AutoCAD General
    Replies: 22
    Last Post: 31st May 2011, 05:35 pm
  2. Rename blocks, individually, without using the RENAME command
    By iuliandonici in forum AutoCAD General
    Replies: 5
    Last Post: 9th May 2011, 11:15 am
  3. Replies: 2
    Last Post: 9th Dec 2010, 04:30 am
  4. block that exist doesn't exist
    By dusko in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 8th Jul 2010, 04:04 pm
  5. command exist or not!! how to find?
    By musa in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 29th Aug 2006, 06:03 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts