.NET

.NET

Reply
Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 1 of 5 (307 Views)
Accepted Solution

How to get the float viewport collection through a circle?

307 Views, 4 Replies
03-13-2014 07:49 PM

in the modelspace there is a little circle.

in the current paperspace there are several viewports.

now i want to get the viewports which can view the little circle.

the circle point is pt.

*Expert Elite*
norman.yuan
Posts: 987
Registered: ‎04-27-2009
Message 2 of 5 (258 Views)

Re: How to get the float viewport collection through a circle?

03-14-2014 02:58 PM in reply to: swaywood

The steps of doing what you want would be like:

 

1. Find all viewports on the current layout (you may want to limited to locked viewport only);

2. Get each viewport's boundary (a collection of points, which could be 4 points of a rectangle, or all vertex points of a non-rectangle polyline2d);

3. Transform the viewport boundary points to modelspace points.

4. decide if the entity in interest in modelspace is contained inside the viewport's boundary projected in modelspace.

 

The key computing work here is:

 

1. how to translate a point ini paperspace into modelspace;

 

There are some sample code you can find if searching the Internet. Here is one of the link:

 

 http://www.theswamp.org/index.php?topic=34590.msg398539#msg398539

 

 

2. how to decide if an entity is located fully or partially inside a closed curve;

 

You can use Editor.SelectCrossingWindow/Polygon() to find if an entity is fully/partially inside a window or polygon. Make sure you zoom to the extents of the window or polygon first.

 

Actually, I have just started a draft for my blog article on this topic a couple days ago and have not finished it. Since you asked here, I'll post back when the article is published.

 

Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 3 of 5 (247 Views)

Re: How to get the float viewport collection through a circle?

03-14-2014 11:27 PM in reply to: norman.yuan
hi,yuan:
thank you very much.
i have done something like your step. but today, i found another method, that is linq, i want to make this program suing both the two method. and i also expect your post.
ps, r u chinese?
best regards
swaywood
*Expert Elite*
norman.yuan
Posts: 987
Registered: ‎04-27-2009
Message 4 of 5 (236 Views)

Re: How to get the float viewport collection through a circle?

03-15-2014 08:22 AM in reply to: swaywood
Valued Contributor
swaywood
Posts: 91
Registered: ‎08-22-2013
Message 5 of 5 (225 Views)

Re: How to get the float viewport collection through a circle?

03-16-2014 07:19 AM in reply to: norman.yuan
yuan,thanks a lot.
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.