Run command on drawing opening on modelspace. I

Run command on drawing opening on modelspace. I

Anonymous
Not applicable
592 Views
2 Replies
Message 1 of 3

Run command on drawing opening on modelspace. I

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. i want this code to be altered to work on modelspace rather than layout

 

 

(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)

0 Likes
593 Views
2 Replies
Replies (2)
Message 2 of 3

Jonathan3891
Advisor
Advisor

Why do you need a lisp to zoom extents in model space?

 

This can be easily added to your ACADDOC lisp which runs as soon as a drawing is open.

 

You could use something along the lines of this:

 

(command "tilemode" "1" "zoom" "extents")

Setting tilemode to 1 switches to model space.

 

If you wanted to zoom extents model space and switch back to paper space try this:

 

(command "tilemode" "1" "zoom" "extents" "tilemode" "0")

Jonathan Norton
Blog | Linkedin
0 Likes
Message 3 of 3

paullimapa
Mentor
Mentor

Check out this example I found by googling "vla-ZoomExtents tilemode":

http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/vla-for-zoom-extents/td-p/2161297

 

In your case, instead of:

(vla-setvariable *doc* "tilemode" 0)

 

You'll want to set it to 1:

(vla-setvariable *doc* "tilemode" 1)

 

Then the following line of code will be invoked in model space only:

(vla-zoomextents *acad*)

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes