Open a dwg from lisp

Discussion in 'AutoCAD' started by Chip Harper, Apr 19, 2004.

  1. Chip Harper

    Chip Harper Guest

    This isn't working on 2004 and I'm drawing a blank as to why not ....

    (defun c:OpenDWG ()
    (setq CFDI (getvar "filedia"))
    (setq CSDI (getvar "sdi"))
    (setvar "sdi" 0)
    (setvar "filedia" 0)
    (command "open" "C:/CAD Files/Details/LB Detail Standards.dwg")
    (setvar "filedia" CFDI)
    )
     
    Chip Harper, Apr 19, 2004
    #1
  2. Chip Harper

    BillZ Guest

    Try this:

    ;;;;R.Robert Bell

    (defun CmdOpenDwgNow (fqnName / oldCmdEcho)
    (setq oldCmdEcho (getvar "CmdEcho"))
    (setvar "CmdEcho" 0)
    (command "._VBAStmt" (strcat "AcadApplication.Documents.Open \"" fqnName "\"")
    )
    (setvar "CmdEcho" oldCmdEcho)
    (princ)
    )
    (princ)

    Bill
     
    BillZ, Apr 19, 2004
    #2
  3. Chip Harper

    Chip Harper Guest

    Found it, Thanks! :)
     
    Chip Harper, Apr 19, 2004
    #3
  4. Chip Harper

    Chip Harper Guest

    Thanks Bill. :)
     
    Chip Harper, Apr 19, 2004
    #4
  5. Chip Harper

    BillZ Guest

    You're welcome.
     
    BillZ, Apr 19, 2004
    #5
  6. I've used "cmdopen" with sucess but within my Lisp I want to focus on that
    new opened drawing to let my program make some changes.
    Is that possible?

    Rolf
     
    Rolf Rosenquist, Apr 19, 2004
    #6
  7. To open a DWG file with Autolisp, use:
    (command "FILEOPEN" "C:/CAD Files/Details/LB Detail Standards.dwg")
    Jacky Terrien, AIDACAD
    http://aidacad.com/en/autolisp.htm



    Chip Harper a écrit :
     
    Jacky Terrien, Apr 20, 2004
    #7
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.