ModelFetchModelObjects Method (ListString, Boolean)

Fetches a list of modelobjects based on given guid list of objects, checks if guid is native or external (for reference model object) 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
public List<ModelObject> FetchModelObjects(
	List<string> Guids,
	bool SelectInstances = true


Type: System.Collections.GenericListString
The GUID 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 guids, or empty list if any of the objects do not exists or object data loading failed for some reason.
Guids of selected model objects are stored to list and fetched using guid list:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Tekla.Structures.Model;
using TSMU = Tekla.Structures.Model.UI;

public class Example
    public void Example1()
        Model model = new Model();

        var selector = new TSMU.ModelObjectSelector();
        var selection = selector.GetSelectedObjects();
        var guidList = new List<string>();

        foreach (ModelObject obj in selection)
            var ro = obj as ReferenceModelObject;
            string guid = string.Empty;
            if (ro != null)
                if(ro.GetReportProperty("EXTERNAL.GUID", ref guid))

        var objList = model.FetchModelObjects(guidList, 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.