DWF Viewer

DWF Viewer

Reply
Member
lucasklos
Posts: 4
Registered: ‎11-30-2010
Message 1 of 8 (2,685 Views)

TransformPoint function with SrcType Drawing and DstType Screen

2685 Views, 7 Replies
11-30-2010 07:04 AM

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

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 2 of 8 (2,663 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-01-2010 06:37 PM 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.
Member
lucasklos
Posts: 4
Registered: ‎11-30-2010
Message 3 of 8 (2,656 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-02-2010 07:33 AM 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

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 4 of 8 (2,644 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-03-2010 12:40 AM 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.
Member
lucasklos
Posts: 4
Registered: ‎11-30-2010
Message 5 of 8 (2,638 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-03-2010 03:24 AM in reply to: herbert.he

Thank you Herbert

Find attached a fragment of my code. Please advice.

Regards.

Lucas

 

 

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 6 of 8 (2,611 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-05-2010 06:50 PM 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.
Member
lucasklos
Posts: 4
Registered: ‎11-30-2010
Message 7 of 8 (2,581 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-09-2010 04:24 AM 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

Employee
herbert.he
Posts: 338
Registered: ‎03-05-2008
Message 8 of 8 (2,532 Views)

Re: TransformPoint function with SrcType Drawing and DstType Screen

12-13-2010 05:30 PM 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.
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.