【已经解决】系绘制图形时系统捕捉未关闭导致
本帖最后由 kele99kele 于 2015-7-20 14:59 编辑先上源码:
[*](defun c:tt (/ p1 pl1 pl2 pl3 pl4 pl5 pl6 pl7 n_num p_end p_end1 p_start p_start1 n_s_lenth n_s_high n_lenth n_high n_thick n_tlb n_tlh n_count)
[*](setq n_lenth (float (getint "\n楼梯跨度")))
[*](setq n_high (float (getint "\n楼梯高度")))
[*](setq n_num (float (getint "\n楼梯踏步数")))
[*](setq n_thick (float (getint "\n楼梯梯板厚度")))
[*](setq n_tlb (float (getint "\n梯梁宽度")))
[*](setq n_tlh (float (getint "\n梯梁高度")))
[*](setq n_s_lenth(/ n_lenth n_num))
[*](setq n_s_high(/ n_high (+ n_num 1)))
[*](n_hualouti)
[*](prin1)
[*])
[*];;;;;;;;画楼梯
[*](defun n_hualouti ()
[*](setq p1 (getpoint "点取起始点:"))
[*](setq p_start p1)
[*](command "pline")
[*](command p1)
[*];;;;;;重复多次
[*](setq n_count n_num)
[*](while (>= n_count 1)
[*] (setq n_count (1- n_count))
[*] (n_huatabu)
[*])
[*];;“start”、“end”为踏步起始坐标和终止坐标
[*];;“start1”、“end1”为踏步板下口的起始坐标和终止坐标
[*](setq p_start1 (polar p_start (* pi 1.5) (/ n_thick (cos (angle p_start p_end)))))
[*](setq p_end1 (polar p_end (* pi 1.5) (/ n_thick (cos (angle p_start p_end)))))
[*];;;;算下梯梁点
[*](setq pl1 (polar p_start pi n_tlb))
[*](setq pl2 (polar pl1 (* pi 1.5) n_tlh))
[*](setq pl3 (polar pl2 0 n_tlb))
[*];;;;算上梯梁点
[*](setq pl4 (polar p_end (* pi 0.5) n_s_high))
[*](setq pl5 (polar pl4 0 n_tlb))
[*](setq pl6 (polar pl5 (* pi 1.5) n_tlh))
[*](setq pl7 (polar pl6 pi n_tlb))
[*];;;;画梯梁点
[*](command pl4 pl5 pl6 pl7 p_end1 p_start1 pl3 pl2 pl1 "c")
[*])
[*];画出一个踏步
[*](defun n_huatabu ()
[*](setq p1 (polar p1 (* pi 0.5) n_s_high));p2点坐标y上移踏步高
[*](command p1);踏步竖线
[*](setq p1 (polar p1 0 n_s_lenth));p2点坐标x右移踏步长
[*](command p1);踏步横线
[*](setq p_end p1)
[*])
提问:源程序首次运行没问题,一切正常,如图:
首次运行后的运行就多次出错,检查不出来问题出在哪里,求大神帮忙,估计问题是出在变量清空的问题上,同事循环也有可能有问题。问题如图:
靠啊靠!!!我终于知道问题出在哪里了,出在对象捕捉上!!!,关闭对象捕捉,一切ok!! j加上对象捕捉自动关闭的代码,等会重新上源码 可能捕捉影响,关闭捕捉。
所以我一般不用command,卡还问题多 水平有限,cad命令比较熟,vl之类的还在学习 发一个我自己用的简单的子程序吧
(defun drline(pt1 pt2 layer);;;;;线绘制
(if (> (distance pt1 pt2) 0)
(entmake (list (cons 0 "line")(cons 8 layer)(cons 10 pt1)(cons 11 pt2))))
) 果然高大上,用entmake来创建图元,vl知识很欠缺,需要学习 (defun DrawLine (p1 p2) (command "line" "non" p1 "non" p2 "")) xyp1964 发表于 2015-7-20 13:27 static/image/common/back.gif
(defun DrawLine (p1 p2) (command "line" "non" p1 "non" p2 ""))
同样高大上,我的c就更不行了,函数都认不全。
各个都是高手啊,让我脑洞大开!感谢
页:
[1]