Cancel
Showing results for 
Search instead for 
Did you mean: 

How to use method PointWorldCoordinates of the TxGraphicViewer class

Creator
Creator

Can anyone help me understand how to use the method "PointWorldCoordinates" in the TxGraphicViewer class?

 

It takes two arguments:

 

TxVector OrinialLocation and TxVector pointInScreenCoordinates

 

But I am not sure what the "originalLacation" is, and how to obtain the z value of "pointInScreenCoordinates" ?

 

Thanks

1 REPLY

Re: How to use method PointWorldCoordinates of the TxGraphicViewer class

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Jinglin,

 

originalLocation is the previous point in world coordinates. For example if you know the world location of an object and project it to the screen with PointScreenCoordinates. Then you want to move that object to new location aligned with other screen coordinates. Then you have this code:

private void GraphicViewerCalculations(ITxLocatableObject obj)
        {
            TxVector worldLocation = obj.AbsoluteLocation.Translation;
            TxVector scrrenCoordintaes = TxApplication.ViewersManager.GraphicViewer.PointScreenCoordinates(worldLocation);
            scrrenCoordintaes.X += 100;

            TxVector newWorldLocation = TxApplication.ViewersManager.GraphicViewer.PointWorldCoordinates(worldLocation, scrrenCoordintaes);

            obj.AbsoluteLocation = new TxTransformation(newWorldLocation, TxTransformation.TxTransformationType.Translate);
        }

If you don't know the previous worldLocation, then use (0,0,0).  This parameter is used for calculation of the z value, as there are many world points that can match the screen (x,y) point.

 

For the second parameter - pointInScreenCoordinates - you need to specify only x and y, z value is 0.

 

Best Regards,

DianaG