几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】problem with negative scalefactors (http://www.dimcax.com/hust/showthread.php?t=18138)

yang686526 2009-05-06 11:23 PM

【转帖】problem with negative scalefactors
 
problem with negative scalefactors
problem with negative scalefactors
code:

oddbblocktablerecordptr oddbblocktablerecordptr = oddbdatabaseptr->getmodelspaceid().safeopenobject(oddb::kforread);
oddbobjectiteratorptr oddbobjectiteratorptr = oddbblocktablerecordptr->newiterator();
for (oddbobjectiteratorptr->start(); !oddbobjectiteratorptr->done(); oddbobjectiteratorptr->step())
{
oddbentityptr oddbentityptr(oddbobjectiteratorptr->entity());
if (oddbentityptr->iskindof(oddbblockreference::desc()))
{
double dangle = 0.0;
odgematrix3d matrix;
odgescale3d odgescale3d(2.0, -2.0, 1.0);
oddbblockreferenceptr oddbblockreferenceptr = oddbentityptr;
// change scale factors
oddbblockreferenceptr->upgradeopen();
oddbblockreferenceptr->setscalefactors(odgescale3d);
dangle = oddbblockreferenceptr->rotation(); // 0.0
// move entity
matrix.settoidentity();
matrix.settranslation(odgevector3d(2.0, 0, 0));
oddbblockreferenceptr->transformby(matrix);
dangle = oddbblockreferenceptr->rotation(); // -3.14
odgescale3d= oddbblockreferenceptr->scalefactors(); // (-2.0, 2.0,1.0
}
}i have a problem when a scale factor of a blockreference is negative, and when a transformby is call on this entity.
you can see it in my sample, angle and scale factors are change after a translation ???
why ?
regards,
froggy.
block transform is stored as a combination of origin, scale, normal and rotation. in transfromby these values combine to a matrix, multiply by transform and decompose back. decomposition algorithm does not depend on old values.
vladimir
ok, but in objectarx, the same code doesn't generate the same block transform values.
is that because you don't use the same algorithm than in autocad or is it a bug ?
resulting transform is the same, so i wouldn't call that a bug. 'incompatiility' perhaps.
vladimir
thanks wvk, i will try to do with this 'incompatibility'.
best regards,
froggy.


所有的时间均为北京时间。 现在的时间是 11:39 AM.