DWF Viewer (Read Only)
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

TransformPoint function with SrcType Drawing and DstType Screen

7 REPLIES 7
Reply
Message 1 of 8
lucasklos
3716 Views, 7 Replies

TransformPoint function with SrcType Drawing and DstType Screen

Hello,

I want to know in which unit are the coordinates I get as a result of calling the function TransformPoint.

Here is what I am doing (C# code):

 

object DstUX, DstUY, DstUZ;


PlotSection.TransformPoint(2, 640, 385, null, 0, out DstUX, out DstUY, out DstUZ);
int topLeft = Math.Abs((int)Math.Round(decimal.Parse(DstUX.ToString())));
int topTop = Math.Abs((int)Math.Round(decimal.Parse(DstUY.ToString())));


PlotSection.TransformPoint(0, srcX, srcY, null, 2, out DstUX, out DstUY, out DstUZ);


int topLeft = Math.Abs((int)Math.Round(decimal.Parse(DstUX.ToString())));              

int topTop = Math.Abs((int)Math.Round(decimal.Parse(DstUY.ToString())));

 

But I get coordinates that are not in the same unit as the coordinates I usually use when I am drawing something on the screen (i.e. I get DstUX = -14406 and DstUY = 9210, and my screen coordinates go from: 0 to 1280 and 0 to 770).

 

Thanks in advance.

Lucas

7 REPLIES 7
Message 2 of 8
herbert.he
in reply to: lucasklos

Thank you for your question.

 

The screen here is corresponding to the canvas of DWF Viewer control but not your screen. So the negative or larger coordinates means the source drawing is out of the canvas. You can zoom out your canvas and try it again.

 

Hope that helps.



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 3 of 8
lucasklos
in reply to: lucasklos

Thank you for the answer...

So basically what I need to do is tranform the coordinates to the ones I have on the screen.

For that I call 3 times to the method TransformPoint (to obtain the taget point, the TOP-LEFT point and the BOTTOM-RIGHT point of the current view) to be able to transform the coordinates axis and units.

The problem is that the second and third time I call to the TransformPoint method, I get the values as the first time, but I am sure that the values I give as parameter are differents. Do you know why is this happening? Or what I'm doing wrong?

Thanks in advance.

Lucas

Message 4 of 8
herbert.he
in reply to: lucasklos

Thank you for your question.

 

Please insure to use the same "SrcType" and "DstType" for your 3 times call. If it still not help, please attach your code here for us to investigate.



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 5 of 8
lucasklos
in reply to: herbert.he

Thank you Herbert

Find attached a fragment of my code. Please advice.

Regards.

Lucas

 

 

Message 6 of 8
herbert.he
in reply to: lucasklos

Thank you for your feedback.

 

What are exactly values of CurrentView and simpleDrawingView before your 3 times call? Please insure you got expected values for CurrentView and simpleDrawingView previously.



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 7 of 8
lucasklos
in reply to: lucasklos

Hello,

I just verified and the variables  CurrentView and simpleDrawingView have the expected values. Just in case I have replaced this variables for constant values and I got the same result. See below.


 

PlotSection.TransformPoint(0, 7.0823, 4.780, 0, 2, out newOriginX, out newOriginY, out unused);               PlotSection.TransformPoint(0, 7.5524, 4.2786, 0, 2, out targetPointX, out targetPointY, out unused); 

 PlotSection.TransformPoint(0, 8.6472, 3.7193, 0, 2, out currentViewLimitRight, out currentViewLimitBottom, out unused);

 

Thank you!

Lucas

Message 8 of 8
herbert.he
in reply to: lucasklos

Thank you for your feedback.

 

Please upload your test .dwf file to this thread for me use to investigate.



Herbert He
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report