- 积分
- 14013
- 明经币
- 个
- 注册时间
- 2013-9-7
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
本帖最后由 荒野孤行 于 2015-6-23 19:28 编辑
渐进式多重偏移,图片效果如下:
附上源码:
;;; *****多重偏移 程序开始*****
(defun c:dcpy ()
(setvar "pickadd" 1)
(setvar "osmode" 15359)
(setvar "cmdecho" 0)
(princ "\n制作者QQ:583915572")
(princ "\n★功能:多重偏移曲线.")
(command "undo" "be")
(princ "\n选取曲线对象:")
(setq ss (ssget '((0 . "LINE,ARC,CIRCLE,ELLIPSE,LWPOLYLINE,SPLINE"))))
(if (not ss)
(progn (princ "\n提示:未选取曲线对象.\n") (exit))
)
(setq pydi (getdist "\n偏移距离<0.2>:"))
(if (null pydi)
(setq pydi 0.2)
)
(setq pydi_add (getdist "偏移距离增量<0>:"))
(if (null pydi_add)
(setq pydi_add 0)
)
(setq npy (getint "\n偏移次数<9>:"))
(if (null npy)
(setq npy 9)
)
(initget 1)
(setq pt1 (getpoint "\n指定偏移方向:"))
(setq i 0)
(setvar "osmode" 0)
(vl-load-com)
(repeat (sslength ss)
(setq entnam (ssname ss i))
(setq obj (vlax-ename->vla-object entnam))
(setq len (vlax-curve-getdistatparam
obj
(vlax-curve-getendparam obj)
)
)
(setq pt_center (vlax-curve-getpointatdist obj (/ len 2)))
(setq entt (cons entnam (list pt_center)))
(setq j 1)
(setq pydis 0)
(repeat npy
(setq pydis (+ pydis pydi))
(command "_.offset" pydis entt pt1 "")
(repeat j (setq pydis (+ pydis pydi_add)))
(setq j (1+ j))
)
(setq i (1+ i))
(princ)
)
(setvar "osmode" 15359)
(command "undo" "e")
(princ)
)
;;;*****多重偏移 程序结束*****
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
"觉得好,就打赏"
共1人打赏
|