ssget函数选择语句的过滤条件问题
<P>最近我再编一个程序</P><P>其中需要选择图形中所有线型为DASHDOT的直线。</P>
<P>其中我选择了两种写法如下:</P>
<P>第一种:</P>
<P>(setq sv (ssget "X" '((0 . "line")(-4 . "=")(6 . "dashdot"))))</P>
<P>第二种</P>
<P>(setq sv (ssget "X" '((-4 . "<AND")(0 . "line")(6 . "dashdot")(-4 . "AND>"))))</P>
<P>但是两种写法在随后的</P>
<P>(setq lens (sslength sv))</P>
<P>中均出现了提示错误: 参数类型错误: lselsetp nil。</P>
<P>请问:</P>
<P>两种写法有错吗?错在哪里?正确的应该是什么?</P> (setq SV (ssget "X" '((0 . "line") (6 . "dashdot"))))<BR> <P>多谢二楼解答,用这个方法</P>
<P>(setq sv (ssget "X" '((0 . "line") (6 . "dashdot"))))<BR><BR> (setq lens (sslength sv))</P>
<P>运行到第二行还是有错误呀。</P> <P>那是图中没有"dashdot"的线,注意:bylayer线型为"dashdot"的不会被选上</P> <P>实在调试不出来了。超级版主辛苦一下下。看看是怎么回事?</P> <P>(setq sv (ssget "X" '((0 . "line") (6 . "DASHDOT"))))</P>
<P>try ===><BR>(setq sv (ssget "X" '((0 . "*line") (6 . "DASHDOT"))))<BR>or<BR>(setq sv (ssget "X" '((0 . "LwPolyLine") (6 . "DASHDOT"))))</P>
<P> </P> 本帖最后由 作者 于 2006-8-22 17:42:53 编辑 <br /><br /> <P>嗯,试过了,</P>
<P>try ===><BR>(setq sv (ssget "X" '((0 . "*line") (6 . "DASHDOT"))))<BR>or<BR>(setq sv (ssget "X" '((0 . "LwPolyLine") (6 . "DASHDOT"))))</P>
<P> 两个都可以找到SV。</P>
<P>可能原来定义的条件太苛刻了</P>
<P>多谢6楼</P> <P>不好意思,新问题出现了,上述程序中</P>
<P><FONT face="Courier New" color=#ff0000>(</FONT><A href="http://www.mjtd.com/object/autolisp/setq.htm" target="_blank" ><FONT face="Courier New" color=blue>setq</FONT></A><FONT face="Courier New"> ent<BR> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/subst.htm" target="_blank" ><FONT face="Courier New" color=blue>subst</FONT></A><BR><FONT face="Courier New"> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/cons.htm" target="_blank" ><FONT face="Courier New" color=blue>cons</FONT></A><FONT face="Courier New"> 6 <FONT color=#ff00ff>"center"</FONT><FONT color=red>)</FONT><BR> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/assoc.htm" target="_blank" ><FONT face="Courier New" color=blue>assoc</FONT></A><FONT face="Courier New"> 6 ent<FONT color=red>)</FONT><BR> ent<BR> <FONT color=red>)</FONT></FONT><FONT color=purple><FONT color=purple><SPAN style="BACKGROUND-COLOR: #c0c0c0"><FONT face="Courier New">;</FONT><A href="http://www.mjtd.com/object/autolisp/subst.htm" target="_blank" ><FONT face="Courier New" color=blue>subst</FONT></A><FONT face="Courier New"> end</FONT></FONT><BR></SPAN></FONT><FONT face="Courier New"> <FONT color=red>)</FONT></FONT><FONT color=purple><FONT color=purple><SPAN style="BACKGROUND-COLOR: #c0c0c0"><FONT face="Courier New">;</FONT><A href="http://www.mjtd.com/object/autolisp/setq.htm" target="_blank" ><FONT face="Courier New" color=blue>setq</FONT></A><FONT face="Courier New"> end 更改对象线型属性</FONT></FONT><BR></SPAN></FONT><FONT face="Courier New"> </FONT><FONT face="Courier New"><BR> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/setq.htm" target="_blank" ><FONT face="Courier New" color=blue>setq</FONT></A><FONT face="Courier New"> ent<BR> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/subst.htm" target="_blank" ><FONT face="Courier New" color=blue>subst</FONT></A><BR><FONT face="Courier New"> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/cons.htm" target="_blank" ><FONT face="Courier New" color=blue>cons</FONT></A><FONT face="Courier New"> 48 <FONT color=#ff00ff>"0.4"</FONT><FONT color=red>)</FONT><BR> <FONT color=red>(</FONT></FONT><A href="http://www.mjtd.com/object/autolisp/assoc.htm" target="_blank" ><FONT face="Courier New" color=blue>assoc</FONT></A><FONT face="Courier New"> 48 ent<FONT color=red>)</FONT><BR> ent<BR> <FONT color=red>)</FONT></FONT><FONT color=purple><FONT color=purple><SPAN style="BACKGROUND-COLOR: #c0c0c0"><FONT face="Courier New">;</FONT><A href="http://www.mjtd.com/object/autolisp/subst.htm" target="_blank" ><FONT face="Courier New" color=blue>subst</FONT></A><FONT face="Courier New"> end</FONT></FONT><BR></SPAN></FONT><FONT face="Courier New"> <FONT color=red>)</FONT></FONT><FONT color=purple><FONT color=purple><SPAN style="BACKGROUND-COLOR: #c0c0c0"><FONT face="Courier New">;</FONT><A href="http://www.mjtd.com/object/autolisp/setq.htm" target="_blank" ><FONT face="Courier New" color=blue>setq</FONT></A><FONT face="Courier New"> end 更改对象线型比例属性</FONT></FONT></SPAN></FONT></P>
<P>上述程序段第一部分是更改线型名称,成功实现,</P>
<P>第二部分是更改线型比例,却没有实现功能。我找了DXF的帮助里面线型比例的组码就是48。不知道是不是我理解的有问题?</P> ENT中没有的DXF码只能增加,不能替换 (defun c:temp ()<BR> (setq sv (ssget "X" '((0 . "*line") (6 . "<FONT face="Courier New" color=#ff00ff>DASHDOT</FONT>"))))<BR> (command "chprop" sv "" "lt" "center" "s" "0.4" "")<BR>)
页:
[1]
2