I have a old program I'm trying to update for 2014. It would prompt you to pick a segment of a polyline then return the vertices of that segment and for the adjacent segment on eash side.
(setq pline (entsel "\nSelect end of Slab"))
(setvar "osmode" 0)
(setq pl (car pline)
pl1 (entget pl)
pick (cadr pline)
plObj (vlax-ename->vla-object pl)
pick2 (vlax-curve-getclosestpointto plobj pick)
param (vlax-curve-getparamatpoint plObj pick2)
segment (fix param)
vertlist (get-vertices pl1))
(if (= segment 0)(setq apt1 (nth (1- (cdr (assoc 90 pl1))) vertlist))(setq apt1 (nth (1- segment) vertlist)))
(setq apt2 (nth segment vertlist))
(if (= segment (1- (cdr (assoc 90 pl1))))(setq apt3 (nth 0 vertlist))(setq apt3 (nth (1+ segment) vertlist)))
(if (= segment (1- (cdr (assoc 90 pl1))))(setq apt4 (nth 1 vertlist))(setq apt4 (nth (+ 2 segment) vertlist)))
When I try this in AutoCAD 2014 I get something like;
Command: !vertlist
((10304.7 765.717) 0 0.0 0.0 0.0 (10544.7 729.717) 0 0.0 0.0 0.0 (10544.7 1271.72) 0 etc.
It doesn't appear to return the complete list of vertices and I also don't know where all of those 0's came from.
Can anybody help me debug this?
Solved! Go to Solution.
Solved by Kent1Cooper. Go to Solution.
I can't speak for @j.cordero but the subject of polylines always brings up responses of how to access their data and deal with them. Here you have seen a variety of ways, any one of which may help the OP or any lurker learn how to write the code that serves his needs.
John F. Uhden