Click or drag to resize

Tips and tricks

[This is preliminary documentation and is subject to change.]

On this page we'll outline some tips and tricks that could come in handy when integrating with the ADM

Code snippets

A common use-case is that you'll want to retrieve all objects of a certain type from an AnalysisModel
This can be achieved by using LINQ queries, because the model implements IEnumerable and as such, can be treated as a collection.

Querying the model with LINQ
AnalysisModel model = new AnalysisModel();

// Get all nodes from the model
StructuralPointConnection[] nodesFromModel = model.OfType<StructuralPointConnection>().ToArray();

// Find a material by name, will be NULL when not found
StructuralMaterial material = model.OfType<StructuralMaterial>().FirstOrDefault(x => x.Name == "MyNodeName");

// Creating a lookup dictionary for all beams in a model by name
Dictionary<string, StructuralCurveMember> beamsLookup = model.OfType<StructuralCurveMember>().ToDictionary(x => x.Name);