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: 2023.0.3
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
Exceptions
ExceptionCondition
ArgumentExceptionThrow 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
Was this helpful?
The feedback you give here is not visible to other users. We use your comments to improve the content.
Previous
Next