What's wrong with this code ?

Discussion in 'AutoCAD' started by trathbun, Jul 14, 2003.

  1. trathbun

    trathbun Guest

    Does anyone know what's wrong with this code ?

    (defun c:zoom_e_save (/ $acad docs dnum this)
      (vl-load-com)
      (setq $acad (vlax-get-acad-object)
    docs (vla-get-documents $acad)
    this (vla-get-activedocument $acad)
    dnum (vla-get-count docs)
      )
      (vlax-for each docs
        (vla-put-activedocument each)
        (vla-zoomextents $acad)
        (vla-save each)
      )
      (vla-put-activedocument this)
      (vlax-release-object docs)
      (vlax-release-object this)
      (vlax-release-object $acad)
      (princ (strcat "\nProcessed " (itoa dnum) " drawings."))
      (princ)
    )

    Thanks,
     
    trathbun, Jul 14, 2003
    #1
  2. Yeah. Visual LISP vacuums in MDI operations.

    Place this VBA code in a standard module, and give it a try.


    Public Sub Test()
    Dim App As AcadApplication
    Set App = ThisDrawing.Application
    Dim Doc As AcadDocument
    For Each Doc In App.Documents
    Doc.Activate
    App.ZoomExtents
    Doc.Save
    Next Doc
    MsgBox "Processed " & CStr(App.Documents.Count) & " drawings.",
    vbInformation, "Finished"
    Set App = Nothing
    End Sub


    --
    R. Robert Bell, MCSE
    www.AcadX.com


    | Does anyone know what's wrong with this code ?
    | (defun c:zoom_e_save (/ $acad docs dnum this)
    | (vl-load-com)
    | (setq $acad (vlax-get-acad-object)
    | docs (vla-get-documents $acad)
    | this (vla-get-activedocument $acad)
    | dnum (vla-get-count docs)
    | )
    | (vlax-for each docs
    | (vla-put-activedocument each)
    | (vla-zoomextents $acad)
    | (vla-save each)
    | )
    | (vla-put-activedocument this)
    | (vlax-release-object docs)
    | (vlax-release-object this)
    | (vlax-release-object $acad)
    | (princ (strcat "\nProcessed " (itoa dnum) " drawings."))
    | (princ)
    | )
    |
    | Thanks,
    |
     
    R. Robert Bell, Jul 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.