tyliling 发表于 2006-6-27 17:53:00

C++如何与LSP相连接

<P>各位如果我用C++功能给一个圆或一个图块加了一个扩展的标签后,怎样用LPS语言获得这个扩展的标签项目,是不是有什么函数可以直接取得,请各位大虾指教!!!</P>
<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 好急呀!为盼</P>

wzz1968 发表于 2006-6-28 11:28:00

<P>说清楚一点.</P>
<P>最好举个例子</P>
<P>&nbsp;</P>

haill2000 发表于 2006-6-28 15:44:00

<P>什么是标签项目,存储在哪?如果在dwg里,直接读不就行了</P>

tyliling 发表于 2006-6-28 22:52:00

<P>是直接写在图元上面的,在LSP中我可以用(entget (Car (entsel)))来获得图元的群码表,但是用C++写的好像就没办法获得了,不知是否可以用直接用什么函数获得了</P>

haill2000 发表于 2006-6-29 10:13:00

用ads_entget,和lsp的entget是对应的

wzz1968 发表于 2006-6-29 10:25:00

<P>下边代码是获得联标中的关联数据的,与(cdr (assoc dxf_code ent_list))对应.</P>
<P>/********************************************************************/<BR>int assoc_dxf_point(struct resbuf *rb,int dxf_code,ads_point result)<BR>&nbsp; {<BR>&nbsp;&nbsp; struct resbuf *rb1;<BR>&nbsp;&nbsp; if (dxf_type(dxf_code)!=RTPOINT) return RTERROR;<BR>&nbsp;&nbsp; if (rb==NULL) return RTERROR;<BR>&nbsp;&nbsp; for (rb1=rb;rb1!=NULL;rb1=rb1-&gt;rbnext) <BR>&nbsp;&nbsp;&nbsp; { if (rb1-&gt;restype==dxf_code)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp; result=rb1-&gt;resval.rpoint;<BR>&nbsp;&nbsp; result=rb1-&gt;resval.rpoint;<BR>&nbsp;&nbsp; result=rb1-&gt;resval.rpoint;<BR>&nbsp;&nbsp; return RTNORM;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; return RTERROR;<BR>&nbsp;}<BR>/********************************************************************/ <BR>&nbsp;int assoc_dxf_int(struct resbuf *rb,int dxf_code,short *result)<BR>&nbsp; {<BR>&nbsp;&nbsp; struct resbuf *rb1;<BR>&nbsp;&nbsp; if (dxf_type(dxf_code)!=RTSHORT) return RTERROR;<BR>&nbsp;&nbsp; if (rb==NULL) return RTERROR;<BR>&nbsp;&nbsp; for (rb1=rb;rb1!=NULL;rb1=rb1-&gt;rbnext) <BR>&nbsp;&nbsp;&nbsp; { if (rb1-&gt;restype==dxf_code)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp; *result=rb1-&gt;resval.rint;<BR>&nbsp;&nbsp; return RTNORM;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; return RTERROR;<BR>&nbsp;}<BR>/*************************************************************/<BR>&nbsp;int assoc_dxf_str(struct resbuf *rb,int dxf_code,char *result)<BR>&nbsp; {<BR>&nbsp;&nbsp; struct resbuf *rb1;<BR>&nbsp;&nbsp; if (dxf_type(dxf_code)!=RTSTR) return RTERROR;<BR>&nbsp;&nbsp; if (rb==NULL) return RTERROR;<BR>&nbsp;&nbsp; for (rb1=rb;rb1!=NULL;rb1=rb1-&gt;rbnext) <BR>&nbsp;&nbsp;&nbsp; { if (rb1-&gt;restype==dxf_code)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp; strcpy(result,rb1-&gt;resval.rstring);<BR>&nbsp;&nbsp; return RTNORM;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; return RTERROR;<BR>&nbsp;}<BR>/******************************************************************/<BR>&nbsp;int assoc_dxf_real(struct resbuf *rb,int dxf_code,ads_real *result)<BR>&nbsp; {<BR>&nbsp;&nbsp; struct resbuf *rb1;<BR>&nbsp;&nbsp; if (dxf_type(dxf_code)!=RTREAL) return RTERROR;<BR>&nbsp;&nbsp; if (rb==NULL) return RTERROR;<BR>&nbsp;&nbsp; for (rb1=rb;rb1!=NULL;rb1=rb1-&gt;rbnext) <BR>&nbsp;&nbsp;&nbsp; { if (rb1-&gt;restype==dxf_code)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp; *result=rb1-&gt;resval.rreal;<BR>&nbsp;&nbsp; return RTNORM;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp; return RTERROR;<BR>&nbsp;}</P>
<P>&nbsp;</P>

tyliling 发表于 2006-6-29 11:40:00

<P></P>
<P>你们可能还不知道我的意思,我现在是用C++向某个图元加放了标签资料,用我编写的专门查标签资的命令"WID"查询结果如下:</P>
<P>Command: wid</P>
<P>Select object:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CIRCLE&nbsp;&nbsp;&nbsp; Layer: "UP_W"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Space: Model space<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Handle = 89C5E<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; center point, X= -335.028&nbsp; Y=&nbsp;&nbsp; 53.235&nbsp; Z=&nbsp;&nbsp;&nbsp; 0.000<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; radius&nbsp;&nbsp;&nbsp;&nbsp; 6.000<BR>&nbsp;&nbsp;&nbsp;&nbsp; circumference&nbsp;&nbsp;&nbsp; 37.699<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; area&nbsp;&nbsp; 113.097</P>
<P>&nbsp;*标签项目: NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : = <BR>&nbsp;*标签项目: NOTE_MARK&nbsp;&nbsp; : = <BR>&nbsp;*标签项目: PART_MARK&nbsp;&nbsp; : = []<BR>上面三项标签值我怎样用LSP语言获得,用(entget (car (entsel)))好像没有这三项扩展的数据,请各位帮忙看一下,上面有附件.</P>

haill2000 发表于 2006-6-30 10:23:00

<P>用entgetx了,那是扩展实体数据</P>

wzz1968 发表于 2006-7-1 19:17:00

<P>是不是实体扩展数据的问题?</P>
<P>实体扩展数据的获得过程如下:</P>
<P>(setq ent_list (entget ent (list appname")))</P>
<P>(setq xdata (assoc -3 ent_list))</P>
<P>(setq name (assoc xdxf xdata))</P>
<P>&nbsp;</P>
<P>&nbsp;</P>
页: [1]
查看完整版本: C++如何与LSP相连接