Read a VABS Input File#

Problem Description#

Given a VABS cross-section input file, read it into a structure gene object to inspect mesh statistics and material assignments before running analysis.

Solution#

"""Example: Read VABS Input File

This example demonstrates how to read a VABS input file and inspect
the structure gene data.

The example reads a VABS 4.0 format file for an Euler-Bernoulli beam
cross-section model.
"""
import sgio

# Define the input file path
input_file = 'sg21eb_tri3_vabs40.sg'

# Read the VABS input file
# - file_format='vabs': Specifies VABS format
# - model_type='BM1': Euler-Bernoulli beam model (classical beam theory)
sg = sgio.read(
    input_file,
    file_format='vabs',
    model_type='BM1'
)

# Display basic information about the structure gene
print("=" * 60)
print("VABS Input File Information")
print("=" * 60)
print(f"File: {input_file}")
print(f"Model Type: {sg.model.label if sg.model else 'Not specified'}")
print(f"Number of nodes: {len(sg.mesh.points)}")
print(f"Number of elements: {len(sg.mesh.cells)}")
print(f"Number of materials: {len(sg.materials) if sg.materials else 0}")
print("=" * 60)

# Display the full structure gene object
print("\nFull Structure Gene Object:")
print(sg)

file_format='vabs' selects the VABS reader. model_type='BM1' tells SGIO to interpret the file as an Euler-Bernoulli cross-section. Use 'BM2' for Timoshenko.

Result#

The script prints the node count, element count, material count, and the full structure gene object to the console.

File List#