Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/25/2024 in all areas

  1. 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.
    1 point
  2. My try: (defun c:pp() (setq dia 2.0) (setq l1 (entget (car (entsel "line1 to keep"))) l2 (entget (car (entsel "\nline2 to keep"))) p1 (assoc 10 l1) p2 (assoc 11 l1) p3 (assoc 10 l2) p4 (assoc 11 l2) pc (if (or (equal p1 p3) (equal p1 p4)) (cdr p1) (cdr p2)) ) (setq del (ssget "X" (list '(0 . "LINE") (cons -4 "<OR") (cons 10 pc) (cons 11 pc) (cons -4 "OR>")))) (repeat (setq n (sslength del)) (entdel (ssname del (setq n (1- n)))) ) (setq l1 (entmake (if (equal pc (cdr p1)) (subst (cons 10 (polar pc (angle pc (cdr (assoc 11 l1))) (/ dia 2.0))) (assoc 10 l1) l1) (subst (cons 11 (polar pc (angle pc (cdr (assoc 10 l1))) (/ dia 2.0))) (assoc 11 l1) l1) )) l2 (entmake (if (equal pc (cdr p3)) (subst (cons 10 (polar pc (angle pc (cdr (assoc 11 l2))) (/ dia 2.0))) (assoc 10 l2) l2) (subst (cons 11 (polar pc (angle pc (cdr (assoc 10 l2))) (/ dia 2.0))) (assoc 11 l2) l2) ))) (setq a1 (angle pc (cdr (assoc 10 l1))) a2 (angle pc (cdr (assoc 10 l2))) d (/ dia 2.0)) (entmake (list '(0 . "ARC") (cons 10 pc) (cons 40 d) (cons 50 a1) (cons 51 a2))) (entmake (list '(0 . "ARC") (cons 10 pc) (cons 40 d) (cons 50 a2) (cons 51 a1))) (entdel (car (entsel "\nArc to delete?"))) (setq del nil) )
    1 point
  3. 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 point
  4. (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 point
  5. OK. Attached is updated AMT2L lisp. This handles 4 of the 5 leaders in your drawing. The exception is a leader with an attachment point set to 1 where the others are set to 4. This can be compensated by setting the fuzz to 3, but the leader moves. It is possible to keep the leader as is and move the mtext. What would you like to do? assocMText2Leader2.lsp
    1 point
×
×
  • Create New...