How to get the float viewport collection through a circle?

How to get the float viewport collection through a circle?

swaywood
Collaborator Collaborator
1,217 Views
4 Replies
Message 1 of 5

How to get the float viewport collection through a circle?

swaywood
Collaborator
Collaborator

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.

0 Likes
Accepted solutions (1)
1,218 Views
4 Replies
Replies (4)
Message 2 of 5

norman.yuan
Mentor
Mentor
Accepted solution

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.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5

swaywood
Collaborator
Collaborator
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
0 Likes
Message 4 of 5

norman.yuan
Mentor
Mentor
0 Likes
Message 5 of 5

swaywood
Collaborator
Collaborator
yuan,thanks a lot.
0 Likes