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, cutIncrease=5, unCutIncrease=-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.

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.4.tar.gz (14.9 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.4-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tubecutterdxf-0.1.4.tar.gz
  • Upload date:
  • Size: 14.9 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.4.tar.gz
Algorithm Hash digest
SHA256 9f1cd38c2e77243a9f10c974044b787476c171650c1648809f1cf551225e5e2b
MD5 3e59d2a2abae1a63d4d2210fefcc13b0
BLAKE2b-256 789dca8106a215a52668b0796a572bbb7191a61c7722ea6b43763c9344ce14e8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tubecutterdxf-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 23b2a8e474781d1906efbd6371009bad43a7e4dac2d2abc58f8dfead0d548528
MD5 6b9b64e782b3bb956fc078b64524d1b7
BLAKE2b-256 1dd60b58255a643e835fa4b2cfd62d3fc43e3305c5853eceef8d0d19e5ca0186

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