求高手帮改改,偏移为当前图层
(defun c:11 (/ getds obj)(vl-load-com)
(setvar 'cmdecho 0)
(initget 2)
(setq getds (getdist "\n输入偏移距离<可直接量取>:"))
(if (ssget ":s" '((0 . "Arc,Circle,Ellipse,*Line")))
(vlax-for obj (vla-get-activeselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-offset obj getds)
(vla-offset obj (* getds -1))
)
(vlax-release-object obj)
)
(if (not (getpoint "\n按鼠标左键不删除源对象 <空格删除>"))
(command "_.ERASE" (ssget "p") "")
)
(princ)
)
(command "offset" "l" "c") (defun c:11 (/ getds obj)
(vl-load-com)
(setq lay (getvar "CLAYER"))
(setvar 'cmdecho 0)
(initget 2)
(setq getds (getdist "\n输入偏移距离<可直接量取>:"))
(if (ssget ":s" '((0 . "Arc,Circle,Ellipse,*Line")))
(progn
(vlax-for obj (vla-get-activeselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
(foreach x (list getds(* getds -1))
(vla-offset obj x )
(vla-put-layer (vlax-ename->vla-object (entlast)) lay)
)
)
)
(vlax-release-object obj)
)
(if (not (getpoint "\n按鼠标左键不删除源对象 <空格删除>"))
(command "_.ERASE" (ssget "p") "")
)
(princ)
)
借用二楼代码简单修改。
(defun c:11 (/ getds obj RetVal objarray x k)
(vl-load-com)
(setq lay (getvar "CLAYER"))
(setvar 'cmdecho 0)
(initget 2)
(setq getds (getdist "\n输入偏移距离<可直接量取>:"))
(if (ssget ":s" '((0 . "Arc,Circle,Ellipse,*Line")))
(progn
(vlax-for obj (vla-get-activeselectionset(vla-get-activedocument(vlax-get-acad-object)))
(foreach x (list getds (* getds -1))
(setq RetVal(vl-catch-all-apply 'vla-offset (list obj x )))
(if (vl-catch-all-error-p RetVal)
(princ (vl-catch-all-error-message RetVal))
(progn
(setq objarray (vlax-variant-value RetVal))
(foreach k (vlax-safearray->list objarray)
(vla-put-layer k lay)
)
)
)
)
)
)
(vlax-release-object obj)
)
(if (not (getpoint "\n按鼠标左键不删除源对象 <空格删除>"))
(command "_.ERASE" (ssget "p") "")
)
(princ)
) edata 发表于 2018-5-13 17:48
借用二楼代码简单修改。
:handshake 434939575 发表于 2018-5-13 09:22
:handshake Linhay 发表于 2018-5-15 18:56
(command "offset" "l" "c")
就这么简单:lol
页:
[1]