vla-open

Discussion in 'AutoCAD' started by Gary J. Orr, Dec 16, 2003.

  1. Gary J. Orr

    Gary J. Orr Guest

    I am trying to open a given drawing using vla-open and am overlooking some
    very basic concept... Any suggestions will be appreciated. My current
    process is:

    (setq newacadapp (vlax-create-object "AutoCad.Application"))
    (vla-put-visible newacadapp "true");this line will be removed to make this
    invisible to the user
    (setq currdocs (vla-get-documents newacadapp))

    ;;;(vla-open newacaddwg)
    ;;;(setq dwgobj (vla-open "H:\\03proj\\12345\\dwgs_04\\a\\12345a101.dwg"))
    ;;;or
    ;;;(vla-open dwgobj)

    (setq thisacaddwg (vla-get-activedocument newacadapp))
    ;;;get some info here...
    (vla-close thisacaddwg)
    (vlax-release-object newacadapp)

    or something along those lines.

    Thanx much

    --
    Gary J. Orr
    CADD Administrator
    (218) 279-2421


    LHB, Inc
    21 West Superior Street, Suite 500
    Duluth, Mn 55802
    (218) 727-8446
    www.LHBcorp.com
     
    Gary J. Orr, Dec 16, 2003
    #1
  2. Gary,

    try this:

    (defun open-dwg (fullfilename)
    (setvar "cmdecho" 0)
    (vl-cmdf "._vbastmt"
    (strcat "AcadApplication.Documents.Open \""
    fullfilename
    "\""))
    (setvar "cmdecho" 1)
    (princ))

    or'...

    (defun rcmd-active-dwg (fName / docs)
    (vlax-for doc (vla-get-documents (vlax-get-acad-object))
    (setq docs (cons doc docs)))
    (not
    (vl-catch-all-error-p
    (vl-catch-all-apply
    'vla-put-activeDocument
    (list
    (vlax-get-acad-object)
    (vl-some
    (function (lambda (item)
    (if (eq (vla-get-fullName item) fName)
    item)))
    docs))))))
     
    Luis Esquivel, Dec 16, 2003
    #2
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.