ModelFetchModelObjects Method (ListIdentifier, Boolean)

Fetches a list of modelobjects based on given identifier list of objects, and optionally selects objects before returning them.

Namespace:  Tekla.Structures.Model
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63
Syntax
public List<ModelObject> FetchModelObjects(
	List<Identifier> Ids,
	bool SelectInstances = true
)

Parameters

Ids
Type: System.Collections.GenericListIdentifier
The identifier list to look for in the model.
SelectInstances (Optional)
Type: SystemBoolean
Optional parameter whether object is selected, default = true.

Return Value

Type: ListModelObject
The model objects with the given identifiers skipping the objects which do not exists or object data loading failed for some reason.
Examples
Identifiers of selected model objects are stored to list and fetched using list:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tekla.Structures.Drawings;
using Tekla.Structures.Model;

public class Example
{
    public void Example1()
    {
        // open document manager instance
        DrawingHandler DrawingHandler = new DrawingHandler();
        var drawingEnumerator = DrawingHandler.GetDrawings();
        while (drawingEnumerator.MoveNext())
        {
             Drawing drawing = dEnumerator.Current as Drawing;
             if (drawing != null)
             {
                 // get model objects identifiers from the drawing
                 var idList = DrawingHandler.GetModelObjectIdentifiers(drawing);

                 // fetch model objects in the drawing
                 Model model = new Model();
                 var objList = model.FetchModelObjects(idList, false);
                 MessageBox.Show(objList.Count.ToString() + " objects found.");
             }
        }
    }
}
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