0 Members and 1 Guest are viewing this topic.
Hi teachers. I need help.How to write two standard texts (TEXT1 TEXT2) above multiple lines, observing the direction of these lines?Thanks in advance.
(defun C:TAL(/ ang bounds elist ent endpt txtgap txtheight1 txtheight2 linelayer startpt selset temppt txtstyle1 txtstyle2 txtpoint1 txtpoint2 txtstring1 txtstring2 txtlayer1 txtlayer2 txtlength) (setq txtheight1 25.;<-- big text height txtheight2 15.;<-- small text height txtgap (/ txtheight2 2.);<-- gap between line and text txtstring1 "TEXT1";<-- big text string txtstring2 "TEXT2";<-- small text string linelayer "SCO-___-VIG";<-- lines layer txtlayer1 "SCO-___-PIL-___-IDE";<-- big text layer txtlayer2 "SCO-___-PIL-___-DIM";<-- small text layer txtstyle1 "R100";<--big text style txtstyle2 "R60";<-- small text style ) (if (setq selset (ssget (list (cons 0 "line") (cons 8 linelayer))) )(while (setq ent (ssname selset 0)) (setq elist (entget ent) startpt (cdr (assoc 10 elist)) endpt (cdr (assoc 11 elist)) ang (angle startpt endpt))(if (or (equal ang (* pi 1.5) 1e-08)(< (/ pi 2) ang (* pi 1.5))) (setq ang (+ ang pi)) ) ;;;swap points after the reverse angle (if (> (abs (- (angle startpt endpt) ang)) 1e-08) (progn (setq temppt startpt startpt endpt endpt temppt)) ) (setq txtpoint1 (polar startpt (+ ang (/ pi 2)) txtgap) txtpoint2 (polar endpt (+ ang (/ pi 2)) txtgap)) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 8 txtlayer1) '(100 . "AcDbText") (cons 10 txtpoint1) (cons 40 txtheight1) (cons 1 txtstring1) (cons 50 ang) (cons 41 1.) (cons 51 0.) (cons 7 txtstyle1) (cons 71 0) (cons 72 0) (cons 11 (list 0. 0. 0.)) '(100 . "AcDbText") (cons 73 0)))(setq bounds (textbox (list (cons 1 txtstring2)(cons 40 txtheight2))) ) (setq txtlength (abs (apply '- (mapcar 'car bounds))) ) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 8 txtlayer2) '(100 . "AcDbText") (cons 10 (polar txtpoint2 (+ ang pi) txtlength));<-- calc right alignment point (cons 40 txtheight2) (cons 1 txtstring2) (cons 50 ang) (cons 41 1.) (cons 51 0.) (cons 7 txtstyle2) (cons 71 0) (cons 72 2) (cons 11 txtpoint2) '(100 . "AcDbText") (cons 73 0)))(ssdel ent selset) ))(princ))(princ "\n\t\t***\tStart command with TAL to execute\t***")(prin1)