Hi, I'm doing a DWF viewer right now, but I've met some problems with the layout for the extracted objects.
I found that if only one or no WT_Origin informaton within a DWF file, my model will be displayed correctly, but I got more than one origin points read from the file, the layout of the model will be totally mess.
So I wanna know how the origin points being sorted in the file, is ONE ORIGIN could be refered by MULTIPLE points? Or the position of objects are decided by layers?
Thank you a lot if you can help me, this problem has been tortured a long time...
Solved! Go to Solution.
Thank you for your questions.
The WT_Origin defines an absolute point in drawing coordinates used to reset the relative coordinate processing. The DWF Toolkit will process the WT_Origin object automatically when reading the DWF file; so if your model processes the WT_Origin object, please skip the WT_Origin object.
Please let me know if you have any further questions.
Thank you for your reply.
I did what you told me, things get little better, but the model still has some abnormal offset.
Do I need to do anything about layers? Or something with WT_View and WT_Units? Because I think they defined the translation of the model.
What am doing now is extract the points directly from W2D objects then scale them to a propery size before drawing them on the screen, is anything wrong with the process?
Again, thank you for your time.
Yes, you need to process the WT_Units, which defines the translation of the model.
And your process is correct.
I still got problem with this issue, when I process models with just one WT_Origin, the layout will be corret, but if I met model with multiple WT_Origin, the individual objects in the model will scatter all around the screen, which is definitely wrong.
How should I solve this issue? It has bothered me more than a week
Could you please send us more information to research?
I really appreciate your help, the files you want are in the attachment.
DSTA-BCA_v5.dwf is the DWF file I'm using to test.
WrongDisplay.png is the output of my program which I'm using OpenGL to render.
Code.txt is containing how I parse the WT_Unit, WT_View and WT_Polyline.
Please let me know when you found anything wrong!
In the “Code.txt”, function “getUnits”, what does the “m_transformMatDWF” use to do? Please comment the function “getUnits” and try again.
And could you please send us more codes from extracting the DWF file to calling the function getUnits()?
Thank you for your reply.
I just use m_transformMatDWF and m_transformMatDWF as scale parameter to scale my model, I didn't do any translation with them.
And the code you ask is in the attachment.
Please replace the “get_next_object()” with “process_next_object()” in function rewriteW2D(), and test again.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register