IFRs
Petroleum
- Nov 22, 2002
- 4,658
Can anyone suggest a lisp that counts the number of verticies in a polyline or lwpolyline?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
(defun c:nvert ()
(vl-load-com)
(setq Pl_Ent (car (entsel "\nSelect polyline: ")))
(setq VL_Obj (vlax-ename->vla-object Pl_Ent))
(setq endParam (vlax-curve-getEndParam Vl_Obj))
(setq NumVert (+ 1 endParam))
(princ (strcat "\n" (rtos NumVert 2 0) " vertices"))
(princ)
)
;;routine to provide number vertices and length
;;for a single polyline. And maybe a few other objects
(defun c:nvert ()
(vl-load-com)
(setq Pl_Ent (car (entsel "\nSelect polyline: ")))
(setq VL_Obj (vlax-ename->vla-object Pl_Ent))
(setq endParam (vlax-curve-getEndParam Vl_Obj))
(setq NumVert (+ 1 endParam))
(setq Pl_Len (vlax-curve-getDistAtParam VL_Obj endParam))
(princ (strcat "\n" (rtos NumVert 2 0) " vertices"))
(princ (strcat "\nLength= " (rtos Pl_Len)))
(princ)
)