偏移到当前层,怎么才能偏移0求插件源码
偏移并将新对象改变到当前层 (defun c:of (/ of1 of2 va1 en2 pt1) (princ) (setvar "cmdecho" 0)(command "undo" "be") (princ "偏移并将新对象改变到当前层") (setq cm (princ (strcat "\n" (getvar "clayer")))) ;确定偏移距离 (setq of1 (getvar "offsetdist")) (setq of2 (strcat "\n偏移距离 <"(rtos of1 2)">: ")) (setq va1 (getstring of2)) ; (setq en2 (entsel "\n选择偏移对象:")) (setq pt1 (getpoint "\n选择偏移方向:")) (while (/= pt1 nil) (command "offset" va1 en2 pt1 "") (setq dz (entlast)) (command "change" dz "" "P" "LA" cm "") (setq en2 (entsel "\nSelect object to offset:")) (setq pt1 (getpoint "\nSide to offset:")) ) (princ)(setvar "cmdecho" 1)(command "undo" "e")) xiaolong1487 发表于 2016-5-7 18:57是我太粗心了,随便写的,现在重新写了个!再试试
这个可以,带记忆,可连续,好用 用复制也可以 本帖最后由 xiaolong1487 于 2016-5-5 05:15 编辑
(defun c:ts (/ en obj)
(while (setq en (car (entsel)))
(setq obj (vlax-ename->vla-object en))
(vla-Offset obj 0)
(vla-put-Layer (vlax-ename->vla-object (entlast)) (getvar "CLAYER"))
)
) xiaolong1487 发表于 2016-5-5 05:03 static/image/common/back.gif
指令: (vla-Offset obj 0)
; 错误: 自动化错误。无效的引数 Distance (于 Offset method 中) 可能得用复制了!!!! yoyoho 发表于 2016-5-5 08:01 static/image/common/back.gif
指令: (vla-Offset obj 0)
; 错误: 自动化错误。无效的引数 Distance (于 Offset method 中)
我这边测试没有问题 复制可以!偏移不可以偏移距离为0吗? xiaolong1487 发表于 2016-5-5 05:03 static/image/common/back.gif
这个可以,可不可以,同样可以偏移别的距离啊。麻烦高手。 xiaolong1487 发表于 2016-5-5 20:50 static/image/common/back.gif
我这边测试没有问题
如果是矩形,就会出现。 本帖最后由 xiaolong1487 于 2016-5-7 19:02 编辑
爱de臂膀 发表于 2016-5-6 13:09 static/image/common/back.gif
如果是矩形,就会出现。
是我太粗心了,随便写的,现在重新写了个!再试试(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)
)
页:
[1]
2