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.
Solved! Go to Solution.
Solved by norman.yuan. Go to 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
I have posted my blog article here:
http://drive-cad-with-code.blogspot.ca/2014/03/selecting-entities-in-modelspace.html
Norman Yuan
Can't find what you're looking for? Ask the community or share your knowledge.