Tekla Open API: Change View Filters
View filters cannot be directly modified using the Tekla Open API. The only possible option regarding view filters and the API, is to change the current view filter to another view filter from the list of available views filters.
Step 1, Add Libraries:
Add reference to the Tekla.Structures.Model library located in the path “C:Program FilesTekla Structures20.0ntbinplugins” and manually open the tekla model. This has been covered in the article below:
Change View Types:
Using the code below the view filters of all the available views are changed to a view filter with the name “MyNewFilter”
Imports TSM = Tekla.Structures.Model Private Sub ChangeViews() Dim objViewEnum As TSM.UI.ModelViewEnumerator Dim objView As TSM.UI.View objViewEnum = TSM.UI.ViewHandler.GetAllViews While objViewEnum.MoveNext objView = objViewEnum.Current objView.ViewFilter = "MyNewFilter" objView.Modify() End While End Sub
You can download the sample file and code used in this article from the link below: