Filter Class |
The Filter class creates a filter file based on the input FilterExpression object.
Inheritance Hierarchy
Namespace: Tekla.Structures.Filtering
Assembly: Tekla.Structures (in Tekla.Structures.dll) Version: 2023.0.3
Syntax
The Filter type exposes the following members.
Constructors
Name | Description | |
---|---|---|
Filter(FilterExpression) |
Initializes a new instance of the Filter class.
| |
Filter(String, IFormatProvider) |
Initializes a new instance of the Filter class.
|
Properties
Name | Description | |
---|---|---|
FilterExpression |
Gets the current FilterExpression instance.
|
Methods
Name | Description | |
---|---|---|
CreateFile |
Creates a filter and saves it as a text file.
| |
ToString |
Returns the current FilterExpression as a string.
(Overrides ObjectToString.) |
Examples
The following example creates a Tekla Structures object group selection filter file.
The expression generated is the following:
(PartName == BEAM1 OR PartName == BEAM2 OR PartName == BEAM3 OR PartComment StartsWith test)
using System; using System.IO; using Tekla.Structures.Filtering; using Tekla.Structures.Filtering.Categories; public class FilterExample { // Creates a selection filter for the following filter expression: // (PartName == BEAM1 OR PartName == BEAM2 OR PartName == BEAM3 OR PartComment StartsWith test) public void CreateSelectionFilter() { // Creates the filter expressions PartFilterExpressions.Name PartName = new PartFilterExpressions.Name(); StringConstantFilterExpression Beam1 = new StringConstantFilterExpression("BEAM1"); StringConstantFilterExpression Beam2 = new StringConstantFilterExpression("BEAM2"); StringConstantFilterExpression Beam3 = new StringConstantFilterExpression("BEAM3"); // Creates a custom part filter PartFilterExpressions.CustomString PartComment = new PartFilterExpressions.CustomString("Comment"); StringConstantFilterExpression Test = new StringConstantFilterExpression("test"); // Creates the binary filter expressions BinaryFilterExpression Expression1 = new BinaryFilterExpression(PartName, StringOperatorType.IS_EQUAL, Beam1); BinaryFilterExpression Expression2 = new BinaryFilterExpression(PartName, StringOperatorType.IS_EQUAL, Beam2); BinaryFilterExpression Expression3 = new BinaryFilterExpression(PartName, StringOperatorType.IS_EQUAL, Beam3); BinaryFilterExpression Expression4 = new BinaryFilterExpression(PartComment, StringOperatorType.STARTS_WITH, Test); // Creates the binary filter expression collection BinaryFilterExpressionCollection ExpressionCollection = new BinaryFilterExpressionCollection(); ExpressionCollection.Add(new BinaryFilterExpressionItem(Expression1, BinaryFilterOperatorType.BOOLEAN_OR)); ExpressionCollection.Add(new BinaryFilterExpressionItem(Expression2, BinaryFilterOperatorType.BOOLEAN_OR)); ExpressionCollection.Add(new BinaryFilterExpressionItem(Expression3, BinaryFilterOperatorType.BOOLEAN_OR)); ExpressionCollection.Add(new BinaryFilterExpressionItem(Expression4)); string AttributesPath = Path.Combine(@"c:\modelPath", "attributes"); string FilterName = Path.Combine(AttributesPath, "filter"); Filter Filter = new Filter(ExpressionCollection); // Generates the filter file Filter.CreateFile(FilterExpressionFileType.OBJECT_GROUP_SELECTION, FilterName); } }
See Also