jan_ek Posted March 19, 2018 Posted March 19, 2018 Hello Hello i have simple question. How to calculate values shown in the attachment (polyline) using LISP? Quote
marko_ribar Posted March 19, 2018 Posted March 19, 2018 You mean for second example : 100;90;300;45;424;-45;300;-90;100 Quote
Lee Mac Posted March 19, 2018 Posted March 19, 2018 A quick example: (defun bearings ( ent / enx lst ) (setq enx (entget ent) lst (mapcar 'cdr (vl-remove-if-not '(lambda ( x ) (= 10 (car x))) enx)) ) (if (= 1 (logand 1 (cdr (assoc 70 enx)))) (setq lst (append lst (list (car lst)))) ) (if (cdr lst) (cons (distance (car lst) (cadr lst)) (apply 'append (mapcar (function (lambda ( a b c ) (list (* 180.0 (/ (- (rem (+ pi pi (- (angle b a) (angle b c))) (+ pi pi)) pi) pi)) (distance b c)) ) ) lst (cdr lst) (cddr lst) ) ) ) ) ) To test: (defun c:test ( / sel ) (if (setq sel (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "<NOT") (-4 . "<>") (42 . 0.0) (-4 . "NOT>")))) (print (bearings (ssname sel 0))) ) (princ) ) Quote
jan_ek Posted March 28, 2018 Author Posted March 28, 2018 Wow, thank you for the quick reply Lee Mac. It works great Quote
jan_ek Posted April 23, 2018 Author Posted April 23, 2018 Hello Lee Could you change your code to give the result as below? Quote
BIGAL Posted April 24, 2018 Posted April 24, 2018 Have a look at lee-mac pline info lisp and this I just posted http://www.cadtutor.net/forum/showthread.php?104086-polyline-and-fillet-lisp It may be better to use what I did and elaborate in a big way. Its bordering a bit on a commercial answer do you want the dims as well ? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.