Author Topic: Help to modify a lisp  (Read 1086 times)

0 Members and 1 Guest are viewing this topic.

Josecr

  • Guest
Help to modify a lisp
« on: May 11, 2017, 04:12:59 PM »
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)

ribarm

  • Gator
  • Posts: 3268
  • Marko Ribar, architect
Re: Help to modify a lisp
« Reply #1 on: May 11, 2017, 05:05:23 PM »
If I understood correctly :
(ssget "_+.:E:S:L" '((0 . "LWPOLYLINE")))
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Josecr

  • Guest
Re: Help to modify a lisp
« Reply #2 on: May 11, 2017, 05:57:09 PM »
Good day.
Thanks for your help.
It is possible to change in the lisp "ssget" by "entsel" ?.

I need this change to add lisp to another lisp.

I thank you for the help you can give me