Need help to create new drawing

Discussion in 'AutoCAD' started by Mike, Jun 15, 2004.

  1. Mike

    Mike Guest

    Hi! Help needed...
    I make new drawing using
    (vlax-invoke-method (vla-get-Documents (vlax-get-Acad-Object)) 'Add
    "acadiso.dwt")
    Ok. I'm store returned #<VLA-OBJECT IAcadDocument ??????> .
    But what I must to do to make this document active?

    Mike
     
    Mike, Jun 15, 2004
    #1
  2. Mike

    BillZ Guest

    Try this:

    (defun Q_new (/ acad acaddoc newdoc QnewTemplatePath)
    (vl-load-com)
    (setq acad (vlax-get-acad-object)
    )
    (setq acadDoc (vlax-get-property acad 'Documents)
    )
    ;;;
    (setq QnewTemplatePath "C:\\Documents and Settings\\wpz\\Local Settings\\Application Data\\Autodesk\\AutoCAD 2005\R16.1\\enu\\Template\\acad.dwt")
    ;;;
    (setq newDoc (vlax-invoke-method acadDoc 'Add QnewTemplatePath)
    )
    (if (/= newDoc nil)
    (vlax-invoke-method newDoc 'Activate)
    (prompt "\nFailed to create new drawing file.")
    )
    )

    Bill
     
    BillZ, Jun 15, 2004
    #2
  3. Mike

    Mike Guest

    Ok. I receive a reference to [NewDoc] and store in temp variable.

    But when I try to call (vlax-invoke-method [newDoc] 'Activate)

    VLisp IDE didn't respond while I'm not switching drawing window manually.

    Mike.

    Settings\\Application Data\\Autodesk\\AutoCAD
    2005\R16.1\\enu\\Template\\acad.dwt")
     
    Mike, Jun 15, 2004
    #3
  4. Regardless of how you do it, changing the active document
    will cause your program's execution to be suspeded until
    the current active document is active again. That's how LISP
    works, and there is no getting around it.

    I've not tried using ActiveX from lisp on non-active documents,
    so I can't say if that will work.
     
    Tony Tanzillo, Jun 16, 2004
    #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.