![]() |
【转帖】getting attributes from block
getting attributes from block
getting attributes from block hi, please help me to solve the below issue. the autocad file contains 'kc-title' block. the block contain mutliple attributes like name, value size, 2 title1, diaper title2, mechanical and so on. now what is the problem is i can able to read the attribute names(size, title1,title2) from the block. but the attribute value(2, diaper, mechanical) is displayed null. odstring s; oddbblocktableptr ptable = pdb->getblocktableid().safeopenobject(); oddbsymboltableiteratorptr pblkiter = ptable->newiterator(); for (pblkiter->start(); ! pblkiter->done(); pblkiter->step()) { oddbblocktablerecordptr pblock = pblkiter->getrecordid().safeopenobject(); s=pblock->getname(); odprintconsolestring(l"%ls\n", s.c_str()); if(pblock->hasattributedefinitions()) { oddbobjectiteratorptr pentiter = pblock->newiterator(); for (; !pentiter->done(); pentiter->step()) { dumpentity(pentiter->objectid(), 1); } } } void dumpentity(oddbobjectid id, int indent) { odstring s,buffer; oddbentityptr pent = id.openobject(); oddbattributedefinitionptr pattdef = oddbattributedefinition::cast(pent); if(!pattdef.isnull()) { s = pattdef->tag()+"---"+pattdef->textstring(); odprintconsolestring(l"%s\n",s.c_str()); } } please provide any sample program for the above problem. please see the attached dwg file for your reference.. attached files oddbattributedefinitions are contained in block. oddbattributes (actual values) are owned by oddbblockreference entity (block insertion). different insertions of the same block can have different attribute values. to get attribute values use oddbblockreference::attributeiterator() sergey slezkin |
所有的时间均为北京时间。 现在的时间是 12:01 PM. |