- ;比例绘图
- (defun c:plcs()
- ;(if (= (getvar "useri5") 0) (setvar "useri5" 1))
- ;(if (setq blc (getreal (strcat "\n1:?<" (itoa (getvar "useri5")) ">")))
- ; (setvar "useri5" blc)
- ; (setq blc (getvar "useri5"))
- ;)
- ;(setq bl (/ blc 1000.0))
- (if (and (princ "\n选择尺寸 :") (setq s1 (ssget ":S" '((0 . "DIMENSION"))))) (progn
- (setq dimname (cdr(assoc 3 (entget(ssname s1 0)))))
- (setq bl (/ (cdr(assoc 144 (tblsearch "DIMSTYLE" dimname))) 1000))
- (setq olddim (getvar "DIMSTYLE"))
- (command "-DIMSTYLE" "R" dimname "GRAPHSCR")
- (initget "L C CO M O ")
- (setq bz (getkword "\n直线-L/圆-C/拷贝-CP/移动-M/偏移-O <L>:"))
- (cond
- ((= bz "C")
- (if (= (getvar "userr4") 0) (setvar "userr4" 1.0))
- (while (setq p1 (getpoint "\n圆心<回车结束>:"))
- (if (setq rr (getdist (strcat "\n半径<" (rtos (getvar "userr4")) ">:")))
- (setvar "userr4" rr)
- (setq rr (getvar "userr4"))
- )
- (command ".CIRCLE" p1 (/ rr bl))
- )
- )
- ((= bz "CO")
- (if (= (getvar "userr3") 0) (setvar "userr3" 1.0))
- (while (and (print "\n选择图元 :")
- (setq ss (ssget))
- (setq p1 (getpoint "\n起始点 :"))
- (setq ang (getangle p1 "\n方向 :")))
- (if (setq ll (getdist (strcat "\n距离<" (rtos (getvar "userr3")) ">:")))
- (setvar "userr3" ll)
- (setq ll (getvar "userr3"))
- )
- (command ".COPY" ss "" p1 (polar p1 ang (/ ll bl)))
- )
- )
- ((= bz "M")
- (if (= (getvar "userr2") 0) (setvar "userr2" 1.0))
- (while (and (print "\n选择图元 :")
- (setq ss (ssget))
- (setq p1 (getpoint "\n起始点 :"))
- (setq ang (getangle p1 "\n方向 :")))
- (if (setq ll (getdist (strcat "\n距离<" (rtos (getvar "userr2")) ">:")))
- (setvar "userr2" ll)
- (setq ll (getvar "userr2"))
- )
- (command ".MOVE" ss "" p1 (polar p1 ang (/ ll bl)))
- )
- )
- ((= bz "O")
- (if (= (getvar "userr1") 0) (setvar "userr1" 1.0))
- (if (setq ll (getdist (strcat "\n偏移距离<" (rtos (getvar "userr1")) ">:")))
- (setvar "userr1" ll)
- (setq ll (getvar "userr1"))
- )
- (command ".OFFSET" (/ ll bl))
- (while (> (getvar "CMDACTVE") 1) (command PAUSE))
- )
- (T
- (if (= (getvar "userr5") 0) (setvar "userr5" 1.0))
- (while (and (setq p1 (getpoint "\n起点<回车结束>:"))
- (setq ang (getangle p1 "\n止点所在方向:")))
- (if (setq ll (getdist (strcat "\n直线长度<" (rtos (getvar "userr5")) ">:")))
- (setvar "userr5" ll)
- (setq ll (getvar "userr5"))
- )
- (command ".LINE" p1 (polar p1 ang (/ ll bl)) "")
- )
- )
- )
- ))
- (if olddim (command "-DIMSTYLE" "R" olddim "GRAPHSCR"))
- (princ)
- )
|