On another forum a member by the name of "fixo" was nice enough to write this lisp for me but I just need a little help with it, if anyone can.
Basically this lisp takes the "z" elevation of a contour and places the value in a rectangle above the contour line. The only slight problem I had with it is, I would like to be able to increase the size of the rectangle around the text. If I use a different font, it gets close to the rectangle, which you can notice even more so when plotted.
I was wondering if someone can point out what numbers within the lisp I would have to change in order to increase the offset of this rectangle around the text. I am assuming it is towards the bottom where it says "text box".
The lisp is a nice one for labeling contours without having to break the contour lines, hopefully others can use it. Again if "fixo" reads this, I thank you again for your help.
Code:(defun alg-ang (obj pnt) (angle '(0. 0. 0.) (vlax-curve-getfirstderiv obj (vlax-curve-getparamatpoint obj pnt ) ) ) ) (defun C:LAB(/ ang angp box dv en ent p1 p2 p3 p4 pt txten txthgt txtpt wid zstr zvalue) (setvar "osmode" 512) (setq txthgt 3.2);<--text height (if (setq ent (entsel "\nSelect contour line >>")) (progn (setq en (car ent)) (while (setq pt (getpoint "\nPick a point on the contour (or press Enter to Exit) >> ")) (setq pt (vlax-curve-getclosestpointto en pt) zvalue (caddr pt) zstr (rtos zvalue 2 0) dv (vlax-curve-getfirstderiv en (vlax-curve-getparamatpoint en pt)) ang (alg-ang en pt) ang (cond ((< (/ pi 2) ang (* pi 1.5)) (+ pi ang)) (T ang) ) angp (+ (/ pi 2) ang) txtpt (polar pt angp 0.2) ) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 67 (if (= 0 (getvar "tilemode")) 1 0)) (cons 410 (getvar "ctab")) '(8 . "C-TOPO-TEXT");<-- layer for texts '(100 . "AcDbText") (cons 10 txtpt) (cons 11 txtpt) (cons 40 txthgt) (cons 1 zstr) (cons 50 ang) '(41 . 1.0) '(51 . 0.0) '(7 . "Regular");<-- text style '(71 . 0) '(72 . 1) '(73 . 0) ) ) (setq txten (entlast) elist (entget txten) box (textbox (entget txten)) wid (abs (apply '- (mapcar 'car box))) p1 (polar pt (+ ang pi) (+ (/ wid 2) 0.2)) p2 (polar pt ang (+ (/ wid 2) 0.2)) p4 (polar p1 angp (+ txthgt 0.4)) p3 (polar p2 angp (+ txthgt 0.4)) ) (entmake (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 8 "C-TOPO-TEXT") '(100 . "AcDbPolyline") (cons 90 4) (cons 70 1) (cons 43 0.0) ) (mapcar '(lambda (x) (cons 10 x)) (list p1 p2 p3 p4)) ) ) ) ) ) (princ) ) (vl-load-com) (princ "\n\t\t***Start command with LAB ... ***") (prin1) (vl-load-com)Sorry for the *edit*, but code reads much better when the "Code" button is used.
For further details please refer to "Reading and Posting Messages" on the FAQs Page.