我不是版主,不知道我能不能改- (defun c:z1 ()
- (prompt "此程序根据当前标注样式进行标注,设置textsize变量可修改与标注线的距离!")
- (setq dic (* 7 (getvar "dimscale")))
- (setq ss (ssget))
- (setq n 0)
- (repeat (sslength ss)
- (setq en (ssname ss n))
- (setq endata (entget en))
- (if (= (cdr (assoc 0 endata)) "LWPOLYLINE")
- (mmh_3 en)
- (if (= (cdr (assoc 0 endata)) "ARC")
- (mmh_1 en)
- (mmh_2 endata)
- )
- )
- (setq n (1+ n))
- )
- (princ)
- )
- (prompt "<<z1>>快速标注")
- (defun mmh_1 (en)
- (setvar "osmode" 0)
- (setq po_1 (vlax-curve-getstartPoint en))
- (setq po_2 (vlax-curve-getendPoint en))
- (setq po_1_x (car po_1))
- (setq po_1_y (cadr po_1))
- (setq po_2_x (car po_2))
- (setq po_2_y (cadr po_2))
- (command "dimaligned" po_1 po_2 po_1)
- (setvar "osmode" 16383)
- )
- (defun mmh_2 (endata)
- (setvar "osmode" 0)
- (setq p_1 (cdr (assoc 10 endata)))
- (setq p_2 (cdr (assoc 11 endata)))
- (setq p3 (polar p_1 (+ (angle p_1 p_2) (/ pi 2)) dic))
- (command "dimaligned" p_1 p_2 p3)
- (setvar "osmode" 16383)
- )
- (defun mmh_3 (en)
- (setq m 0)
- (command "explode" en "")
- (setq ssl (ssget "p"))
- (repeat (sslength ssl)
- (setq enl (ssname ssl m))
- (setq enldata (entget enl))
- (if (= (cdr (assoc 0 enldata)) "ARC")
- (mmh_1 enl)
- (mmh_2 enldata)
- )
- (setq m (1+ m))
- )
- (command "pedit" "m" ssl "" "y" "j" "" "")
- )
|