Skip to main content

I/O for VABS and SwiftComp

Project description

SGIO

Structure Gene (SG) I/O

Python package interfacing VABS and SwiftComp. The package is developed based on meshio, which is used for converting meshing data.

Features

The package can be used to:

  • Read/write SG data from/to different formats
  • Convert SG/mesh data between different formats
  • Read structural property from VABS/SwiftComp output
  • Create 1D SG from layup input

Supported Data Formats

  • For complete SG data:
    • VABS, SwiftComp, Abaqus
  • For mesh data only:
    • All formats supported by meshio

A structure gene (SG) is defined as the smallest mathematical building block of a structure.^1 A cross-section (CS) is a type of 2D SG.

Online documentation

Installation

Option 1: Install via pip (Recommended)

pip install sgio

Option 2: Standalone Executable (No Python Required)

Download and use the pre-built standalone executable that requires no Python installation:

  1. Download the latest executable from the releases page
  2. Run directly from command line:
    # Windows
    sgio.exe --help
    
    # Linux/macOS
    ./sgio --help
    

Option 3: Build Your Own Executable

Build a standalone executable from source:

# Windows
build_executable.bat

# Linux/macOS
./build_executable.sh

# Or manually
python build_executable.py

See BUILD_EXECUTABLE.md for detailed instructions.

Option 4: Manual Installation

  1. Download the package.
  2. Install dependencies:
    pip install -r <INSTALL_DIR>/sgio/requirements.txt
    
  3. Configure environment variables:
    • Add the package root directory to PYTHONPATH.
    • Add <INSTALL_DIR>/sgio/bin to PATH.

Usage

Logging Configuration

SGIO uses Python's standard logging with Rich formatting. Configure logging to capture detailed information:

Basic Setup (Single Package)

import sgio

# Configure SGIO logging
sgio.configure_logging(
    cout_level='INFO',      # Console output level
    fout_level='DEBUG',     # File output level  
    filename='run.log'      # Log file path
)

# Use SGIO - logs appear automatically
model = sgio.readOutputModel('file.sg.k', 'vabs', 'BM1')

Multi-Package Applications

For applications using SGIO with other packages, configure the root logger to capture all logs in one place:

import logging
from rich.logging import RichHandler

# Configure root logger BEFORE importing packages
root = logging.getLogger()
root.setLevel(logging.DEBUG)
root.addHandler(RichHandler())
root.addHandler(logging.FileHandler('run.log'))

# Now import packages - their logs will be captured
import sgio
import numpy as np

# All logs go to run.log
sgio.logger.info("Analysis starting...")

See the Logging Guide for detailed configuration options, filtering third-party packages, and advanced patterns.

API

Example: Read Beam Properties from VABS Output File

import sgio

model = sgio.readOutputModel('my_cross_section.sg.k', 'vabs', 'BM1')

Command Line Interface

Example: Convert Cross-Sectional Data from Abaqus (.inp) to VABS Input

Suppose a cross-section has been built in Abaqus and output to cross-section.inp. To convert the data to the VABS input (Timoshenko model) cross-section.sg:

python -m sgio convert cross-section.inp cross-section.sg -ff abaqus -tf vabs -m bm2

Complete Options

usage: sgio [-h] [-v] {build,b,convert,c} ...

I/O library for VABS (cross-section) and SwiftComp (structural gene)

positional arguments:
  {build,b,convert,c}  sub-command help
    build (b)          Build 1D SG
    convert (c)        Convert CS/SG data file

optional arguments:
  -h, --help           show this help message and exit
  -v, --version        Show version number and exit
Convert SG Data
usage: sgio convert [-h] [--loglevelcmd {debug,info,warning,error,critical}]
                    [--loglevelfile {debug,info,warning,error,critical}] [--logfile LOGFILE]      
                    [-ff FROM_FORMAT] [-ffv FROM_FORMAT_VERSION] [-tf TO_FORMAT]
                    [-tfv TO_FORMAT_VERSION] [-d {1,2,3}] [-ms {x,y,z,xy,yz,zx}] [-mry {x,y,z}]   
                    [-m {sd1,pl1,pl2,bm1,bm2}] [-mo] [-re]
                    from to

positional arguments:
  from                  CS/SG file to be read from
  to                    CS/SG file to be written to

optional arguments:
  -h, --help            show this help message and exit
  --loglevelcmd {debug,info,warning,error,critical}
                        Command line logging level
  --loglevelfile {debug,info,warning,error,critical}
                        File logging level
  --logfile LOGFILE     Logging file name
  -ff FROM_FORMAT, --from-format FROM_FORMAT
                        CS/SG file format to be read from
  -ffv FROM_FORMAT_VERSION, --from-format-version FROM_FORMAT_VERSION
                        CS/SG file format version to be read from
  -tf TO_FORMAT, --to-format TO_FORMAT
                        CS/SG file format to be written to
  -tfv TO_FORMAT_VERSION, --to-format-version TO_FORMAT_VERSION
                        CS/SG file format version to be written to
  -d {1,2,3}, --sgdim {1,2,3}
                        SG dimension (SwiftComp only)
  -ms {x,y,z,xy,yz,zx}, --model-space {x,y,z,xy,yz,zx}
                        Model space
  -mry {x,y,z}, --material-ref-y {x,y,z}
                        Axis used as the material reference y-axis
  -m {sd1,pl1,pl2,bm1,bm2}, --model {sd1,pl1,pl2,bm1,bm2}
                        CS/SG model
  -mo, --mesh-only      Mesh only conversion
  -re, --renumber-elements
                        Renumber elements

Check out the example examples/convert_cs_from_abaqus_to_vabs for more details.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Reference

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

sgio-0.4.tar.gz (438.0 kB view details)

Uploaded Source

Built Distribution

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

sgio-0.4-py3-none-any.whl (559.2 kB view details)

Uploaded Python 3

File details

Details for the file sgio-0.4.tar.gz.

File metadata

  • Download URL: sgio-0.4.tar.gz
  • Upload date:
  • Size: 438.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for sgio-0.4.tar.gz
Algorithm Hash digest
SHA256 2c82e788fc8ecf9e1ada2225120ecde8de3b742bb47d41b6f25538a39cace4e1
MD5 c0e302a9ddb4c4769d480eee136dcf67
BLAKE2b-256 64d5c01ee0abd7b7efb8f8e4c783deb34a06a7b92211948a3eafb67b8148d9a6

See more details on using hashes here.

File details

Details for the file sgio-0.4-py3-none-any.whl.

File metadata

  • Download URL: sgio-0.4-py3-none-any.whl
  • Upload date:
  • Size: 559.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for sgio-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dcacd353e4a06d5d7b66e55216a3a8a27f29a0517e197a7b1f1a6f652fe92083
MD5 ebce6431eb23337c5ba8eb98850c50c2
BLAKE2b-256 794c09e891fda8693d4ee46f57a5365b7de420384056088a716c77df49dd5ad7

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