read properties dynamic block
read properties dynamic block
hello?br />
i have a problem when trying to read the properties of a dynamic block.
code:
oddbblocktablerecordptr pms = m_pdb->getmodelspaceid().safeopenobject(oddb::kforread);
oddbobjectiteratorptr pmsents = pms->newiterator();
while (!pmsents->done())
{
oddbobjectid id = pmsents->objectid();
oddbblockreferenceptr br = oddbblockreference::cast(id.safeopenobject());
if (!br.isnull())
{
oddbdynblockreference ref( br.get() );
if (ref.isdynamicblock() )
{
oddbdynblockreferencepropertyarray a;
ref.getblockproperties(a); ------> in this line <--------
}
}
pmsents->step();
}
uppload error windows..
greats!!!
klvin
attached images
some tests that make
code:
oddbdynblockreference ref( br.get() );
oddbobjectid oid = ref.blockid(); //this line return valid id
oddbobjectid oid2 = ref.dynamicblocktablerecord (); //this line return valid id2
ref.converttostaticblock ("paco"); //this line try exception "null object id"
thanks...
can you upload problematic file?
can the problem be reproduced in odamfcapp? (there is a sample drx that should be loaded: exdynamicblocks.drx. it will register some commands under "dynamicblocks" group name. try to run these commands)
vladimir
i have proven the odamfcappdll example, i open the deskset.dwg file. and i execute commando listproperties.
quote:
void listpropertiescmd::execute(odedcommandcontext* pcmdctx)
{
oddbcommandcontextptr pdbcmdctx(pcmdctx);
oddbuserio* pio = pdbcmdctx->dbuserio();
oddbselectionsetptr psset = pio->select( dd_t("select dynamic block reference:") );
for ( oddbselectionsetiteratorptr it = psset->newiterator(); !it->done(); it->next() ) //not enter in this for
{
oddbblockreferenceptr br = oddbblockreference::cast(it->objectid().safeopenobject());
if ( br.isnull() )
continue;
oddbdynblockreference ref( br.get() );
if ( !ref.isdynamicblock() )
continue;
oddbdynblockreferencepropertyarray a; ref.getblockproperties(a);
for ( unsigned i = 0; i < a.size(); i++ )
{
odstring s; s.format( dd_t("%ls (%ls,%ls), %ls = %ls"),
a[i]->propertyname().c_str(),
a[i]->show() ? dd_t("v") : dd_t("h"),
a[i]->readonly() ? dd_t("r") : dd_t("w"),
a[i]->description().c_str(),
formatresbuf( a[i]->value() ).c_str());
pio->putstring( s );
}
}
}
and it does not enter in the for!!!
attached files (66.5 kb, 3 views)
that is rather strange.
that's what i ve got from listproperties:
command: listproperties
1 found
posicion silla x (v,w), = 38.3795
posicion silla y (v,w), = -59.4439
longitud escritorio (v,w), = 72
origin (h,w), = {-7.10543e-014,0,0}
tamano pantalla (v,w), = 18.0954
origin (h,w), = {29.5697,-19.6031,0}
what dd version do you use?
what compiler and configuration?
vladimir
quote:
what dd version do you use?
dwgdirect 2.3.0
quote:
what compiler and configuration?
microsoft visual studio 2005
versi髇 8.0.50727.42 (rtm.050727-4200)
microsoft .net framework
versi髇 2.0.50727
i use autocad 2006.
when executing the odamfcappdll application and making a listproperties gives the following mesaje me.
quote:
command: listproperties
1 found
1 was not an entity.
you did not select dynamic block reference
vladimir
uppsss that clumsy!
with himself to already read the dynamic properties in odamfcappdll but but i follow with the error in my application.
it is necessary to execute some macro?
dynamicblocks*.drx should be loaded.
does your application use dlls or static libraries?
vladimir
this are the modules directdwg loaded...
dd_alloc_2.03_8.dll
dd_db_2.03_8.dll
dd_dynblocks_2.03_8.drx \\dwgdirect\dll\vc8\debug\
dd_ge_2.03_8.dll
dd_gi_2.03_8.dll
dd_root_2.03_8.dll
my application use the dynamic libraries...
it can be that it needs to initialize something?
by "module loaded" i mean
code:
:

drxdynamiclinker()->loadmodule(l"dd_dynblocks.drx");
vladimir
thank you very much! i lose one磗 mind...
i thought that to load the library it was enought.
code:
:

drxdynamiclinker()->loadmodule(l"dd_dynblocks.drx");
and i do not know very clearly so that it serves that code???
greatssss!!!!!