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.

OperationMoveObject Method (ModelObject, CoordinateSystem, CoordinateSystem)

Moves the model object between the given translation coordinate systems.

Namespace:  Tekla.Structures.Model.Operations
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2018.1.0.0 (2018.1.0.0)
Syntax
public static bool MoveObject(
	ModelObject Object,
	CoordinateSystem StartCoordinateSystem,
	CoordinateSystem EndCoordinateSystem
)

Parameters

Object
Type: Tekla.Structures.ModelModelObject
The model object to move.
StartCoordinateSystem
Type: Tekla.Structures.Geometry3dCoordinateSystem
The coordinate system to move the object from.
EndCoordinateSystem
Type: Tekla.Structures.Geometry3dCoordinateSystem
The coordinate system to move the object to.

Return Value

Type: Boolean
True on success, false on failure.
Remarks

Note that the object is moved and updated in the view so ModelObject.Modify() is not needed. Call Modify() only after the object's data has been updated with the ModelObject.Select() method.

Examples
In the following example a connection to the Tekla Structures model has already been established. The example code creates a beam (Beam3) to the model and moves the beam between the coordinate systems of Beam1 and Beam2.
using Tekla.Structures.Model;
using Tekla.Structures.Model.Operations;
using Tekla.Structures.Geometry3d;
using System.Windows.Forms;

public class Example
{
       public void Example1()
       {
           Beam Beam1 = new Beam(new Point(0, 0, 0), new Point(3000, 0, 0));
           Beam1.Profile.ProfileString = "PL10*140";
           Beam1.Insert();

           Beam Beam2 = new Beam(new Point(3000, 0, 0), new Point(6000, 0, 0));
           Beam2.Profile.ProfileString = "PL10*140";
           Beam2.Insert();

           Beam Beam3 = new Beam(new Point(100, 0, 0), new Point(100, 0, 400));
           Beam3.Profile.ProfileString = "PL10*140";
           Beam3.Insert();

           if(Operation.MoveObject(Beam3, Beam1.GetCoordinateSystem(), Beam2.GetCoordinateSystem()))
               MessageBox.Show("Move succeeded");
       }
}
See Also