本帖最后由 ZZXXQQ 于 2016-9-8 21:53 编辑
ZZXXQQ 发表于 2016-9-3 23:32
自己查下变量,可能是变量中没数。
谢谢版主
有时贴代码长了发不动帖子。。- (DEFUN C:SS (/ E P PC K R N EP)
- (setvar "osmode" 0)
- (setq pt (getpoint "\n圆心点: "))
- (command "circle" pt pause)
- (command "chprop" (entlast) "" "lt" "center" "s" "1" "c" "6" "")
- (setq e (entlast)
- pc (cdr (assoc 10 (entget E)))
- xl (getstring"\n序列号:")
- P (getpoint "\n放置点: ")
- K (getreal "\n比例: ")
- r (cdr (assoc 40 (entget e)))
- )
- (command "copy" "cp")
- (setq n 0)
- (repeat 180
- (command (polar pc (/ (* 2 n pi) 180) r))
- (setq n (+ n 1))
- )
- (command "" "" pc p)
- (setq n 0)
- (setvar "pickbox" 5)
- (command "circle" p r)
- (setq ep (entlast))
- (command "trim" ep "")
- (repeat 180
- (command "f" (polar p (/ (* 2 n pi) 180) (* r 1.01)))
- (setq n (+ n 1))
- (command (polar p (/ (* 2 n pi) 180) (* r 1.01)) "")
- )
- (command "")
- (command "scale" "c" (list (- (car p) r) (- (cadr p) r))
- (list (+ (car p) r) (+ (cadr p)r)) "" p k)
- (setq ss (ssget "p" '((0 . "dimension"))))
- (command "erase" ep "")
- (if ss
- (progn
- (setq oldds (getvar "dimstyle"))
- (command "dimstyle" "restore" "" (ssname ss 0))
- (setq oldfac (getvar "dimlfac"))
- (SETVAR "dimlfac" (/ oldfac k))
- (command "dimstyle" "apply" ss "")
- (command "dimstyle" "r" oldds)))
- (setq bw (* pi 1.5))
- (setq p0 (polar p bw (*(* 1.2 r)k)))
- (setq knr (strcat "SCALE " (rtos factor 2 0) ":1"))
- (command "text" p0 (getvar "dimtxt") "0" xl)
- (command "text" (polar p0 (* pi 1.5) (* dz(+ (* (getvar "dimtxt") 0.8) (getvar "dimtxt")))) (getvar "dimtxt") "0" knr)
- (princ))
|