.NET

Reply
Valued Contributor
bikelink
Posts: 54
Registered: ‎11-25-2001
Message 1 of 11 (373 Views)

does working SelectWindowPolygon just with 4 points ?

373 Views, 10 Replies
10-20-2010 02:50 PM

inside this area i have a circle..


lpt.Add(new Point3d(5.0, 5.0, 0.0));
               lpt.Add(new Point3d(13.0, 15.0, 0.0));
               lpt.Add(new Point3d(12.0, 9.0, 0.0));
               lpt.Add(new Point3d(5.0, 12.0, 0.0));
               lpt.Add(new Point3d(5.0, 5.0, 0.0));


// if I add the red row  SelectWindowPolygon return Error. without this its return the objects.

               PromptSelectionOptions Opts = new PromptSelectionOptions();
               Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
               Point3dCollection Polygon = new Point3dCollection(lpt.ToArray());
               PromptSelectionResult res   = ed.SelectWindowPolygon(Polygon);

maybe I'm a stupid...but I guess that a polygon could be have more then 4 vertex..

 

*Expert Elite*
norman.yuan
Posts: 998
Registered: ‎04-27-2009
Message 2 of 11 (369 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 03:06 PM in reply to: bikelink

SelectWindowPolygon()'s argument Point3dCollection can contains 3 or more Point3ds (To make a polygon, you need at least 3 points, right?).

Here "Window" does not mean a rectangle with 4 corners (while in SelectWindow(), "Window" means a rectangle, but only 2 points representing 2 opposite corners required). It means "window" selection, as opposed to "crossing" selection. That is only entities completely contained inside the polygon will be selected.

 

Valued Contributor
bikelink
Posts: 54
Registered: ‎11-25-2001
Message 3 of 11 (367 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 03:12 PM in reply to: bikelink

if I try to use with lisp (ssget "_wp".... (pointlist))

I can use 4 ,5 ,n points.  isn't it ?

of course i want to retrieve the object inside my polygon (6 vertex) fully included! (window)

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 4 of 11 (363 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 03:33 PM in reply to: bikelink

Does that polygon cross itself or have to closed regions

You can also find your answers @ TheSwamp
Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 5 of 11 (359 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 03:36 PM in reply to: Jeffrey_H

Never mind that was answered here

http://www.theswamp.org/index.php?topic=35384.0

You can also find your answers @ TheSwamp
Valued Contributor
bikelink
Posts: 54
Registered: ‎11-25-2001
Message 6 of 11 (358 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 03:37 PM in reply to: Jeffrey_H

it's very simple... I have 4 points (not a simple square) (sometime 5 points) and I want to check all entities fully  inside.

The dbobjects could be any kind (solid3d, circles, ecc...)

 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 7 of 11 (349 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 04:21 PM in reply to: bikelink

Jeffrey_H (and Jeff_M at the swamp) are correct.  The points you provided will generate a boundary that crosses itself, which is not allowed.  (oops.  my eyes are playing tricks and I skipped right over the first point in your list, which made what I wrote before in these parenthesis invalid)

 

I don't know how you are coming up with the points you need to define your polygon, but in your example, if you swap the second and third points, it will work.

 

Coincidently, there is a recent thread on this discussion group about how to programmatically determine if a polyline intersects itself.   I just tried to find it, but I am having some trouble locating it at the moment

Dave O.                                                                  Sig-Logos32.png
Valued Contributor
bikelink
Posts: 54
Registered: ‎11-25-2001
Message 8 of 11 (343 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 04:37 PM in reply to: chiefbraincloud

ok , sorry but with this points i haven't intersections

that's a real situation.

 

              lpt.Add(new Point3d(2526.11913296339, 4761.82097707599, 0));
               lpt.Add(new Point3d(2250.71913296339, 4761.82097707599, 0));
               lpt.Add(new Point3d(2299.01913296339, 4713.52097707599, 0));
               lpt.Add(new Point3d(2526.11913296339, 4713.52097707599, 0));
               lpt.Add(new Point3d(2526.11913296339, 4761.82097707599, 0));

 

 

the shape (black color)  is regular, without intersections (i moved out from others lines in order to show it)

under this points we have some entities but the selection fails!

 

 

Valued Contributor
bikelink
Posts: 54
Registered: ‎11-25-2001
Message 9 of 11 (336 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 04:45 PM in reply to: bikelink

ok discovered....i must to make a little offset ..else  nothing is really fully inside !

 

 

*Expert Elite*
chiefbraincloud
Posts: 753
Registered: ‎02-13-2008
Message 10 of 11 (332 Views)

Re: does working SelectWindowPolygon just with 4 points ?

10-20-2010 04:51 PM in reply to: bikelink

After Looking at your image, I was going to suggest that circle might be touching the boundary.

 

And FYI,  I was going to say that there is no need to provide the final closing coordinate, as AutoCAD will automatically treat the polygon as closed.

Dave O.                                                                  Sig-Logos32.png
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.