DWFx parsing and correct transform for visible objects
While parsing DWFx, we are using DWF toolkit example, Read2DDWFxFile.cpp , posted on this forum(using pXAMLFile->process_next_object(), and object processing by callback.
The reading and parsing object is perfect, thank you for that example.
The issue we have is that some entities, (text, dimensions, raster, for example), seem to be translated incorrectly, usually by the offset of the lower left hand corner of the current viewport.
Scale is correct for all entities.
We have poly lines that are in the correct location relative to the viewport, directly following the text with no viewport between them, and text seems to be offset with the value calculated based on page paper height (or perhaps text is OK but poly is offset in the opposite direction).
We do not see what we can use from DWF toolkit to read-calculate and correct transform per object, and it looks like a bug to us, in the conversion from XPS/XML to W2D objects where some objects are not transformed through a viewport matrix, or similar situation.
Has anyone else seen something similar and is there a solution?
Honestly, I'd be shocked if there was such a fundamental bug found in the toolkit at this stage. But, it's not impossible. FWIW, the only 'special treatment' that DWFx gets versus DWF in Autodesk Design Review, for example, is for font handling, which is unrelated to the reported issue.
Is this happening with all DWFx files you encounter, or only a specific drawing?
Thank you Jeffry for confirming that should not be a difference between DWF and DWFx objects, and parsing them through WT_File and WT_XAML_File respectivly.
I do not have many files to test with, but all we have, 4 DWFx files with viewports, they all behave the same; raster and text are presumably with page height offset when we apply transform based on eplot and extents, and poly is correct (or wise versa, raster and text are OK, but poly needs to be offset by page height). When we process DWF files (those, DWF files, we do have many to test with), the same transform code creates correct views in our application.
I apologize for bringing possibility that issue we have might be an error in DWF toolkit.
Sincerely, I’m convinced it is my luck of DWF toolkit expertise, to be able to find the correct transform out of eplot transform, extents, view, and viewports transforms, and correct order of transform operations to apply to different objects.
Thank again for the reply.
Thank you Silvia
I’m new to DWF Toolkit, so I do not know in advance if this clarification will help me to resolve the issue, but I’ll definitely try to resolve my problem, by calling default DWF Toolkit callbacks from our callbacks, which should apply viewport matrix while parsing the objects.
Thank you again for clarification on this subject.
I had to make sure that the definePageLayout parameters were 100% correct, and all worked fine.
I still have not resolved where to get the scale factor, much appreciated if someone from autodesk could answer this, would be very appreciated.
// scale factor i do not know where to get it from, so for now I set it to 1
pxFile->definePageLayout( oTransform, pPlotSection->paper()->width(), pPlotSection->paper()->height(), 1 /*scale factor (see note)*/);