本帖最后由 xiaolong1487 于 2016-5-7 19:02 编辑
爱de臂膀 发表于 2016-5-6 13:09
如果是矩形,就会出现。
是我太粗心了,随便写的,现在重新写了个!再试试- (defun c:ts (/ *error* en new_dist os p0)
- (defun *error* (msg)
- (princ mag)
- (setvar "cmdecho" 1)
- (setvar "osmode" os)
- (princ)
- )
- (setq os (getvar "osmode"))
- (mapcar 'setvar '("cmdecho" "osmode") '(0 0))
- (setq old_dist (if (setq new_dist (getreal (strcat "\n偏移距离[" (if old_dist (rtos old_dist 2 3) "0") "]")))
- new_dist
- (if old_dist old_dist (setq old_dist 0))
- )
- )
- (while (and (setq en (car (entsel))) (setq p0 (getpoint "\n偏移方向:")))
- (if (= old_dist 0)
- (command "copy" en "" p0 p0)
- (command "offset" old_dist en p0 "")
- )
- (vla-put-Layer (vlax-ename->vla-object (entlast)) (getvar "CLAYER"))
- )
- (setvar "cmdecho" 1)
- (setvar "osmode" os)
- (princ)
- )
|