lihuixun 发表于 2005-10-2 08:46:00

lsp中子函数的调用

<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 请问lsp中怎么调用自定义的子函数</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 新学lsp,多多请教</P>

maomao2004 发表于 2005-10-2 10:27:00

<P>先定义主函数,然后调用子函数</P>
<P>(defun c:zhuahnshu()</P>
<P>(zihanshu))</P>
<P>(defun zihanshu()</P>
<P>(功能))</P>

yxp 发表于 2005-10-2 11:13:00

<P>加载后,在命令行也可以用括号加函数名来运行。</P>
<P>&nbsp;</P>

lihuixun 发表于 2005-10-2 12:37:00

    太简单了,谢谢

lihuixun 发表于 2005-10-26 11:23:00

<P>&nbsp;&nbsp;&nbsp; 如果需要带参数的子函数怎么加载比如<BR>(defun c:leng(/ xp1 xp2)</P>
<P>&nbsp; (setq xp1 (getpoint "\n起点:"))<BR>&nbsp; (setq xp2 (getpoint "\n终点:"))</P>
<P>??这里怎么调用子函数<BR>&nbsp; )</P>
<P>(defun long(/ xp1 xp2 l)</P>
<P>&nbsp; (setq&nbsp;l (distance xp1 xp2))</P>
<P>)</P>

lijiao 发表于 2005-10-26 12:00:00

(defun c:leng(/ xp1 xp2)
<P>&nbsp; (setq xp1 (getpoint "\n起点:"))<BR>&nbsp; (setq xp2 (getpoint "\n终点:"))</P>
<P>(long xp1 xp2)<BR>&nbsp; )</P>
<P>(defun long(xp1 xp2&nbsp;/ )</P>
<P>&nbsp; (setq&nbsp;l (distance xp1 xp2))</P>
<P>)</P>

vladimir 发表于 2020-12-15 14:27:14

非常不错的程序,谢谢楼主分享
页: [1]
查看完整版本: lsp中子函数的调用