Change Layout name to filename 64 characters long

Discussion in 'AutoCAD' started by z03656, Mar 16, 2005.

  1. z03656

    z03656 Guest

    Is there a way to change a current Layout name to a filename 64 characters long?

    As far as I know I can take off the extension of the filename by using the lisp below. That's taking off 4 characters from the right of the filename. I'm looking for a lisp that would allow me to rename up to 64 characters long from the left of the filename.

    Here's what I have so far:

    (defun C:loRe ()
    (setq ctabname(substr (getvar "dwgname") 1 (- (strlen (getvar "dwgname")) 4)))
    (command ".layout" "R" "" ctabname)
    (princ)
    )
     
    z03656, Mar 16, 2005
    #1
  2. try -
    (vl-load-com) ; only required once per session
    (setq ctabname (vl-filename-base (getvar "dwgname")))

    lisp below. That's taking off 4 characters from the right of the filename.
    I'm looking for a lisp that would allow me to rename up to 64 characters
    long from the left of the filename.
     
    Alan Henderson @ A'cad Solutions, Mar 16, 2005
    #2
  3. z03656

    z03656 Guest

    Okay, here's what I'm trying to do.
    Example:
    Here's my file name at 81 character's long:
    MA-G-500020-1-12KV NO.3 XFMR PCB B3273 MA342 AC-DC SCHEMATIC & WIRING DIAGRAM.dwg

    Here's my file name at 64 characters long:
    MA-G-500020-1-12KV NO.3 XFMR PCB B3273 MA342 AC-DC SCHEMATIC & W

    I'm looking for a lisp that would rename my layout to a maximum of 64 characters long (it can't exceed 64 characters) I have alot of file names that are over 64 characters long. Any ideas?
     
    z03656, Mar 16, 2005
    #3
  4. z03656

    Gary Fowler Guest

    Your xref layer names must be long....

    I would look for ways to shorten your file names.
    MA-G-500020-1-12KV #3 XFMR PCB B3273 MA342 AC-DC Sch-Wire Dia.dwg
     
    Gary Fowler, Mar 16, 2005
    #4
  5. (defun C:loRe ()
    (vl-load-com)
    (setq ctabname (substr (vl-filename-base (getvar "dwgname")) 1 64))
    (command ".layout" "R" "" ctabname)
    (princ)
    )
     
    Alan Henderson @ A'cad Solutions, Mar 17, 2005
    #5
  6. z03656

    z03656 Guest

    Exactly what I was looking for! Thanks for your understanding.
     
    z03656, Mar 17, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.