Skip to main content

Convert 2D polygon cross-sections into 3D STEP files via extrusion

Project description

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

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

stepfg-2.0.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

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

stepfg-2.0.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file stepfg-2.0.0.tar.gz.

File metadata

  • Download URL: stepfg-2.0.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for stepfg-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3f36671488002f57928a911232c4eff2371384e6c0bb6a5ce5bcd5936963f8e2
MD5 a5c524eab88fe414a5ac07b0c149f7f6
BLAKE2b-256 6324a4193d36daad19ebf40df8a9411fd8c9ca0e75cb606eea237b5fae5b2298

See more details on using hashes here.

File details

Details for the file stepfg-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: stepfg-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for stepfg-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e26da05e7fdc24579ab9bfb3092afbbf74dc0c3dc351429e84d4aa9586fa0d03
MD5 6f7c303b162cc0f5f27e8e6d789371d8
BLAKE2b-256 b3663ae159309cff3b60900967fdaa42051aefdd2fc69b711acd33eafbfb495a

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