Skip to main content

Programmatically create Spiral and Brickwork patterns for laser cutting tubing

Project description

TubeCutterDXF

Programmatically create Spiral and Brickwork style patterns for rotary laser cutting tubing.

Creating a Pattern

from tubecutterdxf import CutPattern, CutBrick, CutSpiral, CutPartline, INCH

def newCutPattern():
    # Create the pattern container.  This stores the geometry and will help produce the DXF
    pattern = CutPattern()

    # Specify some general parameters
    OD = 1
    continuous = False # Change to True when ready to send to laser cutter

    # Define the cut pattern
    # Parting line at x = 0
    cutPartline = CutPartline(OD)
    # Spiral starting at x = 0.1in with 30deg cut followed by 10deg uncut repeating 5 times at a pitch of 0.1in with each cut increasing by 5deg and uncut portion decreasing by 5deg for each repetition.
    cutSpiral = CutSpiral(OD, 0.1 * INCH, 0, 30, 10, 0.1 * INCH, 5, variableCutLength=True, 5, -5, continuous=continuous)
    # Brick starting where cutSpiral left off with 3 90deg cuts equally spaced circumferentially and repeated 5 times with a pitch of 0.1in and each repetition offset by 45deg from the prior.  No variation in cut length.
    cutBrick = CutBrick(OD, cutSpiral.xNext, 0, 90, 3, 45, 0.1 * INCH, 5)
    
    # Add the cuts to the pattern container
    pattern.add(cutPartline)
    pattern.add(cutSpiral)
    pattern.add(cutBrick)

    # Preview the pattern in an interactive graph
    pattern.preview()

    # List the cuts added and remove any by their cut #
    pattern.printCutTable()
    pattern.remove(1)

    # Draw and Save the pattern to a file in the 'output' folder: this saves the .dxf and a .json config file
    pattern.draw()
    pattern.save("newCutPattern")

Getting Started

Create a python virtual environment. If you don't know what this is, Google "venv", it may change your life.

Install the required packages

> pip install -r requirements.txt

Create a directory called "output" (I could do this for you in the code... but I don't want to)

> mkdir ./output

Now you're ready to go back up to Creating a Pattern!

Liability Release :)

This code has bugs, for one. For another, be warned, if you are trying to make super small cuts you will run into floating point errors and anomalies due to the nature of how computers represent numbers. This mainly affects non-continuous cut patterns due to the overflow calculation when a cut wraps beyond the circumference; most of these errors are avoided when you create a continuous cut pattern, which most rotary laser cutters prefer anyways!

Feel free to post any bugs or requests for improvements via Issues.

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

tubecutterdxf-0.1.2.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

tubecutterdxf-0.1.2-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file tubecutterdxf-0.1.2.tar.gz.

File metadata

  • Download URL: tubecutterdxf-0.1.2.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tubecutterdxf-0.1.2.tar.gz
Algorithm Hash digest
SHA256 de6a1411a6f9f16d9ba3493ed9debc51ceb0bdae3626b4206e3d33d9d4eb9ba6
MD5 32a3fcdf1ba794b0d13169019c74e907
BLAKE2b-256 640131de8ff875c7ff45266dd0a43bd7bac54d8cb2d8eb3e120c5c9581ab3531

See more details on using hashes here.

File details

Details for the file tubecutterdxf-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: tubecutterdxf-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for tubecutterdxf-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a424a1bfb71dfff1dce28cd776da88f27c28fe16400cba1e10f99cd2dc5eaa2
MD5 657fb5b6cfd5138748e0f14030bcac1c
BLAKE2b-256 6a5d66ea6435e82f754681738e2f5c3f0e2b0cf0798013076e532c6c1da962aa

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