How do I get the current drawing name in AUTOLISP

Discussion in 'AutoCAD' started by David Graham, Dec 19, 2003.

  1. David Graham

    David Graham Guest

    How can I get the currently open drawing file name in AUTOLISP?

    Thanks,

    David
     
    David Graham, Dec 19, 2003
    #1
  2. David Graham

    Tom Berger Guest

    (getvar "dwgname")

    Tom Berger
     
    Tom Berger, Dec 19, 2003
    #2
  3. David Graham

    R. Wink Guest

    It depends. This is a piece of code I use to determine if the user is in R14 or something later. The drawing name is stored
    in different formats in different versions.

    (if
    (< (getvar "acadver") "14")
    (setq dwg (getvar "dwgname"))
    (setq dwg (strcat (getvar "dwgprefix") (getvar "dwgname"))))
    (setq dwgl (strlen dwg))
    (if
    (< (getvar "acadver") "14")
    (setq dwg dwg)
    (setq dwg (substr dwg 1 (- dwgl 4))))

    R. Wink
     
    R. Wink, Dec 19, 2003
    #3
  4. David Graham

    David Graham Guest

    Thanks for the help.
    David
     
    David Graham, Dec 23, 2003
    #4
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.