Good day.
I need help to modify this lisp.
The lisp selects one or more polylines and passes the ones that are counterclockwise to the clockwise direction.
I need the lisp to select only one polyline and if it is counterclockwise it goes clockwise.
Please can you help me?
Thank you.
The lisp is as follows:
(defun c:test ( / sel poly rpoly n sing)
(prompt "\nSelect LWPolylines:")
(if (setq sel (ssget '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
(progn
(setq poly (ssadd)
rpoly 0)
(repeat (setq n (sslength sel))
(setq sing (ssname sel (setq n (1- n))))
(if (verso_poly sing)
(setq poly (ssadd sing poly)
rpoly (1+ rpoly)
)
)
)
(command "_pedit" "_m" poly "" "_r" "" )
(princ (strcat "\nN. " (itoa rpoly) " Polylines reversed (clockwise)."))
(princ)
)
)
)
(defun verso_poly ( #1 / a_1 a_2 #1 )
(setq #1 (vlax-ename->vla-object #1))
(setq a_1 (vlax-curve-getArea #1))
(vla-offset #1 0.0001)
(setq a_2 (vlax-curve-getArea (entlast)))
(entdel (entlast))
(if (< a_1 a_2) t nil)
)
(vl-load-com)