TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: JohnSnow on May 12, 2022, 11:42:04 AM

Title: How do I select what to display in my viewport
Post by: JohnSnow on May 12, 2022, 11:42:04 AM
Hi,

I have used vla-AddPViewport to create a viewport in paper space. But I don't know how to set the contents I want from model space to be displayed in this viewport. What functions should I use?
I have searched online for awhile but no luck so far.
Any examples will be much appreciated!
 :smitten:
Title: Re: How do I select what to display in my viewport
Post by: mhupp on May 12, 2022, 12:06:17 PM
Code - Auto/Visual Lisp: [Select]
Applies only to the Active viewport. you would then have to set the scale or refine it to your liking from there.
Title: Re: How do I select what to display in my viewport
Post by: 57gmc on May 12, 2022, 02:13:13 PM
After you create the vp, you use it's Center, Direction and Target properties to display what you want. For some sample code, find the acadauto.chm file in your acad folder or use the online ActiveX Developer Reference (https://help.autodesk.com/view/OARX/2022/ENU/?guid=GUID-2B609059-6B70-4C66-A442-F5917363462A). Unfortunately, you have to translate the ActiveX from vba to lisp.
p.s. I found plenty of sample code by searching the lisp forum. Here's one sample (https://www.theswamp.org/index.php?topic=47145.0;all).
Title: Re: How do I select what to display in my viewport
Post by: JohnSnow on May 12, 2022, 10:35:25 PM
Thank you very much. I will have a look
Title: Re: How do I select what to display in my viewport
Post by: JohnSnow on May 14, 2022, 01:00:47 AM
I have tried this (vla-zoomextents (vlax-get-acad-object)) and it works nice.
However, as mentioned it applies to active viewport only while I have multiple drawings opened at the same time of which viewports I want to set.
So I guess I cannot use this method unless I set sdi to be 0, which means I cannot have multiple drawings opened so I have to do it one by one.
One way I can think of is use .scr.
Do you have any other suggestions?
Thank you
Title: Re: How do I select what to display in my viewport
Post by: framednlv on May 18, 2022, 11:49:55 AM
Just my thoughts...

In paper space, type mview and then new.  It will change to model space and you draw a rectangle around what you want to show.  After you click enter to accept, it will change to paperspace.  You can then right click and select the scale you want to use.

Not sure when they added the new option, but it seems to work pretty good. 
Title: Re: How do I select what to display in my viewport
Post by: BIGAL on May 22, 2022, 11:50:36 PM
Is there a reason you have multiple dwgs why not 1 and multiple layouts.

My other suggestion is use a dwt with a correct layout setup so it has your title block note at 1:1 size. And a mview set up then just dbl click inside it and zoom E as a start.
Title: Re: How do I select what to display in my viewport
Post by: JohnSnow on May 23, 2022, 10:12:23 PM
I use sheet set manager with multiple drawings instead of one drawing with multiple layouts