Community
DWF
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DWFx parsing and correct transform for visible objects

11 REPLIES 11
Reply
Message 1 of 12
slavicam
1485 Views, 11 Replies

DWFx parsing and correct transform for visible objects

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?
Gloria
11 REPLIES 11
Message 2 of 12
JeffreyKlug
in reply to: slavicam

Hi Gloria,

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?

Thanks.

Jeffrey Klug
Software Architect
Autodesk, Inc.
Message 3 of 12
SilviaCao
in reply to: slavicam

Thank you for your question.

Yes, the W2D objects are not transformed through a viewport matrix. They are translated automatically by DWFToolkit when parsing.

Please let me know if you have any further questions.

Silvia


Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 4 of 12
slavicam
in reply to: slavicam

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.
Message 5 of 12
slavicam
in reply to: slavicam

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.
Message 6 of 12
JeffreyKlug
in reply to: slavicam

Let us know if this fixes it for you. Thanks for the responses!

Jeffrey Klug
Message 7 of 12
anndunbar
in reply to: slavicam

Where can I find the file, Read2DDWFxFile.cpp, mentioned in this post - I didn't find it in the download of the 7.6 version of the toolkit.
Message 8 of 12
slavicam
in reply to: slavicam

Read2DDWFxFile.cpp is posted by SilviCao from Autodesk Thread: Adding text to a DWF:
https://discussion.autodesk.com/forums/message.jspa?messageID=6315652
Message 9 of 12
janderssen
in reply to: slavicam

I had this exact issue.

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.

My Code :

WT_Matrix2D oTransform;
oTransform(0,0) = pGraphicResource->transform()[0];
oTransform(1,1) = pGraphicResource->transform()[5];
oTransform(2,0) = pGraphicResource->transform()[12];
oTransform(2,1) = pGraphicResource->transform()[13];
DWFEPlotSection *pPlotSection = dynamic_cast( m_pSection );

// 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)*/);


Cheers
Jason Anderssen
Message 10 of 12
1810msa
in reply to: slavicam

The following post link is invalid for Dwfx example, could you please make sure of it?

https://discussion.autodesk.com/forums/message.jspa?messageID=6315652

 

 

Regards,

Hmeidi

Message 11 of 12
lmpmbernardo
in reply to: 1810msa

search for "Adding text to a DWF" and you should find it. I remember I had the same problem once...

Message 12 of 12
1810msa
in reply to: lmpmbernardo

Thanx a lot.Smiley Happy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

”Boost

 

”Tips

 

”Services