offset\u dist变量已本地化,因此它不会记住您的最后一个条目:(/offset\u dist obj\u 2\u offset offset\u side)
下面是一个保存默认偏移距离的简单示例:
- (defun c:off (/ e off p)
- ;; Get saved offset from registry or default to 1
- (setq off (atof (cond ((getenv "MyOffsetProgram"))
- ("1")
- )
- )
- )
- (if (and ;; Prompt for distance, if nil use default
- (setq off (cond ((getdist (strcat "\nOffset distance <" (vl-princ-to-string off) ">: ")))
- (off)
- )
- )
- ;; Pick something to offset .. needs more error checking ( ie a block will bonk it )
- (setq e (entsel (strcat "\nPick object to offset: ")))
- ;; Pick a side to offset or use point in entsel
- (setq p (cond ((getpoint "\nSide to offset on: "))
- ((cadr e))
- )
- )
- )
- (progn ;; Offset object
- (command "_.offset" off (car e) p "")
- ;; Delete original (entdel won't **** the bed if the object is locked)
- (entdel (car e))
- ;; Write our default offset to registry
- (setenv "MyOffsetProgram" (vl-princ-to-string off))
- )
- )
- ;; SSHHHHH!!
- (princ)
- )
- (vl-load-com)
|