查看单个帖子
旧 2009-05-05, 10:07 AM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】explode nested xref block

explode nested xref block
explode nested xref block
i tried to explode xref block.
it fails in second xref block.
i use dd 1.14.02. (1.13 no problem)
attached file, abc.zip.
after it develops,
abc.dwg
test\xref1.dwg
test\xref2.dwg
code:
oddbdatabaseptr pdb = svcs.readfile( (lpcstr)"abc.dwg", false, false, oda::ksharedenyno );
...
oddbblockreference* pblk; // first xref
...
odrxobjectptrarray ary;
odresult err = pblk->explode( ary ); // eok
for( uint i=0; i<ary.size(); i++ )
{
oddbentityptr pent = oddbentity::cast( ary.getat(i) );
if( pent->iskindof( oddbblockreference::desc() ) )
{
oddbblockreferencenptr pblk2 = pent; // second xref
odrxobjectptrarray ary2;
err = pblk2->explode( ary ); // ecannotexplodeentity
}
}
problem of xrefpath ?
attached files
the code below works in odamfcapp 1.14.02.
note that you were exploding second xref to the same array (ary - not ary2) but return status was eok....
btw, can odamfcapp render the xrefs on your computer?
maybe the problem is realy with paths?
code:
oddbobjectid id = pdb->getoddbobjectid(0xcddf8);
oddbblockreferenceptr pblk = id.openobject(); // first xref
odrxobjectptrarray ary;
odresult err = pblk->explode( ary ); // eok
for( uint i=0; i<ary.size(); i++ )
{
oddbentityptr pent = oddbentity::cast( ary.getat(i) );
if( pent->iskindof( oddbblockreference::desc() ) )
{
oddbblockreferenceptr pblk2 = pent; // second xref
odrxobjectptrarray ary2;
err = pblk2->explode( ary2fff"> ); // ecannotexplodeentity
}
}
return;
sergey slezkin
i'm sorry.
ary is my mistake.
but it fails yet.
i think it is problem of xrefpath.
code:
oddbblockreferenceptr pblk1;
odrxobjectptrarray ary;
odresult err = pblk1->explode( ary ); // eok
for( uint i=0; i<ary.size(); i++ )
{
oddbentityptr psrc = oddbentity::cast( ary.getat(i) );
if( psrc->iskindof( oddbblockreference::desc() ) )
{
oddbblockreferenceptr pblk2 = psrc; // second xref
oddbblocktablerecordptr pbtr = pblk2->blocktablerecord().safeopenobject( oddb::kforwrite );
cstring str( pbtr->pathname() ); // <- .\xref2.dwg
pbtr->setpathname( "c:\\test\\xref2.dwg" ); // change from relative to absolute
odrxobjectptrarray ary2;
err = pblk2->explode( ary2 ); // eok
}
}
please try attached files. (abc.zip)
i tried the code with your files in odamfcapp 1.14.02 vc6 debug and it works.
are you working on windows? could you try if odamfcapp sample renders the abc.dwg correctly displaying both xref?
sergey slezkin
>are you working on windows?
yes.
i tried odamfcapp renders.
it works.
i improves my code.
thanks.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)