I’m currently building a project (keyboard) where there is data from the PCB editor (User layer) that I export to DXF to import it into FreeCAD to generate a mechanical part from this data.
I ran into the problem, that many of the hundreds generated ARCs do not end exactly where the LINEs end. The mismatch is ever so tiny but FreeCAD refuses to accept this as a closed path.
When opening the generated DXF e.g. in LibreCAD and zooming in there are sub-micrometer gaps.
Re: Plugin’s
• Many posts on Plugin’s topic. Here’s a link to my video on making one and, be sure to click the ‘Show more’ to access the Link to official plugin info to learn what you need to know about Kicad Plugins
Re: DXF
• There are differences in the Codes that handle DXF so, the programs you use (LibreCAD, FreeCAD…etc) may do different management things.
I recommend you explore and test settings in FreeCAD/Libre and Kicad - then you’ll know how to Fish, as opposed to just eating Fish someone gave you. And, there are many posts on DXF’s and Kicad…
• Kicad plugins can use various GUI’s and success depends on what, and how, you do it and I’ve gotten many of them to work in Kicad plugins
• For the GUI Windows, Dialogs/Panels in the plugin’s, you can use basically what you want if you create full GUI code for them. The Kicad default is ‘wx’.
If I need only Message/Info, I use wx (see the Link above).
If I need Panels/Windows, I generally prefer to use wxFormBuilder to make them and create a Stand-Alone App using PyInstaller and call/run the App from the Plugin.
If you look at this link, you’ll see how to get Stand-Alone App’s to run for different OP SYS’s
However, since I could also read the generated DXF with ezdxf in Python and could calculate the difference between endpoints it looks definitely that Kicad does not produce valid output. Maybe it has something to do with rounding errors and how arcs are calculated.
Because after running the script over the DXF and using this as input for FreeCAD I was able to produce the expected result.
Therefore, I opened a bug report with Kicad to get this rectified.
I think it has far more to do with your Preference’s settings. I use the word ‘think’ but, the fact is that with the proper settings in Kicad and FreeCAD, you won’t need ‘ezdxf’ but, naturally, use whatever you like and works for you…
Follow-Up:
Many users like to use the KSU-StepUP plugin. It makes it easy to load Kicad PCB’s and get the correct board shape without fussing… And, naturally, can load the other Layers with geometries… Example below…
The PCB as-is in Kicad Note: I show I created some DXF’s but not using them in this video…
The thing is: not all connections are bad. But if you have hundreds of them, some seem not to fit. And then try to find and fix them all by hand is impossible.
It seems to depend on slope of the line and start/end angle of the arc and the position relative to the underlying grid.
Arcs with 0°, 90° steps seem not to be affected too much even if the ends do not overlap exactly in the generated DXF.
If the lines+arcs are converted to a polygone (pcbnew–>context-menu–>create polygon from selection) than we get a closed path in the dxf. original + workaround (dxf included in project archive): dxf_unconnected_complete_project.zip (5.9 KB)
It doesn’t matter if using StepUp or Not using StepUp, it’s all about the Pref’s settings in both Kicad and FreeCAD and understanding what setting’s to use/change for specific Output’s…
FYI - I’m using Kicad 6.0.11, on Mac and FreeCAD 20.2
Video below shows various angles of the Boxes with Radius’d corners. Zero problems importing into FreeCAD and this time, I did Not use StepUp.
No DRC Errors or Warnings
Finishing-up my input… No problem with Arc’s of any Angle…