Suppose you have a Tekla model and you want to programmatically filter for parts
with a revision mark of abc/1
. How would you do that?
- One way would be to iterate through the entire model, check for items which match your condition (perhaps via a LINQ query).
- The second would be to use Tekla’s native filtering metchnicsms, which seem to be FAST:
When I originally tried the code, I had a single Binary Filter expression for just the part Position Number. I made a fatal mistake – I had assumed that Tekla would be smart enough to release that given I want a part position number, I also wanted a part. The API returned almost everything under the sun. And I have no idea why. So then I added a second Binary filter expression – this time one for parts.
Given we have two “filters”, we need to add them into a filter collection, and then finally, when we search, we search by .GetObjectsByFilter(filterCollection)
.
Here is the code:
Leave a Reply