快速等分,等分点上插入的是块,如何解决呢
下面是论坛朋友贴出的一个对直线快速等分程序,但是用点等分的,我希望是用块替代,即在等分点上插入块,最好在直线端点上也插入块,哪位高手能帮忙修改一下吗?谢谢!(defun C:test ()
(prompt "批量选择等分....")
(setq ss (ssget)
Num (getint "多少等分?: ")
i0
)
(while (setq ee (ssname ss i))
(command "Divide" ee Num)
(setq i (1+ i))
)
)
本程序任何曲线均可等分
(defun loc:intervalMeasure (curve sections / len
i times point blockref
dist startpaendpa
)
(setq startpa (vlax-curve-getStartParam curve))
(setq endpa (vlax-curve-getEndParam curve))
(setq startpa (vlax-curve-getDistAtParam curve startpa))
(setq endpa (vlax-curve-getDistAtParam curve endpa))
(setq len(- endpa startpa)
i 0
dist 0
)
(setq interval (/ len sections))
(setq point2 (vlax-make-safearray vlax-vbDouble '(0 . 2)))
(while (< dist len)
(setq point (vlax-curve-getPointAtDist curve dist))
(vlax-safearray-fill point2 point)
(setq blockref (vla-insertblock
*ModelSpace* point2 "YourBlockName" 1.0 1.0 1.0 0.0)
)
(setq i (1+ i))
(setq dist (* interval i))
)
(setq point (vlax-curve-getEndPoint curve))
(vlax-safearray-fill point2 point)
(setq blockref (vla-insertblock
*ModelSpace* point2 "YourBlockName" 1.0 1.0 1.0 0.0)
)
) 可以插入块啊,输入B选项就行啊!g:/1.jpg
把命令函数行改成如下就行!
(command "divide" aa "b" "gc119" "n" 3)
“gc119”是你要插入的块的名称! 回复 zyhandw 的帖子
谢谢你回复,好像没用啊,能粘贴全代码出来吗 全代码还是你的那一段代码!
只不过就改了带有command的那一行
(defun C:test ()
(prompt "批量选择等分....")
(setq ss (ssget) Num (getint "多少等分?: ") i 0)
(while (setq ee (ssname ss i))
(command "divide" ee "b" "g:/gc119.dwg" "n" 3)
(setq i (1+ i))
)
)
全代码还是你的那一段代码!
只不过就改了带有command的那一行
(defun C:test ()
(prompt "批量选择等分....")
(setq ss (ssget) Num (getint "多少等分?: ") i 0)
(while (setq ee (ssname ss i))
(command "divide" ee "b" "gc119" "n" 3)
(setq i (1+ i))
)
)
不过我没改进,在端点上插入块,我只是提示divide本身就有这个功能!
你可以参考yarp的等分程序,再加上插入图块的代码就可以了! 我来测试下 学习学习~~~~ 本帖最后由 kwok 于 2012-5-4 13:07 编辑
收藏起来......
(defun C:test ()
(prompt "批量选择等分....")
(setq ss (ssget) Num (getint "多少等分?: ") i 0)
(while (setq ee (ssname ss i))
(command "divide" ee "b" "块名" "" Num)
(setq i (1+ i))
)
)
测试了一下,可以批量了.之前我是一个一个选的.
做的块最好指定好基点.
页:
[1]
2