.NET

.NET

Reply
Valued Contributor
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 1 of 5
Accepted Solution

How to get the float viewport collection through a circle?

332 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.

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.

 

*Expert Elite*
1,088 Posts
217 Kudos
Registered: ‎04-27-2009
Post 2 of 5

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
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 3 of 5

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*
1,088 Posts
217 Kudos
Registered: ‎04-27-2009
Post 4 of 5

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

03-15-2014 08:22 AM in reply to: swaywood
Valued Contributor
91 Posts
1 Kudo
Registered: ‎08-22-2013
Post 5 of 5

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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!