exploding region problem
exploding region problem
i'm trying to explode all the regions in order to convert them to
simpler entities ; but i can't succeed. if i try to explode the region
contained in the attached file i get no regions when exploding
(the array size is 0).
what should i do to be able to explode regions ?i'm using version 1.13.02
thanks
renaud
code:
void explodeallentitiesofblock(oddbblocktablerecordptr & block)
{
oddbobjectiteratorptr entity_it(block->newiterator());
odrxobjectptrarray exploded_entities;
while (!entity_it->done()) {
oddbentityptr entity(entity_it->entity());
if ((entity->iskindof(oddbproxyentity::desc())) ||
(entity->iskindof(oddbregion::desc()))) {
odrxobjectptrarray array;
entity->explode(array);
std::cout << array.size() << std::endl;
exploded_entities.append(array);
}
entity_it->step();
};
....
}
attached files
i was not able to reproduce this behaviour. what compiler/platform are you using?
vladimir
here is a complete standalone example showing the problem. i made a small project containing all the files in the exservices directory, and i link with
dd_vc6md_spatialindex.lib dd_vc6md_alloc.lib dd_vc6md_gi.lib dd_vc6md_acisrenderer.lib dd_vc6md_acisbuilder.lib dd_vc6md_modelergeometry.lib dd_vc6md_db.lib dd_vc6md_ge.lib dd_vc6md_gs.lib dd_vc6md_root.lib
(i use visual studio 6 on windows xp)
if i explode the region.dxf file (included in my first post) the region entity is not exploded (0 entities received). i link with the following librairies.
code:
#include "odacommon.h"
#include "odadefs.h"
#include "dbdatabase.h"
#include "dbdictionary.h"
#include "dbgroup.h"
#include "tables.h"
#include "entities.h"
#include "gescale3d.h"
#include "exsystemservices.h"
#include "exhostappservices.h"
#include "dbsystemservices.h"
#include "dbhostappservices.h"
#include "dbrasterimage.h"
#include "olestorage.h"
#include "gsbmpdevice.h"
#include <iostream>
class services : public exsystemservices, public exhostappservices
{
protected:
using exsystemservices:

perator new;
using exsystemservices:

perator delete;
public:
services(): exsystemservices(), exhostappservices() {}
};
odrxobjectimpl<services> & services()
{
static odrxobjectimpl<services> services;
services.disableoutput(true);
return services;
}
void explodeallentitiesofblock(oddbblocktablerecordptr & block)
{
oddbobjectiteratorptr entity_it(block->newiterator());
odrxobjectptrarray exploded_entities;
while (!entity_it->done()) {
oddbentityptr entity(entity_it->entity());
if ((entity->iskindof(oddbproxyentity::desc())) ||
(entity->iskindof(oddbregion::desc()))) {
odrxobjectptrarray array;
entity->explode(array);
std::cout << array.size() << std::endl;
exploded_entities.append(array);
}
entity_it->step();
};
}
void explodeallentities(oddbblocktableptr & blocks)
{
oddbsymboltableiteratorptr block_it(blocks->newiterator());
while (!block_it->done()) {
oddbblocktablerecordptr
block(block_it->getrecordid().safeopenobject(oddb::kforwrite));
explodeallentitiesofblock(block);
block_it->step();
}
}
int main(int argc, char ** argv)
{
if (argc != 2) return 0;
odinitialize(&services());
{
oddbdatabaseptr database;
database = services().readfile(argv[1],
false, false,
oda::ksharedenyno);
oddbblocktableptr blocks =
database->getblocktableid().safeopenobject();
explodeallentities(blocks);
} // to force database destruction
oduninitialize();
return 0;
}
last edited by reno; 28th november 2005 at 02:56 amfff">.
the region was not exploded because modeler was not linked in.
to use modeler functionality you should use following code
code:
#include "rxdynamicmodule.h"
odrx_declare_static_module_entry_point(modelermodule);
odrx_begin_static_module_map()
odrx_define_static_application("modelergeometry", modelermodule)
odrx_end_static_module_map()
and initialize module map later in main()
code:
odrx_init_static_module_map();
for example see odreadex sample.
vladimir
i works. thanks a lot for your help !