Jeff Mishler
Guest
|
Posted:
Sun Jan 09, 2005 5:55 am Post subject:
Re: id pline, 2 adjoining segments and vertices |
|
|
Here's a little function that returns a 4 element list. If the selected
object is not a LWPLINE then all 4 wil be nil. If the first segment is
selected, the first item will be nil. If the selected segment is also the
last segemnt, then the 4th item will be nil. The endpoints of the selected
segment will be the 2nd & 3rd items.
(defun get_segment_ends (/ end1 end2 end3 end4 ent obj paramend parampt pt1)
(and (setq ent (entsel "\nSelect polyline: "))
(eq "LWPOLYLINE" (cdr (assoc 0 (entget (car ent)))))
(setq obj (vlax-ename->vla-object (car ent)))
(setq pt1 (vlax-curve-getclosestpointto obj (cadr ent)))
(setq parampt (fix (vlax-curve-getparamatpoint obj pt1)))
(setq paramend (fix (vlax-curve-getendparam obj)))
(if (> parampt 0)
(setq end1 (vlax-curve-getpointatparam obj (1- parampt)))
t
)
(setq end2 (vlax-curve-getpointatparam obj parampt)
end3 (vlax-curve-getpointatparam obj (1+ parampt))
)
(if (< (1+ parampt) paramend)
(setq end4 (vlax-curve-getpointatparam obj (+ 2 parampt)))
t
)
)
(list end1 end2 end3 end4)
)
--
Jeff
check out www.cadvault.com
"spykat" <nospam@address.withheld> wrote in message
news:17071255.1105148683550.JavaMail.jive@jiveforum2.autodesk.com...
| Quote: | I need a little help with this one because I don't have the time to do it
my self.
I need to be able to pick a segment of a lwpolyline and get the end
points of that segment and the end points of the first segment on each
side of the first segment. Thank for any help you can give me. |
|
|