;;;对齐标注转线性标注(Defun C:DDC (/ AcadObject AcadDocument mSpace DimSS L M DimGet DimEle DimLay Dimcon DimStyle pt10 pt13 pt14)(vl-load-com)(setvar "cmdecho" 0) (princ "\\n 选上对齐标注转换成线性标注!")(setq DimSS (ssget '((0 . "DIMENSION"))))
(Defun C:DDC (/ AcadObject AcadDocument mSpace DimSS L M DimGet DimEle DimLay Dimcon DimStyle pt10 pt13 pt14)
(vl-load-com)
(setvar "cmdecho" 0)
(princ " \\n 选上对齐标注转换成线性标注!")
(setq DimSS (ssget '((0 . "DIMENSION"))))
(if (= DimSS nil)
(progn
(princ " \\n 没有对齐标注被选上!")
(exit)))
(command "._UNDO" "BE")
(setq L (sslength DimSS))
(setq M 0)
(while (< M L)
(setq DimGet (ssname DimSS M))
(setq DimEle (entget DimGet))
;;;获取图层、颜色
(setq DimLay (cdr (assoc 8 DimEle)))
(setq pt10 (cdr (assoc 10 DimEle)))
(setq pt13 (cdr (assoc 13 DimEle)))
(setq pt14 (cdr (assoc 14 DimEle)))
(setq Dimcon (cdr (assoc 1 DimEle)))
(setq DimStyle (cdr (assoc 3 DimEle)))
(GnHdg_AddDimAlign pt13 pt14 pt10 Dimcon DimStyle)
(command "._CHANGE" (entlast) "" "P" "LA" DimLay "")
(command "._ERASE" DimGet "")
(Setq M (+ M 1)))
(command "._UNDO" "E")
(prin1))
;;;建立线性标注
(defun GnHdg_AddDimAlign (GnHdg_Pt1 GnHdg_Pt2 GnHdg_Pt3 GnHdg_DimCon GnHdg_DimStyle / Ent)
(if (setq ent (entmake (list '(0 . "DIMENSION")
'(100 . "AcDbEntity")
'(100 . "AcDbDimension")
(cons 10 GnHdg_Pt3)
'(11 0. 0. 0.)
'(70 . 32)
(cons 1 GnHdg_DimCon)
(cons 3 GnHdg_DimStyle)
'(100 . "AcDbAlignedDimension")
(cons 13 GnHdg_Pt1)
(cons 14 GnHdg_Pt2)
(cons 50 (angle GnHdg_Pt1 GnHdg_Pt2))
'(100 . "AcDbRotatedDimension"))))ent))