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
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
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?
 
Physics news on Phys.org
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.