高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】exploding proxyentities into simple entities
exploding proxyentities into simple entities
exploding proxyentities into simple entities
i need to read in proxyentities, break them down into simple entities and import these into my application's native format.
i am using the following code called from the proxyentity processing routine:
void oddbentity_export::export(oddbentity* pent, oddbdatabase* pdb) const
{
odrxobjectptrarray entityset;
pent->explode(entityset);
odrxobjectptrarray::iterator pit = entityset.begin();
odrxobject* pobj;
odgeextents3d extents;
for(; pit != entityset.end(); ++pit)
{
pobj = pit->get();
oddbentityptr pent2 = pobj;
pent2->getgeomextents(extents);
odsmartptr<oddbentity_export> pentexport = pobj;
pentexport->export(pent2, pdb);
}
}
i am noticing is that the getgeomextents routine doesn't always get the extents (i've filled it with dummy data and it doesn't overwrite the dummy data).
i'm concerned because the export() call at the end also seems to not be working - i get 2dpolylines and 3dlines from what i understand is a 3d line of some kind. i am also a little concerned about the potential recursive nature of the export call.
in short, i am having trouble getting the simple entities out of something that i have exploded. how do i get the simple entities?
quote:
i am noticing is that the getgeomextents routine doesn't always get the extents (i've filled it with dummy data and it doesn't overwrite the dummy data).
a sample would be helpfull....
quote:
i'm concerned because the export() call at the end also seems to not be working - i get 2dpolylines and 3dlines from what i understand is a 3d line of some kind. i am also a little concerned about the potential recursive nature of the export call.
note that explode() returns an array of pointers to non-database resident objects. their objectid() method will return null. you need to take it into consideration in your export() function.
btw, explodetoblock() replaces entity with database residents. see odamfcapp sample.
sergey slezkin
sample ... as you asked
i have attached a file with a single proxyentity. when reading and processing the file, explode() converts the entity into acdblines and acdb2dpolylines (oddblines and oddb2dpolylines). the line entities have an elevation and the polyline entities don't. i am expecting all to have an elevation because the original should have an elevation.
if i initialize the extents to 0.0, 0.0, 0.0 for min and max before getting the extents (in the code given before), for the acdbline, only one or the other (min or max) point gets updated. the other doesn't change. i have watched this happen or more properly not happen.
thus a line that has coords of 1952,25209,903 and 1953,25209,903 gives extents of minpoint=0,0,0 and maxpoint=1953,25209,903
my help file says i have dd version 1.1101 but i downloaded it around 8/4/05 so whatever version was available then i have.
note: i need to get the basic entities(points, lines, text), so if i explode to a block, i'll need to explode that block eventually to get the basic entities as well. so understanding how to explode and extract basic entities is kind of important.
attached files (130.3 kb, 11 views)
1. oddbline returns coordinates in wcs so z is non-zero. oddb2dvertex returns position in ocs which is defined by oddbpolyline's normal and elevation. to get coordinates in wcs you can use oddb2dpolyline::vertexposition() or to transform coordinates yourself using odgematrix3d:lanetoworld() and elevation stored on polyline (in such case transformation matrix can be built once - not for each vertex.
2. as a result of dd bug text from proxy entity representation sometimes comes as lines and polylines.
3. getgeomextents().
as a result of not absolutely correct implementation some entities assign their extents to output parameter using operator =. and some only add their extents to exising in output parameter. as a work around you can initialize extents as it's done in default constructor:
min = 1.e20
max = -1.e20
sergey slezkin
|