caichunjie 发表于 2006-12-27 10:48:00

[求助]怎样提取块属性

我想在ARX提取明细表项属性值(每一行记录事先定义为块),包括材料,名称,重量等信息,如何实现,各位大哥请给点提示,先行谢过!

caichunjie 发表于 2007-1-4 22:35:00

自己解决了

<p>提取自定义属性块信息,我已经解决了,呵呵</p><p>等我整理好了,再发上来</p>

lichengbyd 发表于 2007-1-8 10:30:00

<p>楼主快贴上来吧</p><p>给大家参考一下</p>

caichunjie 发表于 2007-1-9 11:25:00

<p>以下代码实现自定义属性块的属性值提取,我采用鼠标拾取的方式从打开的图形文件中指定块(注意块中要有自己定义的属性)注释部分代码是我基于ACUI对话框实现的,根据你的具体情况选择吧</p><p>//&nbsp;BeginEditorCommand();<br/>&nbsp;//ShowWindow(SW_HIDE);<br/>&nbsp;ads_name adsNameBlockRef;<br/>&nbsp;ads_name entRes;<br/>&nbsp;ads_point ptRes;<br/>&nbsp;ads_matrix xFormRes;<br/>&nbsp;struct resbuf *refStkRes, *eb;<br/>&nbsp;if(acedNEntSelP(NULL,entRes,ptRes,FALSE,xFormRes,&amp;refStkRes) == RTNORM)<br/>&nbsp;{<br/>&nbsp;&nbsp;for(eb = refStkRes; eb != NULL;eb = eb-&gt;rbnext)<br/>&nbsp;&nbsp;{<br/>&nbsp;&nbsp;&nbsp;ads_name_set(eb-&gt;resval.rlname,adsNameBlockRef);<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;acutRelRb(refStkRes);<br/>&nbsp;//&nbsp;CompleteEditorCommand();<br/>&nbsp;}<br/>&nbsp;else<br/>&nbsp;{<br/>&nbsp;//&nbsp;CancelEditorCommand();<br/>&nbsp;}&nbsp;<br/>&nbsp;//ShowWindow(SW_SHOW);</p><p>&nbsp;AcDbObjectId blkRefId;<br/>&nbsp;acdbGetObjectId(blkRefId, adsNameBlockRef);</p><p>&nbsp;AcDbBlockReference *pBlkRef;<br/>&nbsp;acdbOpenObject(pBlkRef, blkRefId, AcDb::kForRead);<br/>&nbsp;<br/>&nbsp;AcDbObjectIterator *pAttrIter = pBlkRef-&gt;attributeIterator();<br/>&nbsp;pBlkRef-&gt;close();</p><p>&nbsp;char *pStr = "";<br/>&nbsp;char *pText = "";<br/>&nbsp;AcDbAttribute *pAttr;<br/>&nbsp;AcDbObjectId attrObjId;<br/>&nbsp;for(int attrNumber = 0; !pAttrIter-&gt;done(); pAttrIter-&gt;step())<br/>&nbsp;{<br/>&nbsp;&nbsp;attrObjId = pAttrIter-&gt;objectId();<br/>&nbsp;&nbsp;acdbOpenObject(pAttr,attrObjId,AcDb::kForRead);<br/>&nbsp;&nbsp;pStr = pAttr-&gt;tag();<br/>&nbsp;&nbsp;pText = pAttr-&gt;textString();<br/>&nbsp;&nbsp;pAttr-&gt;close();<br/>&nbsp;&nbsp;attrNumber++;<br/>&nbsp;&nbsp;acutPrintf("\nAttribute %d,Tag %s, Value %s",attrNumber,pStr,pText);<br/>&nbsp;}<br/>&nbsp;delete pAttrIter;</p>
页: [1]
查看完整版本: [求助]怎样提取块属性