Mohamed_Essam_2000 Posted Saturday at 05:33 PM Posted Saturday at 05:33 PM (edited) I need a LISP to make a number of cuts of a particular length along the selected line. The first cut will be at the start point of the selected line, the second cut will be at the end point of the line, and the rest of the cuts will be distributed equally along the line. It will be better if the LISP allows multi-selection and entering the number & length of cut. The attached picture indicates the drawing required. Edited Sunday at 08:20 AM by Mohamed_Essam_2000 Quote
Steven P Posted Saturday at 07:06 PM Posted Saturday at 07:06 PM You could look at chainage LISPs to put a circle at the correct interval, and use these to trim the line? Quote
fuccaro Posted yesterday at 06:30 AM Posted yesterday at 06:30 AM (defun c:pp() (setq lines (ssget '((0 . "LINE"))) n (sslength lines)) (setq gaps (getint "how many gaps? ") gap (getdist "\ngap length? ")) (repeat n (setq line1 (ssname lines (setq n (1- n))) l1 (entget line1) pa (cdr (assoc 10 l1)) pb (cdr (assoc 11 l1)) lay (assoc 8 l1) len (distance pa pb) len1 (/ (- len (* gaps gap)) (1- gaps)) pd pb ) (repeat (1- gaps) (setq pc (mapcar '(lambda (b a c) (+ c (* (- b a) (/ gap len)))) pa pb pd)) (setq pd (mapcar '(lambda (b a c) (+ c (* (- b a) (/ len1 len)))) pa pb pc)) (entmake (list (cons 0 "LINE") (cons 10 pc) (cons 11 pd) lay)) ) (entdel line1) ) (setq lines nil) ) @Mohamed_Essam_2000 Please post your question *only* in the public area of the Forum. Are you sure you don't wish to learn coding? 1 Quote
fuccaro Posted yesterday at 06:53 AM Posted yesterday at 06:53 AM Some fun with colors (defun c:ii() (setq lines (ssget '((0 . "LINE"))) n (sslength lines)) (setq gaps (getint "how many gaps? ") gap (getdist "\ngap length? ")) (repeat n (setq line1 (ssname lines (setq n (1- n))) l1 (entget line1) pa (cdr (assoc 10 l1)) pb (cdr (assoc 11 l1)) lay (assoc 8 l1) len (distance pa pb) len1 (/ (- len (* gaps gap)) (1- gaps)) pd pb cl 0 ) (repeat (1- gaps) (setq pc (mapcar '(lambda (b a c) (+ c (* (- b a) (/ gap len)))) pa pb pd)) (setq pd (mapcar '(lambda (b a c) (+ c (* (- b a) (/ len1 len)))) pa pb pc)) (entmake (list (cons 0 "LINE") (cons 10 pc) (cons 11 pd) lay (cons 62 (setq cl (rem (1+ cl) 10))))) ) (entdel line1) ) ) 1 Quote
Mohamed_Essam_2000 Posted 19 hours ago Author Posted 19 hours ago (edited) Very nice. Thank you, bro. But I need all the lines yellow colored. Edited 19 hours ago by Mohamed_Essam_2000 Quote
BIGAL Posted 11 hours ago Posted 11 hours ago (edited) Your home work and good time to start learning look into DXF code 62 which is color, and a hint yellow is 2. Look at what 1+ is doing also. Just use Google "dxf code 62 color Autocad" (cons 62 (setq cl (rem (1+ cl) 10))) Look at entmake examples here they should give you the answer. Edited 11 hours ago by BIGAL 1 Quote
Mohamed_Essam_2000 Posted 11 hours ago Author Posted 11 hours ago 7 minutes ago, BIGAL said: Your home work and good time to start learning look into DXF code 62 which is color, and a hint yellow is 2. Look at what 1+ is doing also. Just use Google "dxf code 62 color Autocad" (cons 62 (setq cl (rem (1+ cl) 10))) Look at entmake examples here they should give you the answer. Ok, I will try to do it. 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.