Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

space-gass-api

Official Python SDK for the SPACE GASS API.

The SPACE GASS API gives you programmatic access to SPACE GASS structural analysis — open or create job files, build and edit structural models, run analyses, and query results. The API runs as a local service on your machine with no authentication.

Install

pip install space-gass-api
  • Python 3.9+
  • SPACE GASS 14.5 or later installed with an active licence
  • The SPACE GASS API service running locally (default: http://localhost:34560)

Quick start

import asyncio
from space_gass_api import SpaceGassApiClient
import space_gass_api.models as models

async def main():
    client = SpaceGassApiClient.create_client()   # no auth; defaults to http://localhost:34560

    try:
        # Open a built-in sample project
        await client.job.open_sample.post(
            models.OpenSampleRequest(file_name="Portal Frame.SG"))

        # List all nodes in the model
        nodes = await client.job.structure.nodes.get()
        for n in nodes:
            print(f"Node {n.id}: ({n.x}, {n.y}, {n.z})")
    finally:
        await client.job.close.post()             # always release the active job

asyncio.run(main())

Run an analysis and query results

import asyncio
from space_gass_api import SpaceGassApiClient
import space_gass_api.models as models

async def main():
    client = SpaceGassApiClient.create_client()

    try:
        await client.job.open.post(
            models.OpenJobRequest(file_path=r"C:\Models\MyProject.sg"))

        # Analyses are asynchronous: start a run, then poll for completion.
        run = await client.job.analysis.static.run_linear.post(
            models.StaticSettingsUpdate())

        while True:
            await asyncio.sleep(0.5)
            result = await client.job.analysis.runs.by_run_id(str(run.run_id)).get()
            if result.status in (
                models.AnalysisRunStatus.Completed,
                models.AnalysisRunStatus.Failed,
                models.AnalysisRunStatus.Cancelled,
            ):
                break

        # Query node reactions
        reactions = await client.job.query.analysis.static.node_reactions.get()
        for r in reactions.results:
            print(f"Node {r.node}, LC {r.load_case}: Fy={r.fy:.2f} kN")
    finally:
        await client.job.close.post()

asyncio.run(main())

How this SDK is structured

Most of this SDK is generated from the OpenAPI specification with Microsoft Kiota. Every endpoint is a fluent builder chain that ends in the HTTP verbawait client.job.structure.nodes.get(), ...post(body), ...patch(body), ...delete(). Path parameters use .by_*() selectors (e.g. client.job.analysis.runs.by_run_id(run_id)). If an endpoint isn't shown in these examples, the same pattern applies — browse the API Reference.

On top of the generated client, a few hand-written conveniences (below) smooth the rough edges. Everything not listed there is standard Kiota.

Conveniences on top of Kiota

SpaceGassApiClient.create_client(base_url=...) — one-line factory. Configures anonymous auth, appends /api/v1 to the base URL, disables SSL verification (the local service may use a self-signed certificate), allows HTTP↔HTTPS redirects, and sets a long timeout for analyses. Pass base_url only if the service runs on a non-default port (use https:// for HTTPS).

Keyword query parameters on .get() — pass query parameters directly instead of the verbose RequestConfiguration pattern. Names are the snake_case query fields; invalid names raise TypeError. Fully type-stubbed, so IDE autocomplete works.

# Keyword form (enhanced)
nodes = await client.job.structure.nodes.get(
    node_type=models.NodeTypeFilter.Restrained)
reactions = await client.job.query.analysis.static.node_reactions.get(
    cases="1,3-7", nodes="10-12")     # ID-list filters use the SG format "1,3-7,10"

# Verbose form (still supported for advanced use)
from kiota_abstractions.base_request_configuration import RequestConfiguration
from space_gass_api.generated.job.structure.nodes.nodes_request_builder import (
    NodesRequestBuilder,
)
qp = NodesRequestBuilder.NodesRequestBuilderGetQueryParameters(
    node_type=models.NodeTypeFilter.Restrained)
nodes = await client.job.structure.nodes.get(
    request_configuration=RequestConfiguration(query_parameters=qp))

File uploads by pathNewFromTemplateRequest / ImportTxtRequest wrap the multipart upload endpoints so you can pass a file path directly:

from space_gass_api import NewFromTemplateRequest, ImportTxtRequest

await client.job.new_from_template.post(NewFromTemplateRequest("design.sgbase"))
await client.job.import_.txt.post(ImportTxtRequest("model.txt"))

Using with an AI assistant

Writing scripts with an AI coding agent? Point it at these single, machine-readable entry points rather than letting it crawl the source repo:

Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

space_gass_api-14.50.151b1.tar.gz (259.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

space_gass_api-14.50.151b1-py3-none-any.whl (885.3 kB view details)

Uploaded Python 3

File details

Details for the file space_gass_api-14.50.151b1.tar.gz.

File metadata

  • Download URL: space_gass_api-14.50.151b1.tar.gz
  • Upload date:
  • Size: 259.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for space_gass_api-14.50.151b1.tar.gz
Algorithm Hash digest
SHA256 626c765292376f8c3ff3ea5d873d71344f4f66b1e0afc71ce647431b32198ec5
MD5 1355dc22f21d03f16217d1cc63c16752
BLAKE2b-256 5d6169615b46ed8fce60ef08fdb34f3eac2b1d2834b43048c6b6191bab9f56d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for space_gass_api-14.50.151b1.tar.gz:

Publisher: publish-api-nuget.yml on SpaceGass/SPACEGASS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file space_gass_api-14.50.151b1-py3-none-any.whl.

File metadata

File hashes

Hashes for space_gass_api-14.50.151b1-py3-none-any.whl
Algorithm Hash digest
SHA256 429df01296a807992a64619f16ebde5aa038552ab0d32b2a068bb3f155565bbf
MD5 30e03ae5a8b5c3da66279a0ac2a179c3
BLAKE2b-256 1cfb752ea597be1aba95a132845a2d47ecf3e6b28ed8693b0776352a078e3d7a

See more details on using hashes here.

Provenance

The following attestation bundles were made for space_gass_api-14.50.151b1-py3-none-any.whl:

Publisher: publish-api-nuget.yml on SpaceGass/SPACEGASS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

14.50.164

2 files

14.50.161

2 files

14.50.160

2 files

14.50.159

2 files

14.50.155

2 files

This release

14.50.151b1 This release

2 files

14.50.142

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page