been spending too much time taggin pipes and looked for a lisp.
I found this one, but it is funcky and I messed it up some how.
I need help making it work. Thanlks in advace
;; tag.lsp
;; Function will display layer information
;; at midpoint of every line selected.
(defun c:Tag (/ *error* mk_txt
DOC ENT I IPT LANG OFAC P SPC SS TOBJ TSZE UFLAG)
(vl-load-com)
(setq uFac 1.5) ;; top Offset Factor
(setq oFac -1.5) ;; bottom Offset Factor
(setq tSze nil) ;; Text Size ~ nil for TEXTSIZE Variable
(defun *error* (msg)
(and uFlag (vla-EndUndoMark doc))
(or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
(princ (strcat "\n** Error: " msg " **")))
(princ))
(defun mk_txt (p v) (vla-addText spc v (vlax-3D-point p) tSze))
(setq doc (vla-get-ActiveDocument
(vlax-get-Acad-Object))
spc (if (zerop (vla-get-activespace doc))
(if (= (vla-get-mspace doc) :vlax-true)
(vla-get-modelspace doc)
(vla-get-paperspace doc))
(vla-get-modelspace doc)))
(or tSze (setq tSze 8))
(if (setq i -1 ss (ssget '((0 . "*LINE,ARC,CIRCLE,ELLIPSE"))))
(progn
(setq uFlag (not (vla-StartUndoMark doc)))
(while (setq ent (ssname ss (setq i (1+ i))))
(setq iPt (vlax-curve-getPointatDist ent
(/ (- (vlax-curve-getDistatParam ent
(vlax-curve-getEndParam ent))
(vlax-curve-getDistatParam ent
(vlax-curve-getStartParam ent))) 2.)))
(setq lAng (angle '(0 0 0) (vlax-curve-getFirstDeriv ent
(vlax-curve-getParamatPoint ent iPt))))
(if (equal lAng (/ pi 2.) 0.001) (setq lAng (/ pi 2.)))
(if (equal lAng (/ (* 3 pi) 2.) 0.001) (setq lAng (/ (* 3 pi) 2.)))
(cond ( (and (> lAng (/ pi 2)) (<= lAng pi)) (setq lAng (- lAng pi)))
( (and (> lAng pi) (<= lAng (/ (* 3 pi) 2))) (setq lAng (+ lAng pi))))
(setq bObj (mk_txt (setq p (polar iPt (+ lAng (/ pi 2.)) (* oFac tSze)))
(vla-get-length (vlax-ename->vla-object ent))))
(setq tObj (mk_txt (setq p (polar iPt (+ lAng (/ pi 2.)) (* uFac tSze)))
1.25)))
(vla-put-Alignment bObj acAlignmentCenter)
(vla-put-TextAlignmentPoint bObj (vlax-3D-point p))
(vla-put-Rotation bObj lAng))
(setq uFlag (vla-EndUndoMark doc))))
(princ))
Thanks in advance.
The text should be at mid point of a line, some time need to be moved.
The top is the diameter, if im prompt it prior to selecting, Great!
I could also due with pre determined size and have multiple Lisp for each size.
The bottom text is the line length In architectural units, but without the Feet and inch marks.
also center.
multiple selection would be prefered, and each mtext layered to F-Diameter and F-length.
Text Style should be standard.
Hope I gave you enough info.