Eplan Platform API
EPLAN API / User Guide / API DataModel / API Pro Panel / Transformations in 3D space
In This Topic
    Transformations in 3D space
    In This Topic

    Each Placement3D has 2 read-write properties which describes its transformation : 

    Matrix3D Placement3D::AbsoluteTransformation - absolute transformation 

    Matrix3D Placement3D::RelativeTransformation - transformation relative to a parent object 

    The properties are represented by 4x4 transformation matrix : 

     

    M11      M12      M13     M14 

    M21      M22      M23     M24 

    M31      M32      M33     M34 

    OffsetX OffsetY OffsetZ M44 

     

    Here is an example of setting transformation matrix to a 3D object:

    C#
    Copy Code
    Vector3D oVector3D = new Vector3D();
    oVector3D.X = 3.0;
    oVector3D.Y = 4.0;
    oVector3D.Z = 5.0;
    Quaternion oQuaternion = new Quaternion(oVector3D, 2.0);
    Matrix3D oMatrix3D = new Matrix3D();
    oMatrix3D.Rotate(oQuaternion);
    oMatrix3D.Translate(new Vector3D(1.0, 2.0, 3.0));
    oComponent1.AbsoluteTransformation = oMatrix3D;
    

    It is also possible to move 3D object using Move() method :

    C#
    Copy Code
    oComponent1.Move(1.0, 2.0, 3.0);
    

    How to calculate transformation relative to specified 3d object


    Sometimes it is necessary to calculate local transformation. i. e. relative to specified 3d object.
    For example, it could be position of components on a rail from its beginning :

     

    To calculate location of objects origin, there needs to be used .RelativeTransformationOfMacro property :

    C#
    Copy Code
    Matrix3D terminalTransformation = terminal.RelativeTransformationOfMacro;
    var x_coordinate = terminalTransformation.Transform(new Point3D()).X;
    

     Alternative way is to use absolute transformation :

    C#
    Copy Code
    Matrix3D railTransformation = rail.AbsoluteTransformation;
    railTransformation.Invert();
    var x_coordinate = railTransformation.Transform(terminal.AbsoluteTransformation.Transform(new Point3D()))).X;
    

     Rotation angle of 3d object

     It could be also useful to get information how an item was rotated during insertion from “Placement options” dialog :

     

     

    To calculate this rotation, there should be used .RelativeTransformationOfMacro property:

    C#
    Copy Code
    Matrix3D matrix = oPlacement3D.RelativeTransformationOfMacro;
    double oRotationAngleZ = -1 * Math.Atan2(matrix.M21, matrix.M11) * (180.0 / Math.PI);
    

     

    See Also