Mohamed_Essam_2000 Posted December 17, 2024 Posted December 17, 2024 (edited) I want a Lisp to convert the selected line into two separated lines. The two separated lines are red colored, and their total length is less than the original line by 1mm (0.5mm from each side). It's better if the Lisp allows entering the length of the red line (10mm in the picture). The attached picture indicates the Lisp required. Edited December 17, 2024 by Mohamed_Essam_2000 Quote
Steven P Posted December 17, 2024 Posted December 17, 2024 For the red lines, how are they positioned? Anywhere along the rectangle long edge? Half way? Mid way between small rectangle and the other end or user defined? Are the red lines just coloured red or are they 'by-layer' on a separate red coloured layer? The LISP itself is quite easy when we know the parameters Quote
BIGAL Posted December 17, 2024 Posted December 17, 2024 Like @Steven P I have select near end and enter distance along, Enter=mid, so answer the questions then something can be done, please post a sample dwg not image so dim style can be set, same with red line correct layer. Quote
Mohamed_Essam_2000 Posted December 18, 2024 Author Posted December 18, 2024 (edited) 2 hours ago, BIGAL said: Like @Steven P I have select near end and enter distance along, Enter=mid, so answer the questions then something can be done, please post a sample dwg not image so dim style can be set, same with red line correct layer. It's the same idea of the Lisp that had been created before and it's shown in this URL But this time the small lines will be red instead of yellow, and they will be offset from ends by 0.5mm Edited December 18, 2024 by Mohamed_Essam_2000 Quote
Mohamed_Essam_2000 Posted December 18, 2024 Author Posted December 18, 2024 (edited) 8 hours ago, Steven P said: For the red lines, how are they positioned? Anywhere along the rectangle long edge? Half way? Mid way between small rectangle and the other end or user defined? Are the red lines just coloured red or are they 'by-layer' on a separate red coloured layer? The LISP itself is quite easy when we know the parameters The rectangle is just an example, this means the line may be positioned anywhere and at any angle. Simply, there will be a line to be selected. The Lisp will convert the line into two separated lines which are red colored and the distance between their outward ends is smaller by 1mm than the original line (0.5mm from each side). No by-layer, just red coloring. Edited December 18, 2024 by Mohamed_Essam_2000 Quote
BIGAL Posted December 18, 2024 Posted December 18, 2024 So you want lines drawn 90 off the base line ? Still asking question how to select start point ? Distance along or mid ? 1 Quote
fuccaro Posted December 18, 2024 Posted December 18, 2024 (defun c:pp() (setq dist (getdist "red line length? ")) ;(setq dist 10) (setq d1 0.5) (setq line (car (entsel)) lst (entget line) a8 (assoc 8 lst) p1 (cdr (assoc 10 lst)) p2 (cdr (assoc 11 lst)) ) (entmake (list (cons 0 "LINE") (cons 10 (polar p1 (angle p1 p2) d1)) (cons 11 (polar p1 (angle p1 p2) (+ d1 dist))) a8 '(62 . 2))) (entmake (list (cons 0 "LINE") (cons 10 (polar p2 (angle p2 p1) d1)) (cons 11 (polar p2 (angle p2 p1) (+ d1 dist))) a8 '(62 . 1))) (entdel line) ) 1 Quote
fuccaro Posted December 18, 2024 Posted December 18, 2024 @Mohamed_Essam_2000 I asked you previously HERE, and I ask you again now: please post your questions in the forum. My profile is not your gear stick to make me work faster for you. 1 Quote
Mohamed_Essam_2000 Posted December 18, 2024 Author Posted December 18, 2024 10 hours ago, fuccaro said: (defun c:pp() (setq dist (getdist "red line length? ")) ;(setq dist 10) (setq d1 0.5) (setq line (car (entsel)) lst (entget line) a8 (assoc 8 lst) p1 (cdr (assoc 10 lst)) p2 (cdr (assoc 11 lst)) ) (entmake (list (cons 0 "LINE") (cons 10 (polar p1 (angle p1 p2) d1)) (cons 11 (polar p1 (angle p1 p2) (+ d1 dist))) a8 '(62 . 2))) (entmake (list (cons 0 "LINE") (cons 10 (polar p2 (angle p2 p1) d1)) (cons 11 (polar p2 (angle p2 p1) (+ d1 dist))) a8 '(62 . 1))) (entdel line) ) Yes, that seems good. Thanks. Quote
Mohamed_Essam_2000 Posted December 18, 2024 Author Posted December 18, 2024 10 hours ago, fuccaro said: (defun c:pp() (setq dist (getdist "red line length? ")) ;(setq dist 10) (setq d1 0.5) (setq line (car (entsel)) lst (entget line) a8 (assoc 8 lst) p1 (cdr (assoc 10 lst)) p2 (cdr (assoc 11 lst)) ) (entmake (list (cons 0 "LINE") (cons 10 (polar p1 (angle p1 p2) d1)) (cons 11 (polar p1 (angle p1 p2) (+ d1 dist))) a8 '(62 . 2))) (entmake (list (cons 0 "LINE") (cons 10 (polar p2 (angle p2 p1) d1)) (cons 11 (polar p2 (angle p2 p1) (+ d1 dist))) a8 '(62 . 1))) (entdel line) ) How to enable multi-selection? Quote
fuccaro Posted December 20, 2024 Posted December 20, 2024 (defun c:zz() (setq dist (getdist "red lines length? ")) (setq lines (ssget '((0 . "LINE")))) (setq d1 0.5 red '(62 . 1)) (repeat (setq i (sslength lines)) (setq line (ssname lines (setq i (1- i))) lst (entget line) a8 (assoc 8 lst) p1 (cdr (assoc 10 lst)) p2 (cdr (assoc 11 lst)) ) (entmake (list (cons 0 "LINE") (cons 10 (polar p1 (angle p1 p2) d1)) (cons 11 (polar p1 (angle p1 p2) (+ d1 dist))) a8 red)) (entmake (list (cons 0 "LINE") (cons 10 (polar p2 (angle p2 p1) d1)) (cons 11 (polar p2 (angle p2 p1) (+ d1 dist))) a8)) (entdel line) ) ) Did you start to learn AutoLisp? 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.