• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Valued Contributor
    Posts: 54
    Registered: ‎11-25-2001

    does working SelectWindowPolygon just with 4 points ?

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

     

    Please use plain text.
    *Expert Elite*
    Posts: 706
    Registered: ‎04-27-2009

    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.

     

    Please use plain text.
    Valued Contributor
    Posts: 54
    Registered: ‎11-25-2001

    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)

    Please use plain text.
    Valued Mentor
    Posts: 372
    Registered: ‎01-20-2010

    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
    Please use plain text.
    Valued Mentor
    Posts: 372
    Registered: ‎01-20-2010

    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
    Please use plain text.
    Valued Contributor
    Posts: 54
    Registered: ‎11-25-2001

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

     

    Please use plain text.
    *Expert Elite*
    chiefbraincloud
    Posts: 736
    Registered: ‎02-13-2008

    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
    Please use plain text.
    Valued Contributor
    Posts: 54
    Registered: ‎11-25-2001

    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!

     

     

    Please use plain text.
    Valued Contributor
    Posts: 54
    Registered: ‎11-25-2001

    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 !

     

     

    Please use plain text.
    *Expert Elite*
    chiefbraincloud
    Posts: 736
    Registered: ‎02-13-2008

    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
    Please use plain text.