Results 1 to 5 of 5

Thread: Adding a Suffix to the drawing name

  1. #1
    I could stop if I wanted to
    Join Date
    2015-12
    Posts
    385
    Login to Give a bone
    0

    Cool Adding a Suffix to the drawing name

    Hello all,
    I am trying to add a suffix to the drawing name and current layout.
    I have started with the following but get drawings with names such as:

    M001- LEGENDS,SYMBOLS AND ABBREVIATIONS.dwg_P1.dwg

    My questions is how do i get rid of the first0 ".dwg"?

    Thank you all in advance,
    Andre
    Code:
    (defun c:test (/ olddwgname suf newdwgname dwgpath oldlayoutname)
      (setq olddwgname (getvar "dwgname"))
      (setq suf (getstring T"\enter suffix: "))
      (setq newdwgname (strcat odn suf))
      (setq dwgpath (getvar "dwgprefix"))
      (setq oldlayoutname (getvar "ctab"))
      (command "-layout" "rename" "" (strcat oldlayoutname suf ""))
      (command ".saveas" "2004" (strcat dwgpath newdwgname))
      (princ))


    Thanks again,
    Andre
    Last edited by Opie; 2007-08-27 at 03:32 PM. Reason: [CODE] tags added

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

    Default Re: Adding a Suffix to the drawing name

    Replace:
    Code:
    (setq olddwgname (getvar "dwgname"))
    with this:
    Code:
    (setq odn (vl-filename-base (getvar "dwgname")))
    R.K. McSwain | CAD Panacea |

  3. #3
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,106
    Login to Give a bone
    0

    Default Re: Adding a Suffix to the drawing name

    If going with the vlisp functions as suggested, make sure (vl-load-com) is run beforehand. It should save at least one headache.
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

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

    Wink Re: Adding a Suffix to the drawing name

    Quote Originally Posted by Opie View Post
    If going with the vlisp functions as suggested, make sure (vl-load-com) is run beforehand. It should save at least one headache.
    True.

    Here is a vanilla lisp option.

    Code:
    (setq dwgname (getvar "dwgname"))
    (setq odn (substr dwgname 1 (- (strlen dwgname) 4)))
    R.K. McSwain | CAD Panacea |

  5. #5
    AUGI Addict kennet.sjoberg's Avatar
    Join Date
    2002-05
    Posts
    1,707
    Login to Give a bone
    0

    Default Re: Adding a Suffix to the drawing name

    Quote Originally Posted by Opie View Post
    If going with the vlisp functions as suggested, make sure (vl-load-com) is run beforehand. It should save at least one headache.
    Not needed when using only vl- commands
    but for the good sake, always load it ; )

    : ) Happy Computing !

    kennet

Similar Threads

  1. Adding Suffix to All Layers
    By ReachAndre in forum AutoLISP
    Replies: 11
    Last Post: 2016-01-11, 06:07 PM
  2. adding suffix width sheet name to a view
    By Wish List System in forum Revit Architecture - Wish List
    Replies: 1
    Last Post: 2013-11-15, 06:03 PM
  3. Adding a suffix to certain Layer names
    By mtlynn in forum AutoLISP
    Replies: 6
    Last Post: 2007-01-04, 08:20 PM
  4. Adding Prefix and Suffix parameter in Text
    By jrichardson in forum Revit Structure - General
    Replies: 2
    Last Post: 2006-12-08, 02:46 AM

Posting Permissions

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