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.108b1.tar.gz (219.3 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.108b1-py3-none-any.whl (767.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: space_gass_api-14.50.108b1.tar.gz
  • Upload date:
  • Size: 219.3 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.108b1.tar.gz
Algorithm Hash digest
SHA256 8933376cf70bf4ae00eb1bccbedeb52f3e2ff8c4e8874a7f986026313839f93a
MD5 54a801187ae1420dcba87f089f462e59
BLAKE2b-256 8f3f8c02d51414c6d987ca70f55ff51e13a9d28f1e4bab3b0c608ea762a6ce42

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for space_gass_api-14.50.108b1-py3-none-any.whl
Algorithm Hash digest
SHA256 64ec04870f66cfd6f627e6b4bf4e996e22b8446a8fb7a39c21a4538f8d4cf29b
MD5 3e16a500a92fb853918b16d084eedce8
BLAKE2b-256 52aa5b65b5d8efb3267bea8c85ef6b24b35f62a0850f6f4ba647394ee47d9dc7

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