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.

OperationAddToPourUnit Method

Adds model objects as part of a pour unit Model object types accepted are assembly types except cast in situ, reinforcements of different kind, components and bolts

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 AddToPourUnit(
	PourUnit inputPourUnit,
	List<ModelObject> objectsToBeAdded
)

Parameters

inputPourUnit
Type: Tekla.Structures.ModelPourUnit
the instance of pour unit to add objects to.
objectsToBeAdded
Type: System.Collections.GenericListModelObject
the list of model objects to be added.

Return Value

Type: Boolean

[Missing <returns> documentation for "M:Tekla.Structures.Model.Operations.Operation.AddToPourUnit(Tekla.Structures.Model.PourUnit,System.Collections.Generic.List{Tekla.Structures.Model.ModelObject})"]

Exceptions
Exception Condition
ArgumentException Throw exceptions if Pour or object has invalid ID, do not exist in model or not valid object type.
Examples
The following example shows how to add all rebar groups in a model to a pour unit defined by the pour GUID. You will have to replace the curly braces for the List with lesser and greater than signs.
using System.Collections.Generic;
using Tekla.Structures.Model;

public class Example
{
     public void ExampleAddAllRebarGroupsToPour(Guid pourUnitGuid)
     {
            var Model = new Model();

            ModelObjectEnumerator PourEnumerator =
                Model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.POUR_UNIT);

            PourUnit pour = null;

            if(PourEnumerator.GetSize() > 0)
            {
                while(PourEnumerator.MoveNext())
                {
                    var curPour = PourEnumerator.Current as PourUnit;
                    if(curPour != null)
                    {
                        if(curPour.Identifier.GUID == pourUnitGuid)
                        {
                            pour = curPour;
                            break;
                        }
                    }
                }
            }

            if(pour != null)
            {
                var rebarGroupList = new List{ModelObject}();

                ModelObjectEnumerator ObjectEnumerator =
                    Model.GetModelObjectSelector().GetAllObjectsWithType(ModelObject.ModelObjectEnum.REBARGROUP);

                if(ObjectEnumerator.GetSize() > 0)
                {
                    while(ObjectEnumerator.MoveNext())
                    {
                        var rebargroup = ObjectEnumerator.Current as RebarGroup;
                        if(rebargroup != null)
                        {
                            rebarGroupList.Add(rebargroup);
                        }
                    }
                }

                if (rebarGroupList.Count() > 0)
                {
                   try
                   {
                       AddToPourUnit(pour, rebarGroupList);
                   }
                   catch (ArgumentException ex)
                   {
                       var DoSomethingWithThisEx = ex;
                   }
                }
            }
     }
}
See Also