0 Members and 1 Guest are viewing this topic.
seems that Evgeniy is trying to spoil other people's friday night
(defun make-lwpolyline(l / e) ;;(make-lwpolyline lst) (setq e (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) '(410 . "Model") '(8 . "Kant") '(62 . 3) '(100 . "AcDbPolyline") (cons 90 (length l)) '(70 . 1) ) ;_ list (mapcar (function (lambda (a) (cons 10 a))) l) ) ;_ append ) ;_ entmakex ) ;_ setq (Princ (strcat "\n length lwpolyline " (rtos (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e)) 2 4) " mm." ) ;_ strcat ) ;_ Princ (Princ)) ;_ defun
(defun rjp-sortpt2pt (pt lst / tmp newlst) (defun dsort (pt lst / d1 d2) (vl-sort lst (function (lambda (d1 d2) (< (distance pt d1) (distance pt d2))))) ) (setq tmp (dsort pt lst)) (repeat (length lst) (setq tmp (dsort (car tmp) tmp) newlst (cons (car tmp) newlst) tmp (vl-remove (car tmp) tmp) ) ) (reverse newlst))(make-lwpolyline (rjp-sortpt2pt (car lst-a) lst-a));;3908.169(make-lwpolyline (rjp-sortpt2pt (car lst-b) lst-b));;3206.567
(defun mkPoly (lst / rslt tmp lst ply) (setq rslt (list (car lst))) (while (setq lst (cdr lst)) (setq tmp (car rslt)) (setq rslt (cons (car (vl-sort lst (function (lambda (a b) (< (distance tmp a) (distance tmp b)))))) rslt))) (setq ply (entmakex (append (list (cons 0 "LWPOLYLINE") (cons 100 "AcDbEntity") (cons 100 "AcDbPolyline") (cons 90 (length rslt)) (cons 70 1)) (mapcar (function (lambda (x) (cons 10 x))) rslt)))) (princ (strcat "\nPolyline Length: " (rtos (vlax-curve-getDistatParam ply (vlax-curve-getEndParam ply)) 2 4) " mm.")) (princ))
lst-a Polyline Length: 968.1675 mm.lst-b Polyline Length: 1019.6264 mm.
Hello Ron.I liked your code!My code, much more long...
heres mine ... am I even close?