;;对齐坐标标注
(defun c:aldor (/ obj pt ss)
  (defun mtdor (dim pt / d lp new tp)
    (setq d (entget dim))
    (cond
      ((vl-position '(100 . "AcDbOrdinateDimension") d)
       (setq lp (fsxm-getdxf 11 d))
       (setq tp (fsxm-getdxf 14 d))
       (setq obj (vlax-ename->vla-object dim))
       (cond
	 ((equal (car lp) (car tp) 1e-4) ;垂直
	  (setq new (- (cadr pt) (- (cadr tp) (cadr lp))))
	  (setq pt (vlax-3d-point (list (car lp) new (caddr lp))))
	  (vla-put-TextPosition obj pt)
	 )
	 ((equal (cadr lp) (cadr tp) 1e-4) ;水平
	  (setq new (- (car pt) (- (car tp) (car lp))))
	  (setq pt (vlax-3d-point (list new (cadr lp) (caddr lp))))
	  (vla-put-TextPosition obj pt)
	 )
       )
      )
    )
  )
  (cond	((and (setq pt (getpoint "选择对齐点："))
	      (setq ss (ssget '((0 . "DIMENSION"))))
	 )
	 (setq pt (trans pt 1 0))
	 (foreach dim (fsxm-ss->enlist ss)
	   (mtdor dim pt)
	 )
	)
  )
  (princ)
)