试试:- (defun c:gd (/ pt pt1 pt2 pt3 pt4 pt5 pt6 os ss1 ss2 ss3 ss4 ss5 ang ang1)
- (setq txt1 (ustr 1 "\n\t输入基准序号" txt1 nil)
- pt (getpoint "\n 输入基准符号放置点: ")
- ang (getangle pt "\n 输入第二点确定方向:")
- )
- (setq pt1 (list (- (car pt) 2.00) (+ (cadr pt) 1.46))
- pt2 (list (+ (car pt) 2.00) (+ (cadr pt) 1.46))
- pt3 (list (car pt) (+ (cadr pt) 1.46))
- pt4 (list (car pt) (+ (cadr pt) 4.46))
- pt5 (list (car pt) (+ (cadr pt) 6.96))
- pt6 (list (- (car pt) 0.288) (+ (cadr pt) 7.454))
- ang1 (* ang (/ 180 pi))
- )
- (command "_.undo" "be")
- (setq os (getvar "osmode"))
- (mkla "文字标注" 4)
- (setvar "osmode" 0)
- (command "pline" pt1 "w" "0.7" "0.7" pt2 "")
- (setq ss1 (ssget "l"))
- (command "line" pt3 pt4 "")
- (setq ss2 (ssget "l"))
- (command "circle" pt5 "2.5")
- (setq ss3 (ssget "l"))
- (command "text" "j" "mc" pt6 "3.5" "0" txt1)
- (setq ss4 (ssget "l"))
- (command "rotate" ss4 "" pt5 (- 360 ang1))
- (setq ss5 (ssget "l"))
- (command "rotate" ss1 ss2 ss3 ss5 "" pt ang1)
- (command "_.undo" "e")
- (setvar "osmode" os)
- (princ)
- )
- (defun ustr (bit msg def spflag / inp nval)
- (if (and def (/= def ""))
- (setq msg (strcat "\n" msg "<" def ">:")
- inp (getstring msg spflag)
- inp (if (= inp "")
- def
- inp
- )
- )
- (progn
- (setq msg (strcat "\n" msg ": "))
- (if (= bit 1)
- (while (= "" (setq inp (getstring msg spflag))))
- (setq inp (getstring msg spflag))
- )
- )
- )
- (if inp
- inp
- def
- )
- )
- (defun mkla (name color)
- (If (= (Tblsearch "layer" name) nil)
- (Command "layer" "m" name "c" color name "")
- (Command "layer" "t" name "s" name "c" color name "")
- )
- )
|