Polyline clockwise

0
39
Tom, thanks for your help.
I have a lisp routine that calculates a table of technical data:
azimuth and distance. Calculate these data depending on the
direction of the polyline, it can be clockwise or
counterclockwise,
I always try to do it clockwise. For which I need to add to the
main lisp a lisp that can work as a function and convert the
polylines counterclockwise to clockwise.

This is the lisp I have:

;********************************************************************
(DEFUN massoc (key EntData / x nlist)
(FOREACH x EntData
(IF (EQ key (CAR x))
(SETQ nlist (CONS (CDR x) nlist))
) ;_ end of if
) ;_ end of foreach
(REVERSE nlist)
)

;********************************************************************
(DEFUN c:TDL (/ ent vertices-lista poly poly-data nv aa pp hn
rotu
vv vi cont conj aa pp ent
MSC MSC1 MSC2 HT FSC2 FSC3 FSC4
XD tp PO cont cont1 X Y X1
Y1 P1 P2 ang-rad ang-dec dist
punto control control1 w ww
)
(graphscr)
(setvar “cmdecho” 0)
(setvar “dimzin” 1)
(setq osm (getvar “osmode”))
(setvar “osmode” 9)
(setq angbase (getvar “angbase”))
(setvar “angbase” (* pi 0.5))
(setq angdir (getvar “angdir”))
(setvar “angdir” 1)
(setvar “orthomode” 0)
(setvar “clayer” “0”) ;capa cero
(command “color” “bylayer”)
(command “OSNAP” “OFF” “”)
;*********************************************************************
(command “layer” “N” “Lindero” “c” “5” “Lindero” “”)
(setq poly (car (entsel “nSeleccione la Polilinea 2D: “)))
(command “area” “o” poly)
(setq aa (getvar “area”))
(setq pp (getvar “perimeter”))
(setq poly-data (entget poly))
(setq vertices-lista (massoc 10 poly-data))
;**********************************************************************
(setq nv (length vertices-lista))
(setq control (length vertices-lista))
(setq control (- control 1))
;**********************************************************************
(if (= esc nil)
(setq esc 1000)
)
(setq hn (rtos esc 2 0))
(setq rotu (strcat “Escala 1:” hn ” “))
(setq hn (getreal rotu))
(if (/= hn nil)
(setq ESC hn)
)
;**********************************************************************
(setq MSC (/ 1000 ESC))
(setq MSC1 (/ ESC 1000))
(setq MSC2 (/ 1000 ESC))
(setq HT (/ 2.0 MSC))
(setq FSC2 (* 20.0 MSC1))
(setq FSC3 (* 50.0 MSC1))

Read More

LEAVE A REPLY