CadQuery / CadQuery/cadquery

optimise svg and dxf exports

Open
#1,169 12 comments 0 reactions 0 assignees View on GitHub
dxf question svg
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Here is a basic script that produce a rounded box:

```py
import cadquery as cq
from cadquery import exporters

result = ( cq
.Workplane('XY')
.box(50, 50, 1)
.edges('|Z')
.fillet(10)
)

exporters.export(result, 'test.svg', opt={
'width': 300,
'height': 300,
'marginLeft': 10,
'marginTop': 10,
'showAxes': False,
'projectionDir': (0, 0, 1),
'strokeWidth': 0.1,
'strokeColor': (0, 0, 0),
'hiddenColor': (0, 0, 255),
'showHidden': False
})
```

Only one path is necessary for 2d export, but if we look at the source, we can see that many paths are created:

```xml










```

This can be very annoying when using a cnc or laser cutter, because the tool will make a lot of additional useless movements and wille take much more time to cut the piece.

Here is a simulation of what a machine will do on the exported svg (svg moves are replaced with lines):
![image](https://user-images.githubusercontent.com/1665542/193939895-7df7c065-dfd5-44cd-9e4d-bd55db609d3b.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.