Skip to main content

stepfg: STEP File Generator

Python 3.8+ | Zero dependencies | MIT License

Authors: E. Valetov and M. Berz Organization: Michigan State University Creation date: 03-Feb-2017

Introduction

stepfg converts lists of 2D polygons (specified by vertices in the x-y plane) into 3D STEP files (ISO 10303-242) by extruding the polygon interiors along the z-axis. Pure Python, no external dependencies.

Installation

pip install stepfg

Or from source:

git clone https://github.com/evvaletov/stepfg.git
cd stepfg
pip install -e .

Library usage

from stepfg import StepBuilder, generate_step

# Quick one-liner
content = generate_step(
    polygons=[[[0, 0], [1, 0], [1, 1], [0, 1]]],
    z_range=[0, 10],
    scale=1,
)

# Or use StepBuilder for more control
builder = StepBuilder('output.stp')
builder.generate_assembly(
    list_vert_list=[[[0, 0], [1, 0], [1, 1], [0, 1]]],
    geom_depth_list=[0, 10],
    p_coeff=1,
)
builder.to_file('output.stp')

Command-line usage

stepfg [input_file [output_file]]
python -m stepfg [input_file [output_file]]

Run with the included sample geometry (a Muon g-2 quadrupole):

stepfg part_geometry.txt quadrupole.stp

Input file format

The input file is a Python literal containing three elements:

[polygons, z_range, scale]
  • polygons: [[vertex, ...], ...] — each vertex is [x, y] or [x, y, 0]
  • z_range: [z1, z2] — extrusion interval
  • scale: proportionality coefficient (output is in mm; use 10 for cm input)

A sample input file part_geometry.txt containing a Muon g-2 Collaboration quadrupole cross-section is included.

Copyright Notice

© 2017 Eremey Valetov and Martin Berz

Release files for stepfg 2.0.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 stepfg 2.0.0
File Size Uploaded
stepfg-2.0.0.tar.gz 10.6 kB Details

Built distribution (wheel)

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

Total release size: 20.5 kB

Release files / stepfg-2.0.0.tar.gz

Download URL stepfg-2.0.0.tar.gz
Size 10.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3f36671488002f57928a911232c4eff2371384e6c0bb6a5ce5bcd5936963f8e2
BLAKE2b-256 checksum
How to use checksums
6324a4193d36daad19ebf40df8a9411fd8c9ca0e75cb606eea237b5fae5b2298
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / stepfg-2.0.0-py3-none-any.whl

Download URL stepfg-2.0.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e26da05e7fdc24579ab9bfb3092afbbf74dc0c3dc351429e84d4aa9586fa0d03
BLAKE2b-256 checksum
How to use checksums
b3663ae159309cff3b60900967fdaa42051aefdd2fc69b711acd33eafbfb495a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

2.0.0 This release

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