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.3.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.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tubecutterdxf-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 a54932d8c2b8866aa9b4940a0ccd43ddc58aaca629c671103f71ee1df1300773
MD5 0b1637a5d730a2a68b3581ccc47d676a
BLAKE2b-256 dcdc1a7b667b8950db6c38101613c13ed9ca9eaf836b6c40382cff61299dc32d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tubecutterdxf-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 25c8608d3f99285464776c4b4b2cb1a496250fb9b904ae01f37fe9bbeef44f1d
MD5 69ac525bb584ffc963551c1a1c817cc1
BLAKE2b-256 8b98eeeb3a96ffb160be9aa787fa60c3fd020fd92a0dae873c9e673fc05f6d62

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