发布于:2012-11-13 10:52:13
来自:建筑设计/CAD下载及教程
[复制转发]
偶得一个高手编写的双向偏移的lisp文件,可以指定偏移的图层,对基于轴线画梁非常有用。美中不足的是要求输入图层名。
再请大家帮忙看看如何改成可以直接点选对象图层的,或者改成默认为当前图层,省去设置图层这个步骤。
(defun ptlay (x y) (vla-put-layer(car(vlax-safearray->list(vlax-variant-value x)))y))
(defun c:rr (/ getds obj lynm)
(vl-load-com)
(setq lynm (getstring "\n输入想要偏移的层名:"))
(and (= "" lynm) (setq lynm (getvar "clayer")))
(if (null (tblsearch "layer" lynm))
(vl-cmdf ".layer" "n" lynm "")
)
(initget 2)
(setq getds (getdist (strcat "\n输入偏移距离<"(rtos(getvar "OFFSETDIST"))">:")))
(or getds (setq getds (getvar "OFFSETDIST")))
(setvar "OFFSETDIST" getds)
(if (ssget '((0 . "Arc,Circle,Ellipse,*Line")))
(vlax-for obj (vla-get-activeselectionset
(vla-get-activedocument (vlax-get-acad-object))
)
(ptlay (vla-offset obj getds) lynm)
(ptlay (vla-offset obj (* getds -1)) lynm)
)
(vlax-release-object obj)
)
(princ)
)
[
本帖最后由 bingshuangboy 于 2012-11-13 10:53 编辑 ]
全部回复(1 )
只看楼主 我来说两句 抢板凳