How can I create vector images with Python for laser cutting?

  • Context: Python 
  • Thread starter Thread starter Avatrin
  • Start date Start date
  • Tags Tags
    files Python Vector
Click For Summary

Discussion Overview

The discussion revolves around creating vector images using Python for laser cutting applications, specifically focusing on exporting these images as DXF files. Participants explore various methods and tools available for achieving this goal, including the use of SVG format as an intermediary.

Discussion Character

  • Exploratory
  • Technical explanation
  • Homework-related

Main Points Raised

  • One participant inquires about options for creating vector images in Python, noting that Processing only generates raster images.
  • Another participant suggests writing methods in Processing to output vector data in SVG format, which can then be converted to DXF, arguing that this approach is preferable.
  • A participant expresses interest in examples of how to implement the suggested methods, indicating a lack of familiarity with the process.
  • Another participant recommends conducting a Google search for existing Python code related to creating DXF files, implying that there may be resources available that could assist the original poster.
  • A later reply reiterates the original inquiry about creating vector images and provides additional resources, mentioning specific Python libraries for handling DXF and SVG files, as well as the use of Inkscape for creating and exporting these formats.

Areas of Agreement / Disagreement

Participants present multiple approaches to the problem, with no consensus on a single method. Some suggest using SVG as an intermediary, while others mention direct methods for DXF. The discussion remains unresolved regarding the best approach to take.

Contextual Notes

Participants express varying levels of familiarity with the tools and methods discussed, indicating potential limitations in understanding or experience with the suggested approaches.

Who May Find This Useful

This discussion may be useful for individuals interested in using Python for graphic design, particularly those looking to create vector images for laser cutting applications.

Avatrin
Messages
242
Reaction score
6
Hi

I wish to use Python to create art which can be exported as dxf files for use with laser cutters.While Processing is available for Python, it only creates raster images. What are my options if I want to create vector images?

This may be the wrong forum for this question... If it is, where can I go?
 
Technology news on Phys.org
You could write methods in processing that match the graphics methods and which write out vector data to SVG format (ascii text for scalable vector graphics)

https://en.wikipedia.org/wiki/Scalable_Vector_Graphics

From SVG you could convert it to DXF format.

Or you could write matching methods to write the DXF format directly although I think the SVG approach is better.
 
jedishrfu said:
You could write methods in processing that match the graphics methods and which write out vector data to SVG format (ascii text for scalable vector graphics)

https://en.wikipedia.org/wiki/Scalable_Vector_Graphics

From SVG you could convert it to DXF format.

Or you could write matching methods to write the DXF format directly although I think the SVG approach is better.
That sounds good, but I am quite new to this. Do you have any examples showing me how to do this...?
 
I suggest doing a Google search before you write any code. Usually when I want Python code to do something, I do a search and find someone has already written what I want, or written something close that I can easily adapt. I don't know anything about what you're trying to do, but when I did a search on "python create dxf files", I got a bunch of (seemingly relevant) hits.
 
Avatrin said:
Hi

I wish to use Python to create art which can be exported as dxf files for use with laser cutters.While Processing is available for Python, it only creates raster images. What are my options if I want to create vector images?

This may be the wrong forum for this question... If it is, where can I go?
The dxf format is a vector file format, just as svg is.

The Python Software Foundation hosts dxf 1.1.1, and for svg files, svgwrite 1.1.12, and svglib 0.8.1.

You can use inkscape and its extensions (most of which are written in python) to create and edit svg files, and export them as dxf files.
 

Similar threads

Replies
6
Views
3K
Replies
3
Views
3K
Replies
55
Views
7K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K