Skip to main content

Official Python SDK for the SPACE GASS API.

Project description

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 required.

Compatibility

  • Python 3.9+

Prerequisites

  • SPACE GASS 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()

    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})")

        # List all members
        members = await client.job.structure.members.get()
        for m in members:
            print(f"Member {m.id}: Node {m.node_a} -> Node {m.node_b}")
    finally:
        await client.job.close.post()

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_name=r"C:\Models\MyProject.sg"))

        # Run a linear static analysis with current settings
        run = await client.job.analysis.static.run_linear.post(
            models.StaticSettingsUpdate())

        # Poll until complete
        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())

Enhanced .get() with keyword arguments

The SDK enhances Kiota-generated .get() methods so you can pass query parameters as keyword arguments directly instead of the verbose RequestConfiguration pattern:

# Simple — keyword arguments
nodes = await client.job.structure.nodes.get(
    node_type=models.NodeTypeFilter.Restrained)

# Verbose — also supported for advanced use cases
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))

Keyword argument names match the snake_case field names on the builder's query parameters (e.g. node_type, limit, offset, min_x). Invalid names raise TypeError with a clear message.

Documentation

Project details


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.134b1.tar.gz (254.2 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.134b1-py3-none-any.whl (878.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: space_gass_api-14.50.134b1.tar.gz
  • Upload date:
  • Size: 254.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for space_gass_api-14.50.134b1.tar.gz
Algorithm Hash digest
SHA256 f14c3275ae84e05d749da572cb6566919e26645c3c5f24ad834c37e02ec6f17e
MD5 29ddc77577fd0013a0dffcb005f1a33f
BLAKE2b-256 1204abd401163145ba34771dd22e8332f1eeaa64bc7477526c606e827698635f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for space_gass_api-14.50.134b1-py3-none-any.whl
Algorithm Hash digest
SHA256 5b03407bf039f0dce76d090012b6e4ca3dd2aeeb2b2b84e319d8397fe941d1fe
MD5 371d2f799b4412710808fe71ea603fb0
BLAKE2b-256 47afb4ff3a00af9b2a9c394ea72e5c6705ad671ec892322fe17dab79ed55ccb8

See more details on using hashes here.

Supported by

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