id pline, 2 adjoining segments and vertices
CADForums.net Forum Index CADForums.net
Discussion of AutoCAD and other CAD software.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web cadforums.net
id pline, 2 adjoining segments and vertices

 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization
Author Message
spykat
Guest





Posted: Sat Jan 08, 2005 6:44 am    Post subject: id pline, 2 adjoining segments and vertices Reply with 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.

Back to top
Jeff Mishler
Guest





Posted: Sun Jan 09, 2005 5:55 am    Post subject: Re: id pline, 2 adjoining segments and vertices Reply with quote

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.
Back to top
 
Post new topic   Reply to topic    CADForums.net Forum Index -> Customization All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server DSP VoIP Electronics New Topics
Powered by phpBB