I have a problem extracting dwg coordinate geometry from a dwfx file.
Using as an example the W2Dtest sample and the Read2DDWFxFile.cpp file, I get all the Whip coordinates.
I read in this topic that the coordinates appear correct:
But when I try to convert this coordinates to the original AutoCAD DWG coordinates, using first:
WT_Matrix xform3d( pGraphicsRes->transform() );
DWFToolkit:WFPaper *pPaper( pEPlotSxn->paper() );
xform(0,0) = xform3d(0,0);
xform(1,0) = xform3d(1,0);
xform(0,1) = xform3d(0,1);
xform(1,1) = xform3d(1,1);
xform(2,0) = xform3d(3,0);
xform(2,1) = xform3d(3,1);
XAMLFile->definePageLayout(xform, pPaper->width(), pPaper->height(),
pPaper->units() == DWFToolkit:WFPaper::eMillimeters ? .03937 : 1.0 );
and then for each point:
WT_Point3D correctCoord = units.transform_from_DWF_to_application(newPoint);
i get coordinates like this:
where I should be getting coordinates like this:
Any ideia what i'm doing wrong? Am I missing something? Any help is appreciated.
I noticed that the the matrix that I get from WT_Units:
WT_Matrix original = units.application_to_dwf_transform();
have some correct values, and some other strange values like 2,89e-14. Is this normal? I could alter the values in the transformation matrix but I don't think that is the correct approach.
And i should be using units.transform_from_DWF_to_application(), not units.application_to_dwf_transform(), because I want the original DWG coordinates, but the output coordinates makes even less sense.
Any ideas? I'm really at a loss here.
Access a broad range of knowledge to help get the most out of your products and services.