Debugging step export

Hi everyone,

I’m having some troubles exporting a Kicad project to step files. I have previously gotten it to work with other projects that have used the same component library, but now it just refuses to work. The error message i get is “Unable to create STEP file. Check that the board has a valid outline and models”, which isn’t really helping that much. I do have a lot of arches in the edge.cuts layers, so it wouldn’t surprise me if this is some numeric rounding error that creates a non-continuous outline, but with no debugging data it’s hard to tell. I tried to find some logs to check exactly where the export fails, but to no avail. Does anyone have a good method of debugging this, or know where I can find the logs ?

I’m running a nightly build from the 5th of november on a windows 7 machine.

1 Like

Try to use the autorouter “Export a Specctra Design (*.dsn) File”. It will let you know where the edge cut is not continuous.

2 Likes

I think trying to open the 3D viewer will also give the same error if the edge cut is not continuous.

3 Likes

Thank you guys so much for the quick replies.

Both the 3d viewer and the dsn exports completes just fine with no errors.

When i replace my current outline with just a simple square the step export works, so this is definitely outline related. I double checked the design for dublicated lines, and couldn’t find any, that would also throw an error in the 3d viewer.
My outline comes from a solidworks DXF export, with endpoint merging enabled.

Does anyone have any ideas ?

Do you have any footprints with models?

Yes, all of them except some virtual components.

Here are my SW2017 options for DXF export. I’ve never had a failure to import then export as step but that could also be geometry dependent.

Since you are using a nightly, it might be new enough that it has an additional menu item to show graphic items in sketch mode. This is under Preferences / Display and Hide.

You might see something wrong with the lines that you can’t otherwise see.

Thanks again guys,

I started a new project and added only the outline, and it fails to export, 3d viewer and dsn export works just as before

Kiki: I have the same settings as you, but with the endpoint merging option enabled, with an error setting of 0.1 in this case. This means that all points that are within 0.1mm of each other will be merged.

Sprig: I enabled outline mode and verified every arc and line, they have the same start and end coordinates down to rounding of the last digit displayed in kicad, i.e. +/- 0.000001. I checked the source code for kicad2step, and two points within 0.0001 of each other are considered to be the same. I see absolutely no reason to why this shouldn’t work. All coordinates are double precision so they should be fine.

kicad2step does post logs with wxLogMessage( “%s\n”, ostr.str().c_str() ); but I have no idea on how to access that from the kicad ui, i tried running kicad2step.exe in cmd but that gives me nothing at all either.

I tried to upload the DXF file containing the outline, but since I’m a new user I’m not allowed :frowning:

Should i report this as a bug ?

Ok, so i found what was causing it. Seems like there is an issue for short lines/arcs or small features. The endpoints of all segments does have the same coordinates, and the lengths of the segments are orders of magnitude bigger than the MIN_LENGTH2 defined in oce_utils.cpp, which decides how small features are allowed, but kicad2step still fails for some reason.

For future references:

4 Likes

Maybe one of the moderators can help out with the status issue. If you can post the sldprt and/or dxf I’d be willing to see if I can recreate the error.

He just flew up a step :wink:

@Gustavxerxes
If you can make a reproducable error dxf file for the devs and file a bugreport, I’m sure they want to know this.

this is a recursive query… in this case you can simple link a downloading page offered by i.e.google drive or similar on line clouds

Thanks Joan :slight_smile:

Here is the DXF file, lets see if we can replicate it :slight_smile:
main_pcb.DXF (19.8 KB)

Because I see no others joining,
I tested this with the StepUp exporter:
here the kicad_pcb that doesn’t export from internal exporter (created importing the main_pcb.DXF in Kicad dev)
main_pcb.kicad_pcb (6.4 KB)
and the corresponding STEP model created with StepUp in FC0.17
main_pcb_ksu.step (62.8 KB)

1 Like

If I import the DXF it looks good using the OpenGL canvas but the legacy canvas shows some discontinuities. I don’t see the discontinuities in any other programs.

The KiCommand command ‘ends’ will calculate the endpoints of that arc. You can select it, then issue the following command string:

drawings selected ends print

The select the line segment and do the same command. And compare the answers.

I encountered a similar problem with STEP export in version 5. I downloaded the MKRWAN1300 Eagle files and imported them into KiCAD (https://store.arduino.cc/usa/mkr-wan-1300). They import fine. When I try to export the STEP file, I get the following error:

_Executing '"/Applications/KiCad/kicad.app/Contents/MacOS/kicad2step" -f -o "/Users/me/Library/Mobile Documents/com~apple~CloudDocs/Kicad/MKRWANV1.1/MKRWANV1.1.step" "/Users/me/Library/Mobile Documents/com~apple~CloudDocs/Kicad/MKRWANV1.1/_autosave-MKRWANV1.1.kicad_pcb"'_
_Warning: 11:09:49 AM: /vagrant/build/kicad/src/kicad/utils/kicad2step/pcb/oce_utils.cpp: addEdge: 1482_
_Warning: * added an auxiliary segment from 180.687,-92.5036 to 180.687,-92.5036_
_Warning: 0x113d17fcb : Standard_Failure: BRepAdaptor_Curve::No geometry_
_Error: Unable to create STEP file. Check that the board has a valid outline and models._

I noticed something weird with the corners of the board edge. When I zoom in and look at the corner top right corner (note all corners have this anomaly) where the edge is curved, the curve stop and end points are offset by a couple degrees. Might be an Eagle import issue? Not sure if this is causing the issue with exporting the STEP file or not. Here is a screen shot.

I suspect you are experiencing this bug https://bugs.launchpad.net/kicad/+bug/1784626

This is resolved for 5.0.1. You can test this using the 5.0 nightlies at http://downloads.kicad.org/osx/testing/5.0/

1 Like

Thank you @Seth_h. Sounds like this might be the cause. I will download the nightly and give that a try and let you know.