🤖 New in SPACE GASS 14.51 — the MCP server lets your AI agent build, analyse and design your models. Get started →
SpaceGass API
Recipes

Filter analysis results by load case

Every result endpoint accepts a LoadCases query parameter to restrict the response to a subset of analysed cases. The format is SG's list syntax — comma-separated Ids and dash ranges in a single string:

FilterMeaning
"1"Just case 1
"1,3,7"Cases 1, 3, and 7
"1,3-7,10"Case 1, 3 through 7 inclusive, and 10
"" or omitAll analysed cases

The same format applies to Nodes, Members, Modes, and any other list filter.

The snippet below opens the Portal Frame.SG sample, runs a linear static analysis, then reads node reactions filtered to load case 1. Adjust the case Id to match a case that exists in your model. try / finally closes the job at the end even if a step in the middle throws.

using SpaceGassApi; using SpaceGassApi.Models; var client = SpaceGassApiClient.CreateClient("http://localhost:34560"); try { await client.Job.OpenSample.PostAsync( new OpenSampleRequest { FileName = "Portal Frame.SG" }); var run = await client.Job.Analysis.Static.RunLinear.PostAsync( new StaticSettingsUpdate()); while (true) { await Task.Delay(500); var s = await client.Job.Analysis.Runs[run!.RunId!.Value].GetAsync(); if (s!.Status is RunStatus.Completed or RunStatus.Failed or RunStatus.Cancelled) break; } var reactions = await client.Job.Query.Analysis.Static.NodeReactions.GetAsync( config => config.QueryParameters.LoadCases = "1"); if (reactions!.Warnings?.LoadCasesNotAnalyzed is { Length: > 0 } missing) { throw new Exception($"Cases not analysed: {missing}. Run the analysis first."); } foreach (var r in reactions.Results!) { Console.WriteLine($"Node {r.Node}: Fx={r.Fx:F2}, Fy={r.Fy:F2}, Fz={r.Fz:F2}"); } } finally { await client.Job.Close.PostAsync(); }

Always check Warnings.LoadCasesNotAnalyzed

If you ask for a case that hasn't been analysed (or, for a combination, any of its primary cases), it appears in Warnings.LoadCasesNotAnalyzed and silently returns no rows for that case. Check the warning before reading Results so a missing run doesn't look like clean data.

See also

Last modified on