Abrasive Posted February 22, 2023 Posted February 22, 2023 This routine was written by someone else, I don't remember and can't find who, if I could I would give them credit.... Could someone help me modify it? The routine works perfectly, but I would like to change the direction it draws the polyline? (defun c:l2r2inch ( / i e l n p q s ) (if (setq s (ssget '((0 . "LINE")))) (repeat (setq i (sslength s)) (setq e (entget (ssname s (setq i (1- i)))) p (cdr (assoc 10 e)) q (cdr (assoc 11 e)) n (mapcar '- p q) l (mapcar '(lambda ( x ) (mapcar '(lambda ( y ) (mapcar x (trans y 0 n) '(1 0 0)));;this 1 is offset 1inch (list p q) ) ) '(+ -) ) ) (entmake (append '( (000 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (090 . 4) (070 . 1) ) (mapcar '(lambda ( x ) (cons 10 (trans x n 0))) (append (car l) (reverse (cadr l)))) ) ) ) ) (princ) ) Thanks in advance! Quote
ronjonp Posted February 22, 2023 Posted February 22, 2023 (edited) Looks like Lee's formatting. YUP Change this: (append (car l) (reverse (cadr l))) To this: (reverse (append (car l) (reverse (cadr l)))) Edited February 22, 2023 by ronjonp Found it 1 1 Quote
BIGAL Posted February 22, 2023 Posted February 22, 2023 So the 2 white lines are drawn in opposite directions, the red are the offset lines so how would you decide which way is always to right ? Looking a bit more is this only for vertical Lines ? We need more info a dwg that shows wrong side. Quote
Abrasive Posted February 22, 2023 Author Posted February 22, 2023 12 minutes ago, ronjonp said: Looks like Lee's formatting. YUP Change this: (append (car l) (reverse (cadr l))) To this: (reverse (append (car l) (reverse (cadr l)))) Yes it was from @Lee Mac ! Thanks for finding it. I'll make the changes and give it a try, Thanks Quote
Abrasive Posted February 22, 2023 Author Posted February 22, 2023 20 minutes ago, ronjonp said: Looks like Lee's formatting. YUP Change this: (append (car l) (reverse (cadr l))) To this: (reverse (append (car l) (reverse (cadr l)))) That worked. Thanks again. 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.