;;;This LISP routine is designed to dimension Custom Top Units. ;;;Created by Paul Heller (defun c:dtu (/ ) (setvar "CMDECHO" 0) (setq Units (getint "\n[1] English (Default) [2] Metric: ")) (if (= Units 2) (progn (setq DimDistance 0.4) (setq TextOffset 0.2)) (progn (setq DimDistance 18) (setq TextOffset 6.1))) (setq TypicalDim (entsel "\nSelect Template Dimension: ")) (while (= 0 0) (princ "\nSelect left side: ") (command "_dimlinear" "" pause pause) (command "_matchprop" TypicalDim (entlast) "") ;Dim just created, now to move it to the correct position (setq NewDim (entget (ssname (ssget "l") 0))) ; get newly created dim (setq 10Position (assoc 10 NewDim)) (setq 11Position (assoc 11 NewDim)) (setq BasePosition (assoc 13 NewDim)) (setq WantedX (- (nth 1 BasePosition) DimDistance)) (setq New10Position (subst WantedX (nth 1 10Position) 10Position)) (setq New11Position (subst WantedX (nth 1 11Position) 11Position)) (setq NewDim (subst New10Position 10Position NewDim)) (setq NewDim (subst New11Position 11Position NewDim)) (entmod NewDim) (vl-load-com) (setq e (entlast)) (setq obj (vlax-ename->vla-object e)) (setq tp (vlax-get obj 'textposition)) (setq tp (mapcar '- tp (list TextOffset 0 0))) (vlax-put obj 'textposition tp) (princ "\nSelect right side: ") (command "_dimlinear" "" pause pause) (command "_matchprop" TypicalDim (entlast) "") ;Dim just created, now to move it to the correct position (setq NewDim (entget (ssname (ssget "l") 0))) ; get newly created dim (setq 10Position (assoc 10 NewDim)) (setq 11Position (assoc 11 NewDim)) (setq BasePosition (assoc 13 NewDim)) (setq WantedX (+ (nth 1 BasePosition) DimDistance)) (setq New10Position (subst WantedX (nth 1 10Position) 10Position)) (setq New11Position (subst WantedX (nth 1 11Position) 11Position)) (setq NewDim (subst New10Position 10Position NewDim)) (setq NewDim (subst New11Position 11Position NewDim)) (entmod NewDim) (vl-load-com) (setq e (entlast)) (setq obj (vlax-ename->vla-object e)) (setq tp (vlax-get obj 'textposition)) (setq tp (mapcar '+ tp (list TextOffset 0 0))) (vlax-put obj 'textposition tp) ) (setvar "CMDECHO" 1) )