Hello all, greetings!
I would like to find a lisp routine that zoom extents all opened dwgs. I have done lots of search and haven't had luck. I found the one that zoom extents all the tabs within a drawing and it works great. BUT, I need only the one that Zoom extents all Opened drawings.
Could anyone help me with this? I will appreciate it
Thanks,
Alex
Might be easier to save the drawing with zoom extents.
(defun c:zz ()
(COMMAND "CMDECHO" 0)
(command "tilemode" 1) ;go to model space
(COMMAND "IMAGEFRAME" 0) ;turn off image frames
(command "hatchtoback")
(command "texttofront" "all")
(command "zoom" "e")
(command "tilemode" 0) ;go to paper space
(COMMAND "IMAGEFRAME" 0)
(command "-vports" "lock" "on" "all""") ;lock all viewports
(command "zoom" "e")
(command "qsave")
(COMMAND "CMDECHO" 1)
(command "close")
)
I use this for all my drawings, goes to model, zooms, hatch to back, text to front, back to paper space, locks all view ports zooms, and save and close
That one is good. Does it work from just one opened dwg?
I just want to zoom extents all the opened dwgs without going into each separate sheet so I can then do SAVEALL and CLOSEALL from just one opened file.
Switching between sheets takes a lot of time and I really want to cut some good amount of this time.
Thanks
Autolisp is not really the right tool for your needs. It is a single document application. Activating another document to do the zoomextents stops and autolsip program until the host document is activated again. You might be able to use autolisp to make a list of open documents and then write a script to cycle through the documents and zoomextents but that is like hacking.
VBA works since it is designed to work at the application level. Otherwise, it is best to use a .NET approach.
The following might or might not work for you depending on whether you have installed vba for your station.
(command "vbstmt" "for each n in documents:n.sendcommand(\"zoom extents \"):next")
This is not really a good solution since it depends on a quiescent state where there are no pending commands in any of the documents.
HELLO....
THIS CAN BE DONE THROUGH VLISUAL LISP. I HAVE WRITTEN A LISP ROUTINE WHICH ZOOM EXTENTS ALL OPENED DRAWINGS AND SAVES ALL THE DRAWINGS. I AM ATTACHING THE SAME WITH THIS MSG. TRY IT.
LOAD IT AND TYPE "ZOOMANDSAVE"...
AFTER RUNNING THE CODE YOU CAN CLOSE ALL THE DOCUMENTS WITH "CLOSEALL" COMMAND
It's giving me: "no function definition: VLA-POSTCOMMAND" message when I run it. Let me know. Thanks
Actually,the previous code which I have sent worked perfectly in my system....My Autocad version is of 2015...
Anyhow...I modified the file and again sending you....
Test this....
I have MEP 2013, and for some reason it keeps showing me the same message. But it looks good! I'll try to find out how I can fix it. Thanks for the help.
The 'PostCommand Method' was exposed to AutoLISP/VisualLISP only with the AC2015...
Henrique
That's bad news. Anyways, we'll be able to find the right script.
Thanks to all of you for the help so far!
Need do all layouts as well as Model, if really want zoom E fully.
Not tested, need other pc.
(DEFUN C:ZOOMANDSAVE ( / DOCS COUNT I TEMP_ELE)
(SETQ DOCS (VLAX-GET-PROPERTY (VLAX-GET-ACAD-OBJECT) "DOCUMENTS"))
(SETQ COUNT (VLAX-GET-PROPERTY DOCS "COUNT"))
(SETQ I 0)
(SETQ TEMP_ELE NIL)
(WHILE (< I COUNT)
(SETQ TEMP_ELE (VLAX-INVOKE-METHOD DOCS "ITEM" I))
(setvar 'ctab "Model")
(VLA-POSTCOMMAND TEMP_ELE "ZOOM E ")
(setq lays (layoutlist))
(foreach lay lays
(setvar 'ctab lay)
(command "pspace")
(VLA-POSTCOMMAND TEMP_ELE "ZOOM E ")
)
(SETQ I (+ I 1))
)
(VLAX-INVOKE-METHOD TEMP_ELE "SAVE")
(princ)
)