API Help
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);

    

 

For more details please refer to Matrix3D description on MSDN webpage. 

 

Mates

There is also possibility to transform a 3D object by snapping it to another by means of auxiliary points which are called "mates". 

There are 2 kinds of mates:

 

 

 

There are 3 types of target mates:

 

 

 

Snapping mates from two object causes that one object is positioned close the second, i.e. a source mate is in position of a target mate. 

Here is an example how to snap a cabinet to another one by a point target mate:

 

C#
Copy Code
Cabinet oCabinet2 = new Cabinet();
oCabinet2.Create(oProject, "TS 8886.500", "1");
//placing a cabinet next to another cabinet with 0.0 offset
oCabinet2.FindSourceMate("V1", false).SnapTo(oCabinet.FindTargetMate("V4", false), 0.0);

 

Here are also examples of snapping to a line and plane mate. They both are base mates - this mean that snapping to them will automatically set a source object as a child of a target. 

Also the orientation of a source item is adjusted to a target :

C#
Copy Code
//get front plane of mounting panel
MountingPanel oMountingPanel = oCabinet.Children[1] as MountingPanel;
Plane oFrontPlace = oCabinet.Planes[0];
//create a mounting rail with a length of 150
MountingRail oRail = new MountingRail();
oRail.Create(oProject, "TS 110_15", "1", 500.0);
//placing a rail by using a plane mate as a target (located 100,200 from start of mounting panel, without any rotation)
oRail.GetSourceMates(false)[2].SnapTo(oFrontPlace.BaseMate, 0.0, 100.0, 200.0);
//creating a terminal
Component oTerminal = new Component();
oTerminal.Create(oProject, "SIE.4AV2400-2EB00-0A", "1");
//placing it on a mounting rail with offset 100 from the beginning of it. Target (oRail.BaseMate) is a line mate.
oTerminal.FindSourceMate("M4", false).SnapTo(oRail.BaseMate, 100.0);

        

 Here are also listed methods for getting mates :

C#
Copy Code
PointMate[] Placement3D::GetSourceMates(bConsiderMountingClearance);
PointMate Placement3D::FindSourceMate(ref System::String name, bool bConsiderMountingClearance);
Mate[] Placement3D::GetTargetMates(bConsiderMountingClearance);
Mate Placement3D::FindTargetMate( ref System::String name, bool bConsiderMountingClearance );