Python for vector files

  • Python
  • Thread starter Avatrin
  • Start date
  • Tags
    python
  • #1
244
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?
 

Answers and Replies

  • #2
12,018
5,664
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.
 
  • #3
244
6
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...?
 
  • #4
phyzguy
Science Advisor
4,598
1,553
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.
 
  • #5
1,627
881
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.
 

Related Threads on Python for vector files

  • Last Post
Replies
1
Views
21K
Replies
3
Views
2K
Replies
9
Views
16K
Replies
2
Views
3K
Replies
4
Views
1K
Replies
2
Views
20K
Replies
18
Views
4K
  • Last Post
Replies
1
Views
1K
Replies
6
Views
4K
  • Last Post
Replies
7
Views
898
Top