OperationObjectMatchesToFilter Method (ModelObject, FilterExpression)

Checks whether the object matches to the criteria in the given filter.

Namespace:  Tekla.Structures.Model.Operations
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2023.0.3
Syntax
public static bool ObjectMatchesToFilter(
	ModelObject ModelObject,
	FilterExpression FilterExpression
)

Parameters

ModelObject
Type: Tekla.Structures.ModelModelObject
The model object to check.
FilterExpression
Type: Tekla.Structures.FilteringFilterExpression
The definition of a selection filter to check against.

Return Value

Type: Boolean
True if the object matches to the given filter criteria.
Exceptions
ExceptionCondition
ArgumentExceptionThrown when the ModelObject is not valid.
Examples
In the following example a connection to the Tekla Structures model has already been established. The example code creates a beam to the model and moves the beam one meter in the x and y directions.
using Tekla.Structures.Model;
using Tekla.Structures.Model.Operations;
using Tekla.Structures.Filtering;
using Tekla.Structures.Filtering.Categories;
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.Name = "GetObjectsByFilter";
           if(Beam1.Insert())
           {
               BinaryFilterExpression FilterExpression1 = new BinaryFilterExpression(new PartFilterExpressions.Name(),
                                                              StringOperatorType.IS_EQUAL,
                                                              new StringConstantFilterExpression("GetObjectsByFilter"));
               if(Operation.ObjectMatchesToFilter(Beam1, FilterExpression1))
                   MessageBox.Show("Object matches the filter");
           }
       }
}
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