Results 1 to 3 of 3

Thread: Text Style Rename Lisp

  1. #1
    Member
    Join Date
    2014-10
    Posts
    14
    Login to Give a bone
    0

    Default Text Style Rename Lisp

    Hello Everyone –

    I am looking for some help to create a lisp program to update a text style name.

    Our company has several 1000 drawing that I need to rename a text style. The same style name is the same in different drawings formats (e.g. ‘A’, ‘B’ and ‘D’ size sheets). The properties of this style changes from drawing format to drawing format. I have 3 styles to change for each drawing format previously mentioned.

    I believe I need to program to do the following:

    • Check to see if the style exists
    • If the style exists check the drawing format and rename accordingly
    • If the style does not exist do nothing


    I use the useri5 system variable to determine the drawing format. I set a number to a variable called ‘size’. Please see below.
    A = 1
    B = 2
    C = 3
    D = 4
    E = 5

    Sample Code:

    (if (= size 4) (tblsearch "STYLE" "Bordtxt")
    (progn
    (command "-RENAME" "_STYLE" "Bordtxt" "D_Bordertext1")
    )
    )


    The code above does not use the 'size' variable and returns an error if the style does not exist.

    This seems like it would be a simple enough task, but for some reason I’m having a brain fart. Any help would be greatly appreciated.

    Thank you in advanced for your help with this.

  2. #2
    Administrator rkmcswain's Avatar
    Join Date
    2004-09
    Location
    Earth
    Posts
    9,805
    Login to Give a bone
    0

    Default Re: Text Style Rename Lisp

    I just ran this code and it worked fine.

    Code:
    (if 
     (and 
      (= (getvar "useri5") 4) 
         (tblsearch "style" "bordtxt")
      )
     (vl-cmdf ".rename" "style" "bordtxt" "D_Bordertext1")
    )
    R.K. McSwain | CAD Panacea |

  3. #3
    Member
    Join Date
    2014-10
    Posts
    14
    Login to Give a bone
    0

    Default Re: Text Style Rename Lisp

    Thank you for the fast reply... this code works for me

Similar Threads

  1. LISP to change all dimension & leader text style
    By Mike1710 in forum AutoCAD Customization
    Replies: 1
    Last Post: 2017-05-04, 11:40 AM
  2. Replies: 1
    Last Post: 2014-08-08, 05:20 PM
  3. changing existing text to new style with LiSP
    By gallows214585 in forum AutoLISP
    Replies: 6
    Last Post: 2010-03-04, 08:59 PM
  4. Set the current text style via LISP?
    By pmedina in forum AutoLISP
    Replies: 2
    Last Post: 2006-11-13, 07:01 PM
  5. Text style lisp help
    By BCrouse in forum AutoLISP
    Replies: 2
    Last Post: 2005-04-27, 09:36 PM

Tags for this Thread

Posting Permissions

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