API Reference

Detailed and full API reference helps you master Tekla development

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

Meta.Microsoft.Help.Id
M:Tekla.Structures.Model.Operations.Operation.CopyObject(Tekla.Structures.Model.ModelObject,Tekla.Structures.Geometry3d.CoordinateSystem,Tekla.Structures.Geometry3d.CoordinateSystem)

OperationCopyObject Method (ModelObject, CoordinateSystem, CoordinateSystem)

Copies the model object between the given translation coordinate systems.

Namespace:  Tekla.Structures.Model.Operations
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2020.0.0.0 (2020.0.55582.0)
Syntax
public static ModelObject CopyObject(
	ModelObject Object,
	CoordinateSystem StartCoordinateSystem,
	CoordinateSystem EndCoordinateSystem
)

Parameters

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

Return Value

Type: ModelObject
The copied model object on success, null on failure.
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 copies 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();

           Beam Beam4 = Operation.CopyObject(Beam3, Beam1.GetCoordinateSystem(), Beam2.GetCoordinateSystem()) as Beam;
           if(Beam4 != null)
               MessageBox.Show("Copy succeeded");
       }
}
See Also