REVERSE_3DPOLY_COORDS_v1_00....................free

This function reverses 3D polyline coordinates leaving xyz values in not changed order fe:

(x1 y1 z1 x2 y2 z2 x3 y3 z3)  -->  (x3 y3 z3 x2 y2 z2 x1 y1 z1)

 

Code:

;;; =================================================
;;;        REVERSE_3DPOLY_COORDS_v1_00.LSP
;;;
;;;        Written by Andrzej Kalinowski
;;;        v1.00 - 20.10.2017
;;;
;;;        This function reverses 3D polyline coordinates leaving xyz values in not changed order fe.
;;;        (x1 y1 z1 x2 y2 z2 x3 y3 z3)  -->  (x3 y3 z3 x2 y2 z2 x1 y1 z1)
;;;
;;; =================================================
(defun REVERSE_3DPOLY_COORDS (primary_cords / rvrsd_cords )
    (setq rvrsd_cords (list) );setq
    (repeat (/ (length primary_cords) 3)
        (setq
            rvrsd_cords (cons (caddr primary_cords) rvrsd_cords)
            rvrsd_cords (cons (cadr primary_cords) rvrsd_cords)
            rvrsd_cords (cons (car primary_cords) rvrsd_cords)
            primary_cords (cdr (cdr (cdr primary_cords) ) )
        );setq
    );while

    rvrsd_cords
);defun




Download file: REVERSE_3DPOLY_COORDS_v1_00.LSP

No comments:

Post a Comment