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: 2025.0.0-alpha00045580+dc02c3918546f1e94eb2d3b13ea99057fb3313e0
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: ListModelObjectThe model objects with the given identifiers skipping the objects which do not exists or object data loading failed for some reason.
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."); } } } }