我是一个lisp的初学者,在实际操作中用了一些lisp,但都是我改别人的程序,自己也就编一些小程序。总觉得不过瘾。大家来交流一下lisp的作用,并且把好的想法交流一下。
我是一个lisp的初学者,在实际操作中用了一些lisp,但都是我改别人的程序,自己也就编一些小程序。总觉得不过瘾。大家来交流一下lisp的作用,并且把好的想法交流一下。
2楼
我前两年编的一个画墙线的小程序大家看看,提些意见
(defun zongqiang ( / point1 point2 point3 C10 C11 C20 C21 SEP i ANG ss x1)
(setq point1 (getpoint "请输入围墙第一点(先上后下):"))
(setq point2 (getpoint "\n 围墙第二点:"))
(setq point3 (getpoint "\n 偏移方向点:"))
(setq ANG 0.24)
(setq SEP 0)
(setq C10 point1)
(setq C11 point2)
(while (/= SEP 1)
(if (> (nth 0 c10) (nth 0 point3))
(setq C20 (list (-(nth 0 c10)ANG)(nth 1 c10)))
(setq C21 (list (+(nth 0 c11)ANG)(nth 1 c11)))
)
(if (< (nth 0 c10) (nth 0 point3))
(setq C20 (list (+(nth 0 c10)ANG)(nth 1 c10)))
(setq C21 (list (-(nth 0 c11)ANG)(nth 1 c11)))
)
(setq sEP 1)
)
(command "LINE" c10 c11 c21 c20"")
(setq i 0)
(setq ss 0.5)
(while (/= i 1)
(setq c10 (list (nth 0 c10)(-(nth 1 c10) ss)))
(setq c20 (list (nth 0 c20)(-(nth 1 c20) ss)))
(command "LINE" c10 c20 "")
(setq x1 (- (nth 1 c10) (nth 1 c11)))
(if (< x1 0.5)
(setq i 1)
)
(princ)
)
)
(defun zongqiang1 ( / point1 point2 point3 C10 C11 C20 C21 SEP i ANG ss x1)
(setq point1 (getpoint "请输入围墙的第一点(先左后右):"))
(setq point2 (getpoint "\n 第二点:"))
(setq point3 (getpoint "\n 偏移的方向:"))
(setq SEP 0)
(setq ANG 0.24)
(setq C10 point1)
(setq C11 point2)
(while (/= SEP 1)
(if (> (nth 1 c10) (nth 1 point3))
(setq C20 (list (nth 0 c10)(-(nth 1 c10)ANG)))
(setq C21 (list (nth 0 c11)(+(nth 1 c11)ANG)))
)
(if (< (nth 1 c10) (nth 1 point3))
(setq C20 (list (nth 0 c10)(+(nth 1 c10)ANG)))
(setq C21 (list (nth 0 c11)(-(nth 1 c11)ANG)))
)
(setq sep 1)
)
(command "LINE" c10 c11 c21 c20 "")
(setq i 0)
(setq ss 0.5)
(while (/= i 1)
(setq C10 (list (+(nth 0 C10)ss)(nth 1 C10 )))
(setq C20 (list (+(nth 0 C20)ss)(nth 1 C20 )))
(command "LINE" C10 C20 "")
(setq x1 (- (nth 0 c11) (nth 0 c10)))
(if (< x1 0.5)
(setq i 1)
)
(princ))
)
(defun C:zongqiangz ()
(setq TIPO (getstring "\n横墙或纵墙: "))
(setvar "osmode" 0)
(cond
((equal TIPO "")(zongqiang1))
((equal TIPO "z")(zongqiang))
)
)
回复
3楼
请你时刻关注飞龙一号的成长,我会将推出更多更好的LSP文件贡献给大家
回复
4楼
只会用COMMAND 还是不行啊,继续努力!!!
回复