Edge cuts from arcs don't export to STEP

Hi,

I’m trying to export a PCB to a 3D step model so a housing can be designed for it. I’ve tried creating this outline in several different ways but I keep on getting an error in the “Export STEP”: “Unable to create STEP file: Check that the board has a valid outline and models”.

So the 3D viewer has no problems recognizing the outline (Edge.Cuts) nor does the DSN or VRML export give any errors. Only the STEP does.

I’ve tried creating this outline with arcs in Pcbnew -> error, afterwards trying to zoom and correct it manually -> error, next this outline was drawn from scratch in LibreCAD, Solidworks, FreeCAD… all failed with the same type of error.

Warning: 14:59:41: Exception caught: BRep_API: command not done
Warning: 14:59:41: C:/Jenkins/workspace/windows-kicad-msys2-stable/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: MakeShape: 1424
Warning: * failed to add an edge: arc center: 0,-22.75 radius: 1.50083 angle: -176.182
Warning: * last valid outline point: -1.5,-22.7
Warning: 14:59:41: C:/Jenkins/workspace/windows-kicad-msys2-stable/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: CreatePCB: 780
Warning: * could not create board extrusion
Warning: 14:59:41: ** C:/Jenkins/workspace/windows-kicad-msys2-stable/src/kicad/utils/kicad2step/pcb/kicadpcb.cpp:ComposePCB:510
Warning: * could not create PCB solid model

As soon as I replace the outline with a simple circle everything works, so no other issues are in the layout.

The layout is pretty simple but it seems impossible to apply.

Can somebody give me some insight what I am doing wrong here or how I can solve this issue? I have a feeling that the arc conversion to an other element type has some rounding errors in it and therefor the begin and end-point of 2 segments don’t allign exactly. Which causes errors on the export.

Here are some DXF exports used during import.

v1.dxf (22.5 KB)
v2.dxf (10.5 KB)
v3.dxf (19.0 KB)
v4.dxf (18.5 KB)

Drawing with KiCAD specially with “weird” offset is a pain, you can zoom in very close to make sure that the lines are touching each other since a couple o versions the lines snap to each others end showing a difference in the cursor, that may help you.

However, if you already have the DXF, the easiest way is to import them in kicad as border.

File->import->Graphics

  • choose the scale (1 if 1:1 in mm otherwise probably 2.54 if 1:1 in inches)
  • choose the target layer (edge.cuts)
  • clean up (if needed)

I hope this helps.

Hi @der.ule

I already tried importing the DXF as you mentioned but they gave the same issues.

I can’t create a DXF file that seems to work to do the STEP export.

Sorry I read the thread too fast, I mostly use StepUp, but when exporting your STEP file, you can set the “Tolerance” parameter to “Loose” or “Very loose” to export your design, most probably one end point is not perfectly align.

Downloaded “v4.dxf” and loaded is as an outline in pcbnew (standalone).
It looks OK in the 3D viewer, but exporting to step goes wrong:

Executing '"/usr/bin/kicad2step" --user-origin="127.000000 x 126.975275" -f -o "/home/paul/noname.step" "/home/paul/_autosave-noname.kicad_pcb"'
Warning: 15:41:02: Exception caught: BRep_API: command not done
Warning: 15:41:02: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: MakeShape: 1424
Warning: * failed to add an edge: arc center: 0,-22.7747 radius: 1.5 angle: -176.222
Warning: * last valid outline point: -1.49919,-22.7253
Warning: 15:41:02: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: CreatePCB: 780
Warning: * could not create board extrusion
Warning: 15:41:02: ** /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/kicadpcb.cpp:ComposePCB:510
Warning: * could not create PCB solid model
Warning: 
Error: Unable to create STEP file. Check that the board has a valid outline and models.

Setting tolerance to “Loose” or “Very loose” does not help:

