DWF Viewer

## DWF Viewer

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

# TransformPoint function with SrcType Drawing and DstType Screen

2602 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).

Lucas

Employee
Posts: 338
Registered: ‎03-05-2008
Message 2 of 8 (2,580 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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
Posts: 4
Registered: ‎11-30-2010
Message 3 of 8 (2,573 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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?

Lucas

Employee
Posts: 338
Registered: ‎03-05-2008
Message 4 of 8 (2,561 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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
Posts: 4
Registered: ‎11-30-2010
Message 5 of 8 (2,555 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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

Thank you Herbert

Regards.

Lucas

Employee
Posts: 338
Registered: ‎03-05-2008
Message 6 of 8 (2,528 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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
Posts: 4
Registered: ‎11-30-2010
Message 7 of 8 (2,498 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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
Posts: 338
Registered: ‎03-05-2008
Message 8 of 8 (2,449 Views)

# Re: TransformPoint function with SrcType Drawing and DstType Screen

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

### You are not logged in.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.