Simple Beam Model
This walkthrough demonstrates a complete SPACE GASS API workflow from start to finish: create a project, build a simply-supported beam with section, material, and loads, run a linear static analysis, and retrieve the design results.
What We Will Build
A simply-supported steel beam with self-weight, a dead load and a live load, and ULS / SLS combinations to AS/NZS 1170:
- Node 1 at (0, 0, 0) — fixed support
- Node 2 at (6, 0, 0) — pinned support
- Member 1 between the nodes, using a library section + library material
- Three primary load cases — self-weight, dead, live
- Two combination cases — ULS strength, SLS deflection
- A linear static analysis run, then queries for the maximum ULS bending moment and the SLS midspan deflection
Project Setup
Before you can run this example you need a code editor and the SPACE GASS SDK for your chosen language. If you already have a working .NET or Python environment, skip ahead to Step 1.
We recommend Visual Studio Code — it is free, runs on Windows, macOS, and Linux, and has first-class support for both C# and Python. If you already use Visual Studio, JetBrains Rider, or PyCharm, those work too — the steps below translate directly.
C#
-
Install the .NET 8 SDK and Visual Studio Code.
-
In VS Code, install the C# Dev Kit extension.
-
Pick a folder for your project (anywhere on disk), open it in VS Code via File → Open Folder..., then open the integrated terminal with View → Terminal. In the terminal, run:
Code -
Open
Program.cs(created by the first command) and paste the example code from the steps below. Run it withdotnet run.
Python
-
Install Python 3.10 or newer and Visual Studio Code.
-
In VS Code, install the Python extension.
-
Pick a folder for your project (anywhere on disk), open it in VS Code via File → Open Folder..., then open the integrated terminal with View → Terminal. In the terminal, run:
CodeOn macOS or Linux replace the second line with
source .venv/bin/activate. -
Create a new file called
main.py(File → New File, save with that name in the project folder) and paste the example code from the steps below. Run it withpython main.py.
Step 1 — Create the Client and a New Project
SpaceGassApiClient is your handle to the running API. Every endpoint
follows the same pattern — GetAsync to read, PostAsync to create,
PatchAsync to update, DeleteAsync to remove. See the
Using the SDK guide if these are new.
The API only has one project open at a time. After Job.New (or
Job.Open on an existing .sg file) the new project becomes the
active job — every later call in this walkthrough acts on it until
you Job.Close it in Step 16.
Step 2 — Create Nodes
Create the two endpoints of the beam — Node 1 at the origin and Node 2
six metres along X. POSTing a NodeCreate to Job.Structure.Nodes
returns the saved node including the Id SPACE GASS allocated; hold
onto each Id, every later call that references this node uses it.
Step 3 — Apply Restraints
Restraints are top-level entities — POST a NodeRestraintCreate (with
Node set on the body) to Job.Structure.NodeRestraints. The
6-character RestraintCode maps to the TX, TY, TZ, RX, RY, RZ DOFs.
Each character is one of:
| Code | Meaning |
|---|---|
F | Fixed — prevents movement |
R | Released — allows movement |
S | Spring (movement governed by a spring stiffness) |
V | Variable spring (stiffness-vs-deflection table) |
P | Plastic (upper force / moment limit on the reaction) |
N | Friction (limit proportional to the normal-axis reaction) |
For our beam, Node 1 is fully fixed (FFFFFF — all six DOFs prevented
from moving) and Node 2 is pinned (FFFRRR — translations fixed,
rotations released).
Step 4 — Add a Material
Add the material before the member so its Id is available to assign.
POSTing a MaterialLibraryCreate to Job.Structure.Materials.Library
pulls a standard material from a SPACE GASS library — Library is the
library file name installed with SPACE GASS and Name is the material
designation in that library. (Pass a MaterialCreate to
Job.Structure.Materials directly if you need a fully user-defined
material instead.)
Step 5 — Add a Section
Like the material, create the section before the member so its Id
is available. POSTing a SectionLibraryCreate to
Job.Structure.Sections.Library pulls a standard profile from a SPACE
GASS library — Library is the library file name installed with SPACE
GASS and Name is the section designation in that library.
Step 6 — Create the Member
MemberCreate connects the two nodes with a single member and assigns
the section and material we just made. NodeA / NodeB take the Ids
from Step 2; Section and Material take the Ids returned by Steps 4
and 5.
Step 7 — Create Primary Load Cases
Create three primary cases up front — self-weight, dead, and live — so
their Ids are available when we attach loads in Steps 8–10. POSTing a
LoadCaseCreate to Job.Loads.LoadCases creates a primary case;
combination cases come later in Step 11.
Step 8 — Apply the Self-Weight Load
Attach a self-weight load to the self-weight case. POST a
SelfWeightLoadCreate to Job.Loads.SelfWeightLoads with Case set
on the body — the load case must already exist, and one self-weight
load per case is allowed. Acceleration is expressed in G (multiples
of gravity), so set AccelerationY = -1.0 for one G of gravity
in the negative-Y direction.
Step 9 — Add a Member Distributed Load to the Dead Case
Apply a uniform 2 kN/m downward across the full 6 m span on the dead
case. MemberDistributedLoadCreate takes the target Case and
Member Ids, start / finish positions along the member (in length
units), and start / finish force intensity per unit length on each
axis.
Step 10 — Add a Member Distributed Load to the Live Case
Same shape as Step 9 — swap the Case to the live case and bump the
intensity to 5 kN/m.
Step 11 — Define the ULS and SLS Combinations
A combination case is created in a single call via
Job.Loads.CombinationLoadCases, with the title, Id, and the list of
items (primary case + factor pairs) supplied inline on
CombinationLoadCaseCreate. Below we define ULS (1.2G + 1.5Q) and SLS
short-term (1.0G + 0.7Q) combinations to AS/NZS 1170.
Step 12 — Save the Initial Model
Persist the project to disk before kicking off the analysis. If
something fails downstream, you can open the saved .sg in SPACE GASS
and inspect every entity, load, and combination to confirm the model
is set up the way you expect.
The Save response is a JobStatus whose State.File carries the
file's Path, Name, and Source — useful both as a sanity check
and for any tooling that needs to know where the file landed.
Step 13 — Run a Linear Static Analysis
Analyses are asynchronous in SPACE GASS — when you start one, the
API returns immediately with a run Id and your code keeps going. Before
you can query results you need to wait until the run reaches a terminal
status (Completed, Failed, or Cancelled).
The simplest way is a poll loop, shown below. For longer analyses where you want to display progress, see the Running Analysis guide.
Step 14 — Query Reactions
Read the support reactions under the ULS combination. By default the
query returns every result for every case; the Cases query parameter
filters to the load case(s) you want.
The result also carries a Warnings object. If a requested case (or
any of its constituent primaries, for combinations) has not been
analysed, its Id appears in Warnings.CasesNotAnalyzed — check this
before reading Results so a missing run doesn't silently return zero
rows.
Step 15 — Get the Maximum ULS Bending Moment
Read the peak bending moment along the beam under the ULS combination.
The result is one row per (case, member) combination; force values are
returned as parallel arrays indexed by station, so element [i] of
every array describes the same point along the member:
Code
Filter by ULS case + the member Id and take the maximum of |Mz|.
Step 16 — Get the SLS Midspan Deflection
Read the maximum vertical deflection along the beam under the SLS
combination. MemberIntermediateDisplacement follows the same columnar
shape as Step 14 — one row per (case, member), translations as
parallel arrays indexed by station:
Code
TyGlobal is the global-Y translation at each station; filter by SLS
case + the member Id and take the maximum of |TyGlobal|.
Step 17 — Save and Close
Save persists the project to disk so you can re-open it later from
SPACE GASS. Close ends the active job and releases the file. Run
Job.Close from a finally (C#) or finally-equivalent (Python)
block so the active job is always cleaned up — even if a step above
threw — leaving the service ready for the next run.
Run this example locally
The complete program with error handling is in the repo as
Example.CreateSimpleBeam (C#) and
create_simple_beam (Python).
Clone the repo and run it directly — no copy-paste:
The example saves the model to ~/Desktop/SpaceGass Examples/SimpleBeam.sg so
you can open it in SPACE GASS Desktop and verify the geometry / results
visually.

