Jim,
You're welcome. I'm thinking about your posted below.
Joe Burke
> Thanks Joe, I will put that to good use.
> It turns out that Reeta had a deawing with adjoining polygons, so this
> approach wouldn't work any
> because it selected all that it touched.
> I took a slightly different approach using a window and min/max points on
> the polyline.
>
> (defun getpoly ( / ss ptlist lastent min_max minpt maxpt)
> (setq pt (getpoint "\nSelect point inside polygon"))
> (setq lastent (entlast))
> (command ".boundary" pt "")
> (setq ptlist nil)
> (foreach x (entget (entlast))
> (if (eq 10 (car x))
> (setq ptlist (cons (cdr x) ptlist))
> ))
> (if (not (equal lastent (entlast)))
> (entdel (entlast))
> )
> (setq ptlist (reverse ptlist))
> (setq min_max
> (list
> (apply 'mapcar (cons 'min ptlist))
> (apply 'mapcar (cons 'max ptlist))
> )
> minpt (car min_max)
> maxpt (cadr min_max)
> )
> (setq ss (ssget "w" minpt maxpt '((0 . "POLYLINE,LWPOLYLINE"))))
> (print)
> (if ss
> (ssname ss 0)
> (alert "No polyline found")
> )
> )
>
> "Joe Burke" wrote in message
> news:A27E498EB375C29670135C1236A9EC4A@in.WebX.maYIadrTaRb...
> > Jim,
> >
> > I posted something recently in a thread called "selection like hatch"
> > 7/18/02 which attempted to create a selection set using a boundary point
> > list as your getpoly function does. I found it highly unreliable. (ssget
> > "cp" ptlist) would often fail for no apparent reason.
> >
> > Turns out sometimes boundary creates a pline with duplicate points.
ssget
> > methods like "cp" "wp" and "f" will fail if there are duplicate points.
So
> > you have to weed out duplicates if they exist. I wrote the following to
do
> > that. If anyone has something similar/better, I'd love to see it. I'm
> pretty
> > new at this kind of stuff.
> >
> > ;remove duplicate points from point list
> > ;arguments: OLST - pointlist, FUZ - fuzz distance
> > ;returns new list with duplicates removed
> > (defun RemDupPts (OLST FUZ / NLST P1 P2)
> > (while (> (length OLST) 1)
> > (setq P1 (car OLST) P2 (cadr OLST))
> > (if (> (distance P1 P2) FUZ)
> > (setq NLST (cons P1 NLST))) ;if
> > (setq OLST (cdr OLST))
> > ) ;while
> > (setq NLST (cons (last OLST) NLST)) ;seems safe?
> > (reverse NLST)
> > ) ;end
> >
> > Sample point list temp1:
> > ((10103.1 1033.39 0.0) (9981.65 1035.87 0.0) (9944.66 1036.62 0.0)
> (9932.16
> > 1036.87 0.0) (9931.53 1005.88 0.0) (9931.45 1001.88 0.0) (9931.45
1001.88
> > 0.0)
> > (9930.79 969.888 0.0) (9930.79 969.888 0.0) (9930.54 957.391 0.0)
(9954.53
> > 956.902 0.0) (9984.53 956.291 0.0) (9990.53 956.169 0.0) (9995.53
956.067
> > 0.0)
> > (9994.98 929.073 0.0) (10041.5 928.126 0.0) (10101.0 926.915 0.0)
(10101.9
> > 972.405 0.0))
> >
> > Command: (remduppts temp1 0.1) - two duplicates removed
> > ((10103.1 1033.39 0.0) (9981.65 1035.87 0.0) (9944.66 1036.62 0.0)
> (9932.16
> > 1036.87 0.0) (9931.53 1005.88 0.0) (9931.45 1001.88 0.0) (9930.79
969.888
> > 0.0)
> > (9930.54 957.391 0.0) (9954.53 956.902 0.0) (9984.53 956.291 0.0)
(9990.53
> > 956.169 0.0) (9995.53 956.067 0.0) (9994.98 929.073 0.0) (10041.5
928.126
> > 0.0)
> > (10101.0 926.915 0.0) (10101.9 972.405 0.0))
> >
> > Joe Burke
> >
> >
>
>