MatrixFactoryRotate Method

Returns a rotation matrix in a Clockwise rotation around the given rotation axis, defined by the given angle and the given rotation axis.

Namespace:  Tekla.Structures.Geometry3d
Assembly:  Tekla.Structures (in Tekla.Structures.dll) Version: 2025.0.0-alpha00045580+dc02c3918546f1e94eb2d3b13ea99057fb3313e0
Syntax
public static Matrix Rotate(
	double Angle,
	Vector Axis
)

Parameters

Angle
Type: SystemDouble
The rotation angle (in radians).
Axis
Type: Tekla.Structures.Geometry3dVector
The rotation axis.

Return Value

Type: Matrix
The new rotation matrix.
Examples
This example rotates a beam StartPoint 45 degrees.
using Tekla.Structures.Geometry3d;
using Tekla.Structures.Model;
using Tekla.Structures.Model.UI;

public class Example
{
       private void RotatePickedBeamStartPoint()
       {
           Model myModel = new Model();
           Picker myPicker = new Picker();
           Beam myBeam = (Beam)myPicker.PickObject(Picker.PickObjectEnum.PICK_ONE_PART, "Pick Beam");
           CoordinateSystem beamCoordSys = myBeam.GetCoordinateSystem();

           Point origin = myBeam.EndPoint;
           Point XPoint = new Point(beamCoordSys.AxisX.X, beamCoordSys.AxisX.Y, beamCoordSys.AxisX.Z);
           Vector Zvector = beamCoordSys.AxisY.Cross(beamCoordSys.AxisX);
           TransformationPlane plane = new TransformationPlane((new CoordinateSystem(origin, beamCoordSys.AxisX, Zvector)));
           myModel.GetWorkPlaneHandler().SetCurrentTransformationPlane(plane);
           myBeam.Select();

           Vector ZVector = new Vector(0, 0, 1);

           double rotationRadian = 0.785398; // 45°
           Matrix matrix = MatrixFactory.Rotate(rotationRadian, ZVector);
           myBeam.StartPoint = matrix.Transform(myBeam.StartPoint);
           myBeam.Modify();
           myModel.CommitChanges();
       }
}
See Also
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next