Executing '"/usr/bin/kicad2step" --user-origin="127.000000 x 126.975275" --min-distance="0.0100 mm" -f -o "/home/paul/noname.step" "/home/paul/_autosave-noname.kicad_pcb"'
Warning: 15:43:24: Exception caught: BRep_API: command not done
Warning: 15:43:24: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: MakeShape: 1424
Warning: * failed to add an edge: arc center: 0,-22.7747 radius: 1.5 angle: -176.222
Warning: * last valid outline point: -1.49919,-22.7253
Warning: 15:43:24: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: CreatePCB: 780
Warning: * could not create board extrusion
Warning: 15:43:24: ** /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/kicadpcb.cpp:ComposePCB:510
Warning: * could not create PCB solid model
Warning: 
Error: Unable to create STEP file. Check that the board has a valid outline and models.
Executing '"/usr/bin/kicad2step" --user-origin="127.000000 x 126.975275" --min-distance="0.1000 mm" -f -o "/home/paul/noname.step" "/home/paul/_autosave-noname.kicad_pcb"'
Warning: 15:43:41: Exception caught: BRep_API: command not done
Warning: 15:43:41: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: MakeShape: 1424
Warning: * failed to add an edge: arc center: 0,-22.7747 radius: 1.5 angle: -176.222
Warning: * last valid outline point: -1.49919,-22.7253
Warning: 15:43:41: /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/oce_utils.cpp: CreatePCB: 780
Warning: * could not create board extrusion
Warning: 15:43:41: ** /build/kicad-wDueQF/kicad-5.1.9/kicad/utils/kicad2step/pcb/kicadpcb.cpp:ComposePCB:510
Warning: * could not create PCB solid model
Warning: 
Error: Unable to create STEP file. Check that the board has a valid outline and models.

Following the comment of @paulvdh I tested v4 and didn’t export either, I checked the other files: v3 and v1 failed too. v2 however, works as expected with “Loose” tolerance. I was lucky in my previous tests, as I imported all of them and deleted 3, turns out that the only one left was v2. !

Could you tell us what are the differences between all version ?

V2 is created with inkscape. First import a DXF in inkscape with polys in it it. Convert every segment manually to a segment with 32 segments and changed these segments to lines. (Something like interpolation with lines). And export them to DXF.

So a lot of work for a small task. I now notice that in V2 indeed 1 point is more misaligned than the other 3 points connecting the segments.

Still, exact CAD files import result in export errors. I would say there is going something terribly wrong with a conversion.

All others were exports from FreeCAD, LibreCAD or SolidWorks.

This bug was fixed in the development version of 5.1 – I can export all these DXFs to STEP with it (though I had to remove the cross splitting the board in four). So, this bug should be gone once 5.1.10 is released. Below are my results of exporting (numbered in the same order as the DXF input files):

noname1.step (23.9 KB) noname2.step (662.9 KB) noname3.step (23.9 KB) noname4.step (23.9 KB)

You should also be able to export this with the latest nighly version, as the fix was applied there as well.

3 Likes

I can confirm that exporting the step (from V4.dxf) works with KiCad-nightly V5.99.
After that I imported the step in FreeCAD and it looks OK.

1 Like

@mwielgus I’m looking forward to that release. For the time being, I’ll use the Inkscape -> Interpolate method.

I would like to point out that drawing this outline with KiCad PCBNew is next to impossible.Although these are only 4 simple arcs they are next to impossible to draw. This is espceially difficult due to the way an arc is defined (centerXY; startXY and arc angle). Even when working on a grid, there seems to be a large amount of, what I gues is, rounding or conversion error.

Is there a plan to incorporate some extra drawing tools in Pcbnew? Snap to intersection, trim, fillet/chamfer, offset, tangent circle/arc, …

Perhaps an easier feature that would give a lot of options is to convert circles and arcs to line segments.

Yes, but it’s unclear if they cover this use case. Version 5.99 already handles curved traces which are arcs but internally different than graphic arcs AFAIK, and arcs in polygon outlines are coming before v6.0 and they also are probably differently implemented. Also the editing UI will be different, and there is different kind of graphics editing coming for v7 (probably).

This is a well know issue that has been discussed a couple of time, the point of view of the developer is that for the time being, there are many other things that require more attention that the things that are already pretty well done with CAD software.

However @craftyjon has been doing an amazing job with the new dimensioning tool of v5.99

https://forum.kicad.info/t/post-v5-new-features-and-development-news/15693/273

https://forum.kicad.info/t/post-v5-new-features-and-development-news/15693/277?u=der.ule

https://forum.kicad.info/t/post-v5-new-features-and-development-news/15693/273?u=der.ule

and who know, maybe he tackles the drawing tools next.

You can of course try to use a couple of trick and tips, but it is indeed “complicated”

First clue to problem:
When given the error message, it did not indicate an Open segment

Second clue to problem:
When selecting a line, popup shows multiple lines for selection (example in video).
Can simply delete the extra lines

Solution - if using FreeCad and proper Export setting that compatible with Kicad (Screenshot)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.