![]() |
【转帖】duplicate block references
duplicate block references
duplicate block references hi there, i am having a problem on getting block references. hopefully someone can help me with this. i have a xref in my master drawing. in the xref, there is a block reference (inserted block). i wrote some code to get the block reference. i am expecting to get one block reference because there is only one. however, the code gives me duplicate block references. i don't know anything wrong in my code. here is my code: oddbblocktablerecordptr pblock; oddbobjectid blockid; // get the blockid for the xref oddbblocktableptr pblocks = pdb->getblocktableid().safeopenobject(); oddbsymboltableiteratorptr pblkiter = pblocks->newiterator(); for (pblkiter->start(); ! pblkiter->done(); pblkiter->step()) { // open the block pblock = pblkiter->getrecordid().safeopenobject(oddb::kforread); if (pblock->isfromexternalreference()) { //the xref blockid blockid = pblkiter->getrecordid(); } } //search in the xref for the reference of the given block(myblock|ref) int found; oddbblocktablerecordptr pms = blockid.safeopenobject(); oddbobjectiteratorptr pentiter = pms->newiterator(); for(pentiter->start(); !pentiter->done(); pentiter->step()) { oddbentityptr pent = pentiter->entity(oddb::kforread); oddbblockreferenceptr pref = oddbblockreference::cast(pent); if (!pref.isnull()) { oddbblocktablerecordptr pblock = pref->blocktablerecord().safeopenobject(); if (_stricmp(pblock->getname(), "myblock|ref") == 0) { found++; } } } thanks! al hi there, i found what causes the problem. i put oddbxrefman::reloadall somewhere in my code. it somehow causes the problem. al hi al, xref loading is redesigned in dd 1.12 (upcoming release). so probably the problem will disappear. but i can't say if the code is correct or not. why don't you use oddbblocktablerecord::getblockreferenceids() ?.. last edited by dmitry a. novikov; 9th september 2004 at 07:29 amfff">. |
所有的时间均为北京时间。 现在的时间是 08:35 PM. |