高级会员
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
|
【转帖】oddbblockreference and transformation matri
oddbblockreference and transformation matrix
oddbblockreference and transformation matrix
hello,
i would like to build my own data structure from the oddbdatabase structure, and particularly the block references...
in fact, i am facing the problem to get the oddbblockreference referenced entity's geometry without any transformation, to get the transformation matrix and to build my own data structure that instantiate the geometry with a transformation matrix...
in order to get the geometry of the entities, i use the same code as in the vectorizer sample...
i think this code is too heavy because it duplicates the whole referenced entity in order to get it untouched by the transformation matrix and it can be dangerous because i am not sure that the inverted transformation matrix exists...
is there a simpler way to do the job?
thank you for your help
guilhem
code:
/* here, i have
* odstaticrxobject<vectorizer> * vectorizer,
* oddbentityptr dwg_entity */
if (dwg_entity->isa() == oddbblockreference::desc() &&
dwg_entity->iskindof (odgidrawable::desc()) ) {
oddbblockreferenceptr ref = dwg_entity;
oddbblocktablerecordptr record = ref->blocktablerecord().safeopenobject();
/* get the dwg matrix */
odgematrix3d dwg_matrix = ref->blocktransform();
odgepoint3d basept (record->origin());
dwg_matrix *= odgematrix3d::translation (odgepoint3d::korigin - basept);
/* try to get the object associated to the entity */
if (i have not already encounrered this entity, i need to build its
geometry in order to reuse it) {
oddbentityptr dwg_copy;
odgematrix3d dwg_matrix_copy = dwg_matrix;
ref->gettransformedcopy (dwg_matrix_copy.invert(), dwg_copy);
# if 0
/* the idea here does not work and cause an assertion error
* in dd libs : the idea was to set the transformation matrix
* of this entity to the identity matrix in order to get its
* geometry untouched. so i try the code above with duplication */
/* set the transformation matrix to the identity */
//test1=crash ref->transformby (odgematrix3d::kidentity);
//test2=crash ref->setblocktransform (odgematrix3d::kidentity);
# endif
/* capture the geometry */
vectorizer->draw (dwg_copy);
}
/* here i instanciate my entity structure in my object */
...
|