it's raining...
;;; Count inserts within polyline LPS 2010-06-09
(defun c:test (/ idx obj endparam ss1)
(vl-load-com)
(setq ptlst nil)
(setq ss1 nil)
(setq obj (vlax-ename->vla-object (car (setq pl (entsel "\nSelect polyline boundary: ")))))
(if (or; test if polyline and has area
(/= (vlax-get-property obj 'ObjectName) "AcDbPolyline")
(zerop (vlax-get-property obj 'Area))
)
(princ "\nSelected entity is not a polyline or can not be used for a selection window")
)
(setq ptlst (list (vlax-curve-getStartPoint obj))
idx 1)
(if (zerop (vlax-get obj 'Closed))
(setq endparam (vlax-curve-getParamAtPoint obj (vlax-curve-getEndPoint obj)));if open param at end point
(setq endparam (cdr (assoc 90 (entget (vlax-vla-object->ename obj)))));if closed # vertices
)
(while
(<= idx endparam)
(if;test for curve - thanks to Lee Mac and others
(not
(equal
(angle '(0 0 0)
(vlax-curve-getSecondDeriv obj (1- idx))) 0.0 1e-8)
);not
(progn
(setq cnt (1- idx))
(repeat 15;divide curve
(setq ptlst(cons (vlax-curve-getPointAtParam obj (+ cnt 0.0625)) ptlst)
cnt (+ 0.0625 cnt))
);repeat
);progn
);if
(setq ptlst (cons (vlax-curve-getPointAtParam obj idx) ptlst)
idx (1+ idx))
);while
(setq ptlst (reverse ptlst))
(setq ss1 (ssget "_WP" ptlst '((0 . "INSERT"))))
(princ (strcat "\nThe number of inserts within the polyline is " (itoa (setq ssnum (sslength ss1)))))
(princ)
);defun