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

Run a linear static analysis

Analysis is asynchronous — POST /run-linear starts it and returns a runId immediately, then you poll GET /runs/{runId} until the status reaches a terminal state (Completed, Failed, or Cancelled).

The snippet below opens your project, runs analysis with the current settings, polls every half-second, and prints a one-line summary on completion. The empty StaticSettingsUpdate() body means "use whatever settings the job already has" — pass non-null fields to override, including a selection of the load cases and combinations you would like to run.

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 status = await client.Job.Analysis.Runs[run!.RunId!.Value].GetAsync(); if (status!.Status is RunStatus.Completed or RunStatus.Failed or RunStatus.Cancelled) { Console.WriteLine($"{status.Status} in {status.ElapsedTime}"); break; } } } finally { await client.Job.Close.PostAsync(); }

Run this example locally

A richer version with progress polling, a reusable WaitForCompletion helper, and a result summary is in the repo as Example.RunAnalysis (C#) and run_analysis (Python). Clone and run:

git clone https://github.com/SpaceGass/space-gass-api.git cd space-gass-api/sdks/csharp/examples/Example.RunAnalysis dotnet run

Edit the example's project_file_path constant first to point at a .sg file with structure and loads defined.

See also

Last modified on