(defun c:mad (/ spc acdoc Textheight CurrentTextstyle selectionset)
;;; Tharwat 06. Dec. 2011 ;;;
(vl-load-com)
(princ "\nSelect Lines for aligned dimensioning.")
(setq spc (if (> (vla-get-activespace (setq acdoc (vla-get-activedocument (vlax-get-acad-object)))) 0)
(vla-get-modelspace acdoc)
(vla-get-paperspace acdoc)
)
)
(setq Textheight
(if (eq (cdr (assoc 40 (setq CurrentTextstyle (entget (tblobjname "style" (getvar 'Textstyle)))))) 0.)
(cdr (assoc 42 CurrentTextstyle))
(cdr (assoc 40 CurrentTextstyle))
)
)
(if (setq selectionset (ssget '((0 . "LINE"))))
(progn (vla-StartUndoMark acdoc)
((lambda (intger / selectionsetname entgetlist dimension p1 p2)
(while (setq selectionsetname (ssname selectionset (setq intger (1+ intger))))
(setq entgetlist (entget selectionsetname))
(setq dimension (vla-adddimaligned
spc
(vlax-3d-point (setq p1 (cdr (assoc 10 entgetlist))))
(vlax-3d-point (setq p2 (cdr (assoc 11 entgetlist))))
(vlax-3d-point (polar p1 (+ (angle p1 p2) (/ pi 2.)) (+ (* Textheight 0.4) Textheight)))
)
)
(vla-put-textrotation dimension (angle p1 p2))
)
)
-1
)
(vla-EndUndoMark acdoc)
)
(princ "\n ")
)
(princ)
)
(c:mad)

Advertisements