Skip to main content

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 properties (effective models) from VABS/SwiftComp output
  • Read local states (strain/stress/failure) from VABS/SwiftComp output
  • Read generic finite element models (sgio.read_fe_model) for multiscale workflows
  • Merge cross-sections along a span into a single visualization mesh
  • Plot cross-sections and stiffness matrices (matplotlib / plotly / PyVista)
  • Create 1D SG from layup input

Supported Data Formats

  • For complete SG data:
    • VABS, SwiftComp, Abaqus, Gmsh (SG-on-Gmsh bundle)
  • 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

Requires Python >= 3.9.

pip install sgio

The 3D mesh preview and ParaView export helpers need PyVista, which is an optional dependency:

pip install sgio[pyvista]

Option 2: Install from Source

git clone https://github.com/wenbinyugroup/sgio.git
cd sgio
pip install -e .

Or, using uv:

uv sync

Usage

API

Example: Read Beam Properties from VABS Output File

import sgio

model = sgio.read_output_model('my_cross_section.sg.K', 'vabs', 'BM1')

print(model.ea, model.ei22, model.ei33, model.gj)

Example: Convert a Cross-Section from Abaqus to VABS

import sgio

sgio.convert(
    file_name_in='cross-section.inp',
    file_name_out='cross-section.sg',
    file_format_in='abaqus',
    file_format_out='vabs',
    model_type='BM2',
)

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}   Available sub-commands.
    build (b)           Build 1D structural gene.
    convert (c)         Convert CS/SG data file.

options:
  -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] [-a {h,d,fi}]
                    [-d {1,2,3}] [-ms {x,y,z,xy,yz,zx}] [-mry {x,y,z}]
                    [-m {sd1,pl1,pl2,bm1,bm2}] [-mo]
                    input_file output_file

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

options:
  -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
                        CS/SG file format to be read from.
  -ffv, --from-format-version FROM_FORMAT_VERSION
                        CS/SG file format version to be read from.
  -tf, --to-format TO_FORMAT
                        CS/SG file format to be written to.
  -tfv, --to-format-version TO_FORMAT_VERSION
                        CS/SG file format version to be written to.
  -a, --analysis {h,d,fi}
                        Analysis type (h=homogenization, d=dehomogenization,
                        fi=failure).
  -d, --sgdim {1,2,3}   SG dimension (SwiftComp only).
  -ms, --model-space {x,y,z,xy,yz,zx}
                        Model space.
  -mry, --material-ref-y {x,y,z}
                        Axis used as the material reference y-axis.
  -m, --model {sd1,pl1,pl2,bm1,bm2}
                        CS/SG model type.
  -mo, --mesh-only      Mesh only conversion.

Note: Node and element numbering is adjusted automatically to meet the requirements of the target format.

Build 1D SG
usage: sgio build [-h] [--loglevelcmd {debug,info,warning,error,critical}]
                  [--loglevelfile {debug,info,warning,error,critical}]
                  [--logfile LOGFILE]
                  inputfile

positional arguments:
  inputfile             1D SG design input file.

Check out the example examples/convert_abaqus_cs_to_vabs for more details.

License

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

Reference

  1. https://msp.org/jomms/2016/11-4/p03.xhtml ↩

Metadata

Release files for sgio 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sgio 0.9.0
File Size Uploaded
sgio-0.9.0.tar.gz 351.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sgio 0.9.0
File Interpreter ABI Platform
sgio-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 768.4 kB

Release files / sgio-0.9.0.tar.gz

Download URL sgio-0.9.0.tar.gz
Size 351.5 kB
Tags Source
SHA-256 checksum
How to use checksums
959dcc940ece490bb8e1a1ff03b78a5deb8ee92d62e9a64de89bfe6952288aa1
BLAKE2b-256 checksum
How to use checksums
e7465a8c0cabaaed2111688a6627861a409bdc4586a62d463e676909ea0eaeeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release files / sgio-0.9.0-py3-none-any.whl

Download URL sgio-0.9.0-py3-none-any.whl
Size 416.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ddda1ac881f210557c287a6cab7a8b5091a4b3c50398482e38c22c5d39065d23
BLAKE2b-256 checksum
How to use checksums
f23639071f37504411b157ad61d3fa54fd77ab15d8d73b8019cf5e46c7872daa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.4

Release history Release notifications | RSS feed

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

This release

0.9.0 This release

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6

2 release files

0.5

2 release files

0.4

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.14

2 release files

0.2.13

2 release files

0.2.12

2 release files

0.2.11

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page