Zoom Extends for all drawing

Zoom Extends for all drawing

Anonymous
Not applicable
829 Views
5 Replies
Message 1 of 6

Zoom Extends for all drawing

Anonymous
Not applicable

I'm using AutoCAD 2013 and .NET VBA for some drawing automation. I saw an older post 

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/zoom-extents-for-all-tabs/m-p/244524...

 

which runs a lisp that zoomExtends the drawing. But I'm new to LISP and i dont know where to save this acaddoc.lsp or acad.lsp. 

I saw some answers which said location can be set at Option-> SupportFileSearchPath

I tried adding the acaddoc.lsp 's folder location to this searchpath and it doesnt seem working. can somebody help me step by step. I'm New to lisp.

 

0 Likes
Accepted solutions (2)
830 Views
5 Replies
Replies (5)
Message 2 of 6

marko_ribar
Advisor
Advisor
Accepted solution

If folder in which was opened DWG during session holds acaddoc.lsp, then that acaddoc.lsp will be loaded in precedance than others... Typically I store my main acaddoc.lsp in \support folder of Acad installation dir... That way I don't have to add new path to SFSP (support file search paths)...

Marko Ribar, d.i.a. (graduated engineer of architecture)
Message 3 of 6

phanaem
Collaborator
Collaborator
Accepted solution

You can place your acaddoc.lsp in any folder specified in SFSP.

In order to run the lisp on every drawing, your acaddoc.lsp file must contain the function definition (or a loading routine) AND the command that launch the function.

 

(defun C:MY_FUNCTION ()
  {code here}
  )

(C:MY_FUNCTION)

or

 

(load "C:\\lisp_path\\lisp_file.lsp")

(C:MY_FUNCTION)
Message 4 of 6

Anonymous
Not applicable

I want it fixed at one location. Where do i keep it?

0 Likes
Message 5 of 6

phanaem
Collaborator
Collaborator
You also need to add the lisp location to the TRUSTED LOCATIONS or set SECURELOAD sysvar to 0.
0 Likes
Message 6 of 6

Anonymous
Not applicable

How can i make LISP command run on Model Space. It is currently running on ActiveLayout. and Im getting the zoomextends version of the Layout view. I want the zoom extends version of the Model Space. Thanks in Advance.

Here is the code i used.

 

 

(defun c:ZEA (/ acad acdoc aclay)
(vl-load-com)
(setq acad (vlax-get-acad-object)
acdoc (vla-get-ActiveDocument acad)
aclay (vla-get-ActiveLayout acdoc)
)
(vlax-for layout (vla-get-Layouts acdoc)
(vla-put-ActiveLayout acdoc layout)
(vla-ZoomExtents acad)
)
(vla-put-ActiveLayout acdoc aclay)
(princ)
)

(C:ZEA)

 

 

Thanks in advance

0 Likes