[Solved] How to draw a photomask with FreeCAD

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
User avatar
miniellipse
Posts: 101
Joined: Tue Apr 24, 2018 9:09 pm

Re: How to draw a photomask with FreeCAD

Post by miniellipse »

You might also want to try Openscad. It allows 2d shapes to be drawn programmatically and then has a dxf export. Most photomask manufacturers will be very sensitive to how the dxf lines are formed to create enclosed polygons. Problems may arise if you have a donut like shape.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: How to draw a photomask with FreeCAD

Post by uwestoehr »

It turned out that I can draw a sketch, then use Draft Array to make an array of the sketch.
I can can select the draft objects as well as Sketches together, the export a DXF. This works fine and in free programs like:
https://www.opencascade.com/products/cad-assistant/

The DXF looks perfect.

But the mark producers either use old DXF libraries that cannot handle splines in DXF or they require Gerber format.

Since I need letters in the mask I use Draft's ShapeString tool to create them. These letter-like Structures are in fact splines, so they get lost with many DXF libraries.

OK, so I thought, my DXF is valid anyway, no matter if some outdated libraries think it is not. So there must be a way to make a Gerber out of it. But I cannot find a way. I thought at least I make a kind of drawing our of the DXF, fill all polygons and then create a Gerber file, but also failed.

So does anybody know how to convert the DXF I get from FreeCAD to Gerber?
Last edited by uwestoehr on Wed Jul 14, 2021 3:17 pm, edited 1 time in total.
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: How to draw a photomask with FreeCAD

Post by UR_ »

QCAD has some functions to explode DXF's texts and bsplines to simple arcs and lines.

https://ribbonsoft.com/en/download
https://github.com/qcad/qcad

LibreCAD can recode those files to lower level DXF versions, i.e. R12

Screenshot 001.png
Screenshot 001.png (4.63 KiB) Viewed 1332 times

https://sourceforge.net/projects/librec ... ds/master/
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[Solution] Re: How to draw a photomask with FreeCAD

Post by uwestoehr »

It turned out that this was already the solution:
uwestoehr wrote: Wed Jul 14, 2021 12:43 pm It turned out that I can draw a sketch, then use Draft Array to make an array of the sketch.
I can can select the draft objects as well as Sketches together, the export a DXF. This works fine and in free programs like:
https://www.opencascade.com/products/cad-assistant/
The DXF looks perfect.
The nice thing is hereby that every sketch and array object appears in the resulting DXF as separate layer.

The issue I encountered was that old DXF libraries that cannot handle splines in DXF. But OK, programs that cannot handle splines should simply not be used anymore.
(Every outline (TrueType, OpenType) font is based on Bézier curves and therefore using the Shapesting tool (https://wiki.freecadweb.org/Draft_ShapeString) gives you Splines (https://wiki.freecadweb.org/B-Splines) as resulting shape.)

In my case the mask producing company uses a program to create Gerber with a few clicks out of the DXF I sent them. They only had to say that all closed polygons in the DXF should be filled.

To assure that this works, I assured that every sketch and array object I created in FreeCAD could be extruded. Then I know that the resulting DXF polygon is a closed polygon.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: How to draw a photomask with FreeCAD

Post by easyw-fc »

uwestoehr wrote: Wed Jul 14, 2021 12:43 pm So does anybody know how to convert the DXF I get from FreeCAD to Gerber?
even if I've been late, it may help in the future:

1) export your bspline to dxf file
2) import your dxf bspline in kicad pcbnew using Edge.Cut as Layer (this will check closed outline(s)
(I suggest the daily build which handles better bspline and use millimiters if your dxf is in mm)
3) plot the gerber from kicad pcbnew to gerber format
bspline.FCStd
(4.62 KiB) Downloaded 46 times
Bspline-Sketch.dxf
(4.85 KiB) Downloaded 39 times
bspline-daily.kicad_pcb.zip
(1.21 KiB) Downloaded 47 times
bspline-Edge_Cuts.gbr.zip
(1.35 KiB) Downloaded 41 times
EDIT: I changed the kicad & gerber files with the right scale
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: How to draw a photomask with FreeCAD

Post by uwestoehr »

easyw-fc wrote: Thu Jul 15, 2021 7:50 pm it may help in the future:
This does not work for me because my masks need text.

Take for example this FreeCD file:
DXF-Gerber-Test.FCStd
(120.51 KiB) Downloaded 53 times
this is the DXF result I get:
DXF-Gerber-Test.dxf
(149.89 KiB) Downloaded 47 times

But KiCAD 5.1.10 refuses to import the DXF.
User avatar
easyw-fc
Veteran
Posts: 3633
Joined: Thu Jul 09, 2015 9:34 am

Re: How to draw a photomask with FreeCAD

Post by easyw-fc »

uwestoehr wrote: Thu Jul 15, 2021 8:06 pm
This does not work for me because my masks need text.

Take for example this FreeCD file: DXF-Gerber-Test.FCStd

this is the DXF result I get: DXF-Gerber-Test.dxf

But KiCAD 5.1.10 refuses to import the DXF.
kicad 5.99 (daily) can import the text (which is a countour) dxf, but the splines are incorrectly imported.
There should be an issue to rise at gitlab kicad source.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: How to draw a photomask with FreeCAD

Post by uwestoehr »

easyw-fc wrote: Thu Jul 15, 2021 8:18 pm kicad 5.99 (daily) can import the text (which is a countour) dxf, but the splines are incorrectly imported.
There should be an issue to rise at gitlab kicad source.
Since I used KiCAD yesterday for the first time could you please report the error to KiCAD.

Here is a better testcase with text and structures like in my real-life photomask:
DXF-Gerber-Test.FCStd
(47.98 KiB) Downloaded 42 times

and this is the DXF I created out of it and that cannot be imported to KiCAD:
DXF-Gerber-Test.dxf
(148.92 KiB) Downloaded 41 times
Post Reply