Tekla Open API

Detailed and full API reference helps you master Tekla Open API

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

MatrixFactory Class

The MatrixFactory class provides a convenient way to generate different kinds of transformation matrices.
Inheritance Hierarchy
SystemObject
  Tekla.Structures.Geometry3dMatrixFactory

Namespace:  Tekla.Structures.Geometry3d
Assembly:  Tekla.Structures (in Tekla.Structures.dll) Version: 2018.1.0.0 (2018.1.0.0)
Syntax
[SerializableAttribute]
public static class MatrixFactory

The MatrixFactory type exposes the following members.

Methods
  Name Description
Public methodStatic memberCode example ByCoordinateSystems
Returns a coordinate transformation matrix defined by two coordinate systems. With the returned matrix points can be transformed from the first coordinate system to the second coordinate system. The ByCoordinateSystems method is meant for transforming points between coordinate systems asked in the same work plane.
Public methodStatic memberCode example FromCoordinateSystem
Returns a coordinate transformation matrix defined by the given coordinate system. With the returned matrix points can be transformed from the given coordinate system to the current work plane coordinate system.
Public methodStatic member Rotate
Returns a rotation matrix in a Clockwise rotation around the given rotation axis, defined by the given angle and the given rotation axis.
Public methodStatic memberCode example ToCoordinateSystem
Returns a coordinate transformation matrix defined by the given coordinate system. With the returned matrix points can be transformed from the current work plane coordinate system to the given coordinate system.
Top
Examples
The matrix factory can be used to create some useful transformation matrices between different coordinate systems:
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model;

public class Example
{
       public void Example1()
       {
           Beam Beam1 = new Beam();
           Beam Beam2 = new Beam();
           Point Point1 = new Point();

           CoordinateSystem Csys1 = Beam1.GetCoordinateSystem();
           CoordinateSystem Csys2 = Beam2.GetCoordinateSystem();

           Matrix Matrix = MatrixFactory.ByCoordinateSystems(Csys1, Csys2);
           Point Point2 = Matrix.Transform(Point1);

           // The same result for Point2 when using two separate transformations
           Matrix ToCurrentWP = MatrixFactory.FromCoordinateSystem(Csys1);
           Point CurrentPoint = ToCurrentWP.Transform(Point1);

           Matrix ToLocal = MatrixFactory.ToCoordinateSystem(Csys2);
           Point2 = ToLocal.Transform(CurrentPoint);
       }
}
See Also