使用时选择对象
大家好,提前感谢大家查看。我终于忍住了,并试图为我所做工作中一些更重复的方面编写一些代码。问题是,我不得不对别人的脚本进行反向工程,以尝试完成我想要的,但我一直没能找到它。
李,我去过你的网站,没有找到我需要的东西,所以如果你有,太好了,如果没有,我会在我完成后给你这个。
以下是基本用途:墙板。我正在编写一个代码,要求用户选择一面墙(点对点),输入面板高度和面板高度AAF。该程序将接受这些输入,并用不超过48“W的相等数量的面板填充墙壁。
当我记下第一部分时,计划B是将多段线转换为块,查询分隔缝等。。。。但现在,我还在学习爬行。
我似乎不知道如何在绘制后选择多段线,以便在数组中使用它。我知道这必须是一个非常简单的解决方案,但我似乎无法解决它。进退两难的是,模型空间中没有设定点,因此用于选择的坐标必须基于第一个面板的初始起点。(这是第一次运行,所以我还没有为用户输入代码)
如果有人能帮我度过这一段时间,我将不胜感激。
代码如下:(rtos是我最后尝试玩的东西,但也无法让它工作。我用来测试第一部分的内容如下)
这就是我用来确保代码工作的地方,但它不可行,因为它依赖于设置的坐标。
(普林斯)
) 嗨,CaddJax,
我现在正在使用BricsCAD,但我认为这应该适合你。在数组中,使用“L”作为最后一个实体,而不是使用“W”。在你的代码中,我改变了这一点,在pp1和pp2行中去掉了几个额外的括号,在矩形命令中使用了(rtos PW)和(rtos ph),然后它为我运行。还有其他方法可以选择最后一个实体,但请尝试一下。
(defun C:DP ()
(setq WL (getreal "\nEnter Length of Wall: "))
(setq NP (fix (if
(> (/ WL 48 ) (fix (/ WL 48 )))
(+ (fix (/ WL 48 )) 1)
(/ WL 48 ))))
(setq PW (/ WL NP))
(setq ph (getreal "\nEnter Height of Panel: "))
(setq ps (getpoint "\Select Start Point of Panels: "))
(command "rectangle" ps "d" (rtos PW) (rtos ph) ps)
(setq pp1 (rtos (- (car ps) 1)))
(setq pp2 (rtos (- (cadr ps) 1)))
(setq pp1b (rtos (+ (car ps) PW 1)))
(setq pp2b (rtos (+ (cadr ps) PH 1)))
(command "-array" "L" 'pp1,pp2 'pp1b,pp2b "" "R" 1 NP PW)
(princ)
) 我的建议
<p>(setq WL (getreal "\nEnter Length of Wall: "))</p><p>: replace with</p><p>(setq pt1 (getpoint "\Pick Start of wall "))</p><p>(setq pt2 (getpoint "\Pick End of wall "))</p><p>(setq WL (distance pt1 pt2))</p><p> </p><p>;(setq ps (getpoint "\Select Start Point of Panels: ")) not required as you can use pt1</p><p>[\code]</p><p> </p><p>A couple more suggestions what happens when wall is on an angle ? Just me but the way I have done these is to also get the angle of the line generally I use repeat rather than array and use copy.</p><p> </p><p>Also you need a remainder panel, there is different ideas on this one only or two small one at start and one at end.</p>
页:
[1]