kirberich / gerber_to_scad Goto Github PK
View Code? Open in Web Editor NEWSimple python script for converting gerber files into a 3d printable solder stencil scad file
License: MIT License
Simple python script for converting gerber files into a 3d printable solder stencil scad file
License: MIT License
Hi,
I have a gerber which fails to load. Can you please have a look?
board.zip
Running Poetry via Python 3.10.9 from PowerShell on Win10, every time I run python main.py (regardless of any flags or input files), I get:
python main.py
Traceback (most recent call last):
File "C:\gerber_to_scad\main.py", line 2, in from gerber_to_scad import process_gerber
File "C:\gerber_to_scad\gerber_to_scad_init_.py", line 1, in from .conversion import process_gerber
File "C:\gerber_to_scad\gerber_to_scad\conversion.py", line 5, in from gerber import primitives
ModuleNotFoundError: No module named 'gerber'
Hi,
I am trying to run this app standalone (without docker/service) but the instructions in the readme doesn't match current repo status.
It would be really appreciated if you could update the readme with the instructions to make this app work at the current status..
best,
rafa
Hi, neat project, wondering if I can use it with KiCAD though. I exported my project and get :
kicad-like-a-pro-3rd-LED-torch-B_Cu.gbl
kicad-like-a-pro-3rd-LED-torch-B_Mask.gbs
kicad-like-a-pro-3rd-LED-torch-B_Paste.gbp
kicad-like-a-pro-3rd-LED-torch-B_Silkscreen.gbo
kicad-like-a-pro-3rd-LED-torch-Edge_Cuts.gm1
kicad-like-a-pro-3rd-LED-torch-F_Cu.gtl
kicad-like-a-pro-3rd-LED-torch-F_Mask.gts
kicad-like-a-pro-3rd-LED-torch-F_Paste.gtp
kicad-like-a-pro-3rd-LED-torch-F_Silkscreen.gto
kicad-like-a-pro-3rd-LED-torch-job.gbrjob
kicad-like-a-pro-3rd-LED-torch-NPTH.drl
kicad-like-a-pro-3rd-LED-torch-PTH.drl
so wondering if something could replace the .gko file in the example.
TypeError: 'NoneType' object is not subscriptable -> gerber_to_scad/gerber_to_scad/conversion.py @ line 290, in V(p[0], p[1])
There seems to be a problem with the Solid Python offset function
offset_points function returns none SolidCode/SolidPython#206
Trying to generate a stencil scad file for gerber output I generated from KiCad 6 using the normal settings I use for JLCPCB. Getting multiple unexpected primitives. First one was AMCommentPrimitive, which I just guessed to be a comment and safely ignorable. For that I added a couple of lines to do a null return for these in conversion.py, but that just got me to the next problem - another unexpected primitive for AMVectorLinePrimitive. I doubt that's something I can just ignore.
The question is, this presumably has already worked for some gerber files that the authors used. Are there particular tools, settings or constraints that I should use when generating my gerber files in order to work with this script? Alternatively, perhaps we need to implement conversions for more primitives. I've attached the edge cuts and front paste layer gerber files in the attached ZIP file.
The changes I made to conversion.py to ignore AMCommentPrimitive primitives are described in the following diff:
diff --git a/gerber_to_scad/conversion.py b/gerber_to_scad/conversion.py
index c981563..02b7ec3 100755
--- a/gerber_to_scad/conversion.py
+++ b/gerber_to_scad/conversion.py
@@ -6,6 +6,7 @@ from gerber import primitives
from gerber.am_statements import (
AMOutlinePrimitive,
AMCenterLinePrimitive,
return
Hey there! Awesome work here.
Is there any possibility to do it with the bottom layer also?
Regards.
I would ike to make use of your software to be able to print solder stencil's for some of my projects. I'm kind of new to using PYTHON on the PC and can't tell from you files, how to specify the source files.
I was able to generate the output files from my Eagle CAD layout using the .cam file you provided; however, once I have the files, I'm not sure how to tell the Python program to use them.
I tried using the online version, but get redirected to an APACHE2 error page.
Thanks for creating this, if I can get it to work, it will be a big help with building my boards.
Robert
got this error while running
/home/matt/Projects/Code/gerber_to_scad/./gerber_to_scad.py:442: DeprecationWarning: 'U' mode is deprecated
outline_file = open(args.outline_file, 'rU')
/home/matt/Projects/Code/gerber_to_scad/./gerber_to_scad.py:443: DeprecationWarning: 'U' mode is deprecated
solderpaste_file = open(args.solderpaste_file, 'rU')
Traceback (most recent call last):
File "/home/matt/Projects/Code/gerber_to_scad/./gerber_to_scad.py", line 449, in
process(
File "/home/matt/Projects/Code/gerber_to_scad/./gerber_to_scad.py", line 383, in process
ledge_shape = offset_shape(outline_shape, 1.2)
File "/home/matt/Projects/Code/gerber_to_scad/./gerber_to_scad.py", line 211, in offset_shape
offset_3d_points = utils.offset_points(
TypeError: offset_points() got an unexpected keyword argument 'inside'
Hi all,
I try to run the script with my *.gm1 and *.gtp gerber files to generate *.stl file for 3D printing.
However, I could not get it runs successfully.
Here is the log:
[Admins-MacBook-Pro:gerber_to_scad-master macOS$ python gerber_to_scad.py lora_dev_usb_poured.GM1 lora_dev_usb_poured.GTP output.stl
Traceback (most recent call last):
File "gerber_to_scad.py", line 392, in
args.increase_hole_size
File "gerber_to_scad.py", line 308, in process
outline_shape = create_outline_shape(outline_file)
File "gerber_to_scad.py", line 183, in create_outline_shape
return convex_hull(outline_vertices)
File "gerber_to_scad.py", line 23, in convex_hull
hull = ConvexHull(points)
File "scipy/spatial/qhull.pyx", line 2379, in scipy.spatial.qhull.ConvexHull.init (scipy/spatial/qhull.c:24005)
IndexError: tuple index out of range
Can anyone tell me how to fix the problem?
Thanks,
HuyK
Dear Rob,
thx for this nice project, I would like to test a stencil from the 3D printer :-).
Anyway, there seems to be a problem with the scad file:
Do you have any advice how to proceed?
I've attached 2 different board files I tried.
Both of them are exported from KiCAD5.
PS: No gbr files in GitHUB -> renamed them to .txt
ble_power_plug_relais_kicad-F.Paste.txt
ble_power_plug_relais_kicad-Edge.Cuts.txt
MPPT_ARM-Edge.Cuts.txt
MPPT_ARM-F.Paste.txt
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.