试了一下,好象没有问题
- (defun c:cb (/ pt01 pt02 pt03 pt04 en data ang olderr)
- (setvar "osmode" 7607)
- (vl-cmdf "layer" "make" "标注" "Color" 3 "" "")
- (setvar "cmdecho" 0)
-
- (command "_.undo" "_be")
- (initget 1)
- (setq pt01 (getpoint "\n 指定第一点:"))
- (command
- "_.dimlinear"
- pt01
- (progn (princ "\n指定下一点:") pause)
- (progn (setq pt03 (getpoint "\n指定尺寸线参考点<空格取消指定>:"))
- (princ "\n指定位置:")
- pause
- )
- )
- (while (= (logand (getvar "CmdActive") 1) 1)
- (command pause)
- )
- (setq en (entlast)
- data (entget en)
- )
- (if pt03
- (progn
- (setq pt04 (cdr (assoc 10 data)))
- (setq pt02 (cdr (assoc 14 data)))
- (setq ang (angle pt02 pt04))
- (setq pt03 (polar pt03 ang 5))
- (if (or (equal ang 0 0.001)
- (equal ang pi 0.001)
- (equal ang (* 2 pi) 0.001)
- )
- (setq pt04 (cons (car pt03) (cdr pt04)))
- (setq pt04 (list (car pt04) (cadr pt03) (last pt04)))
- )
- (setq data (subst (cons 10 pt04) (assoc 10 data) data))
- (entmod data)
- )
- )
-
- (command "_.undo" "_e")
- (setvar "cmdecho" 1)
- (princ)
- )
- (defun c:bc (/ pt01 pt02 pt03 pt04 en data ang olderr)
- (setvar "osmode" 7607)
- (vl-cmdf "layer" "make" "标注" "Color" 3 "" "")
- (setvar "cmdecho" 0)
-
- (command "_.undo" "_be")
- (initget 1)
- (setq pt01 (getpoint "\n指定第一点:"))
- (command
- "_.dimaligned"
- pt01
- (progn (princ "\n指定下一点:") pause)
- (progn (setq pt03 (getpoint "\n指定尺寸线参考点<空格取消指定>:"))
- (princ "\n指定位置:")
- pause
- )
- )
- (while (= (logand (getvar "CmdActive") 1) 1)
- (command pause)
- )
- (setq en (entlast)
- data (entget en)
- )
- (if pt03
- (progn
- (setq pt04 (cdr (assoc 10 data)))
- (setq pt02 (cdr (assoc 14 data)))
- (setq ang (angle pt02 pt04))
- (setq pt04 (polar pt03 ang 5))
- (setq data (subst (cons 10 pt04) (assoc 10 data) data))
- (entmod data)
- )
- )
-
- (command "_.undo" "_e")
- (setvar "cmdecho" 1)
- (princ)
- )
|