[求助]怎样提取块属性
我想在ARX提取明细表项属性值(每一行记录事先定义为块),包括材料,名称,重量等信息,如何实现,各位大哥请给点提示,先行谢过!自己解决了
<p>提取自定义属性块信息,我已经解决了,呵呵</p><p>等我整理好了,再发上来</p> <p>楼主快贴上来吧</p><p>给大家参考一下</p> <p>以下代码实现自定义属性块的属性值提取,我采用鼠标拾取的方式从打开的图形文件中指定块(注意块中要有自己定义的属性)注释部分代码是我基于ACUI对话框实现的,根据你的具体情况选择吧</p><p>// BeginEditorCommand();<br/> //ShowWindow(SW_HIDE);<br/> ads_name adsNameBlockRef;<br/> ads_name entRes;<br/> ads_point ptRes;<br/> ads_matrix xFormRes;<br/> struct resbuf *refStkRes, *eb;<br/> if(acedNEntSelP(NULL,entRes,ptRes,FALSE,xFormRes,&refStkRes) == RTNORM)<br/> {<br/> for(eb = refStkRes; eb != NULL;eb = eb->rbnext)<br/> {<br/> ads_name_set(eb->resval.rlname,adsNameBlockRef);<br/> }<br/> acutRelRb(refStkRes);<br/> // CompleteEditorCommand();<br/> }<br/> else<br/> {<br/> // CancelEditorCommand();<br/> } <br/> //ShowWindow(SW_SHOW);</p><p> AcDbObjectId blkRefId;<br/> acdbGetObjectId(blkRefId, adsNameBlockRef);</p><p> AcDbBlockReference *pBlkRef;<br/> acdbOpenObject(pBlkRef, blkRefId, AcDb::kForRead);<br/> <br/> AcDbObjectIterator *pAttrIter = pBlkRef->attributeIterator();<br/> pBlkRef->close();</p><p> char *pStr = "";<br/> char *pText = "";<br/> AcDbAttribute *pAttr;<br/> AcDbObjectId attrObjId;<br/> for(int attrNumber = 0; !pAttrIter->done(); pAttrIter->step())<br/> {<br/> attrObjId = pAttrIter->objectId();<br/> acdbOpenObject(pAttr,attrObjId,AcDb::kForRead);<br/> pStr = pAttr->tag();<br/> pText = pAttr->textString();<br/> pAttr->close();<br/> attrNumber++;<br/> acutPrintf("\nAttribute %d,Tag %s, Value %s",attrNumber,pStr,pText);<br/> }<br/> delete pAttrIter;</p>
页:
[1]