@Sea-Haven wrote:
.... get a pline put co-ords into a list
(if plent (setq lst (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget (car plent))))))
if closed (setq lst (cons (last lst) lst)) adds 1st point back in as last pt.
In this situation, it isn't necessary to get a list of vertex coordinates. The parameter-based approach in @pbejse 's Message 6 eliminates the need for that, and has another benefit. In a Polyline, if you step around to the last vertex, you have reached the end if it's open, but you haven't reached the end if it's closed. But if you go around to the end parameter value, you have reached the end, whether or not it's closed. It's only a question of the number of Points to draw, and using parameter values, you don't need to consider whether it's open or closed, if you structure the procedure the right way. I think [untested] that Message 6 could be altered in this way:
(Defun c:Middleman (/ ss i e n)
(if (setq ss (ssget '((0 . "LWPOLYLINE"))))
(repeat (setq i (sslength ss)); then
(setq e (ssname ss (setq i (1- i))))
(repeat (setq n (fix (vlax-curve-getEndParam e)))
(entmakex ; [could be just (entmake)]
(list
(cons 0 "POINT")
(cons 10 (vlax-curve-getPointAtParam e (+ (Setq n (1- n)) 0.5)))
); list
); entmake[x]
); repeat [Points]
); repeat [Polylines]
); if
(princ)
)
[Note that in addition to the different determination of the count, I changed a minus sign to a plus sign.]
Kent Cooper, AIA