Edge.Cuts error

I am encountering an error when attempting to export a PCB to STEP file. The export throws an error

Error: Unable to create STEP file. Check that the board has a valid outline and models.

if the Edge.Cuts layer includes any arc segments. I have tested a simplified Edge.Cuts layer using KiCAD version 5.1.0-386-g7ed01aa4f to demonstrate the problem. Here is what the shape of the Edge.Cuts layer looks like:

Somehow, KiCAD refuses to recognize an arc segment intersecting other paths as a valid outline for Edge.Cuts. Am I missing something? This is a necessary function for some PCB applications.

(KiCAD-internal 3D model renders fine)

Test.kicad_pcb (2.5 KB)
Test.net (545 Bytes)
KiCad5TestNew.pro (688 Bytes)
Test.sch (72 Bytes)
Test.step (17.5 KB)

If you share the board file people will be able to troubleshoot for you. From the picture it’s impossible to tell if all points coincide exactly.

Thank you. Yes, I intended to include the board file(s), but forgot. Edited to include.

This happens to me, too. It may be a bug. As a workaround and actually as a recommended way of working you can import the board to FreeCAD with StepUp workbench. From there you can export it as STEP.

1 Like

You may need to change the Tolerance to “Loose” in the Export STEP dialog.

NOTE: When I snap the horizontal segments to the arc end points, the STEP exports fine with Standard tolerance. You can do this by holding the Alt key while moved an end point.

Saving the modified file, we see the difference:

106c106
<   (gr_line (start 190 140) (end 200 140) (layer "Edge.Cuts") (width 0.25))
---
>   (gr_line (start 189.998288 139.998631) (end 200 140) (layer "Edge.Cuts") (width 0.25))
4 Likes

Thanks, Seth. I have tried changing the tolerance settings in the export dialog, to no avail. So were you able to export a valid STEP file using your method with the test project?

No problems at all with any of the 5 versions.

I frequently place arcs for cutouts, or breakouts as part of the edge cuts even inside a given outside edge cut outline.

Isn’t 189.998288 “equal” to 190 for PCB outline (1,712um)?

That is the effect of the “tolerance” in STEP export. It sets how far away equal is.

@dbpodrasky, Yes I was able to export using the Loose tolerance and your original file. I was using the lastest master but I don’t think that we’ve modified the kicad2step utility. Do you get the same error when exporting with Loose tolerance or a different one?

1 Like

With an most likely internal numerical 32 bit representation there is a massive difference between those two numbers!

When joining ends there is a white circle with a cross inside showing which appears to mean a dead centre match of two ends.

When I have had this issue in the past with a line end point not quite mating to an Arc end point, I will add a small line segment to guarantee closure. Your line segment ends at 190.0, 140.0. The Arc ends at 189.998288, 139.998631. I would create a new line and manually edit the end points to be 190.0, 140.0 and 189.998288, 139.998631.

2 Likes

OK. In KiCAD 5.1 I can also successfully export the test case to a STEP file by using the ALT-drag placement method and setting the tolerance to anything greater than tight.

My production board requires the intersection of two arc segments. This is not working with any tolerance settings. I don’t know how much more precise I can be with the placement of the arc ends.

KiCAD seems to be a bit confused in how arc segments are defined: the center point of the arc is named the “start” point and the “end” point is one of the two arc segment end points at a distance of the arc radius from the “start” point.

I have attached the board outline layer for my PCB with two intersecting arcs.

Prod.kicad_pcb (2.5 KB)
KiCad5TestNew.pro (688 Bytes)

This is a good suggestion, but it will only reliably work on one arc segment end point as KiCAD does not explicitly define, such that it can be manually edited, the cartesian coordinates of both arc segment end points.

It might be a good idea to use freecad plus stepup for such a complex outline (from your description i have not bothered to look at the files).

Arc-to-arc is hard in the step export. I will usually make the line thickness very thin to see the offset. Then close the last gap with a small segment.

Prod.kicad_pcb (2.7 KB)

@dbpodrasky, following @Rene_Poschl suggestion…
here you go
Prod.step (5.6 KB)

Did you generate this STEP file by pulling in the Edge.Cuts layer from my PCB file?

I’m not a big fan of FreeCAD, yet, but if the shoe fits…

This is correct, the arc origin end point is explicitly defined and should be easily connected to by a line segment. The arc terminating end point is calculated by Kicad and is arbitrary in relation to the Cartesian coordinates. Therefore, I select the arbitrary end point to get its real location (189.998288, 139.998631 in this case) and make sure I edit any connecting line segment to terminate at that point to guarantee board outline closure.

1 Like

Eureka! Thanks, Aaron.

This works, but seems unnecessarily tedious. By that I mean if the arc segments were defined by two cartesian end points, a radius and a center point then users could simply edit the location of both end points to achieve precise intersection. There is also a balancing act between the length of the short linear segments connecting the two arcs and the tolerance setting when exporting to STEP:

Warning: 10:15:54 AM: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: AddOutlineSegment: 260
Warning: * rejected a zero-length line start: -17.46,-17.23 end: -17.48,-17.2503
Warning: 10:15:54 AM: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: AddOutlineSegment: 260
Warning: * rejected a zero-length line start: -23.6291,-6.49408 end: -23.6814,-6.50488
Warning: 10:15:54 AM: Exception caught: BRep_API: command not done
Warning: 10:15:54 AM: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: MakeShape: 1424
Warning: * failed to add an edge: arc center: 0,-0 radius: 24.5586 angle: -330.738
Warning: * last valid outline point: -23.6293,-6.49321
Warning: 10:15:54 AM: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: CreatePCB: 780
Warning: * could not create board extrusion
Warning: 10:15:54 AM: ** /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/kicadpcb.cpp:ComposePCB:513
Warning: * could not create PCB solid model

I think it would be a big improvement if the tolerances for intersections, at least regarding cuts, were quite a bit more loose. There is really no practical justification for such tight tolerances on the outline of a PCB. A more explicit definition of the arc segments would alleviate most of these issues. Any way to get this in the ear of the appropriate dev(s)?

Thanks to all, this is really helpful for my current and future projects.