Can't export step file while 3D view does render properly

Bug #1774351 reported by energijapanikoj@gmail.com
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
Medium
Maciej Suminski

Bug Description

This resulted after rotating the middle part 10 degrees. I.e. It was exporting before, but after rotation it does not anymore. I am attaching the PCB in question.

Application: kicad
Version: 5.0.0-rc2-unknown-dfa9175~65~ubuntu16.04.1, release build
Libraries:
    wxWidgets 3.0.2
    libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Platform: Linux 4.13.0-21-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.2 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.58.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.47.0
    Compiler: GCC 5.4.0 with C++ ABI 1009

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Tags: export step
Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :
Revision history for this message
Nick Østergaard (nickoe) wrote :

is the attached pcb in the rotating state or not?

Can you try to run kicad2step directly on the file tonsee if there are any error messages?

tags: added: export step
Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :

This one is in rotated state, the one that does not render.

kicad2step gives this cryptic message:

$ /usr/bin/kicad2step --drill-origin -f -o led-pannel.step led-pannel.kicad_pcb
0x7f7b2923142a : Standard_Failure: BRep_API: command not done

Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :

I am attaching the non-rotated one which exports fine.

Steps to reproduce:
 - select 4 arcs composing the inner outline of the ring
 - Ctrl+M and specify item rotation of 55 degrees
 - STEP export fails

Revision history for this message
Nick Østergaard (nickoe) wrote :

If you move the one from #1 to a place where the model paths does not resolve, can you reproduce the issue then? I am trying to determine if the models used have any effect.

Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :

I think the issue is solely in the board outline, not in the models. But I will doublecheck.

Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :

I have just tried it - removind modules does not help, empty outline returns error when exporting step.

Revision history for this message
Seth Hillbrand (sethh) wrote :

This is an issue with the board outline only. Appears to be rounding.

Changed in kicad:
importance: Undecided → Medium
milestone: none → 5.0.0-rc3
status: New → Confirmed
Changed in kicad:
assignee: nobody → Maciej Suminski (orsonmmz)
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have two solutions that can be combined:

- Stricter outline contiguity check, which should tell the user where the outline is broken.
- Automatic outline contiguity fix for arcs.

I like both changes, but I realize the second one might be considered controversial. Perhaps it should be made an option in kicad2step?

Revision history for this message
Maciej Suminski (orsonmmz) wrote :
Changed in kicad:
status: Confirmed → In Progress
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have also added some extra diagnostic messages in the exporter. It should be enough for the reported case, but the solutions proposed in the previous messages might be even more helpful.

Revision history for this message
jean-pierre charras (jp-charras) wrote :

FYI, Pcbnew automatically closes the outline (for 3D viewer and .dsn export) when the distance between 2 nearest items (segment or arc) is less than 0.01 mm (by adding a small segment)

We do not have issues with that.

Revision history for this message
Wayne Stambaugh (stambaughw) wrote : Re: [Bug 1774351] Re: Can't export step file while 3D view does render properly

On 6/18/2018 11:48 AM, Maciej Suminski wrote:
> I have two solutions that can be combined:
>
> - Stricter outline contiguity check, which should tell the user where the outline is broken.

I'm fine with this more diagnostics to catch broken board outlines. I
think it would be a good idea to add this to the DRC if it isn't there
already.

> - Automatic outline contiguity fix for arcs.

This is problematic because you are always going to have to guess what
the user intended. So there is always and outside chance that you could
get it wrong. Ror step export, it may be less problematic but we
definitely should not be doing this for gerber plotting.

>
> I like both changes, but I realize the second one might be considered
> controversial. Perhaps it should be made an option in kicad2step?

Optional would be preferred.

>
> ** Patch added: "0001-kicad2step-Add-short-segments-to-fix-outline-contigu.patch"
> https://bugs.launchpad.net/kicad/+bug/1774351/+attachment/5154018/+files/0001-kicad2step-Add-short-segments-to-fix-outline-contigu.patch
>

Revision history for this message
Seth Hillbrand (sethh) wrote :

I like both.

In the reported case, you start with a valid outline that exports correctly. You then apply a rotation using KiCad. The outline then no longer exports and you can't fix it in KiCad (or I haven't figured out how)

If we make it an option, I'd suggest that the option be the MIN_LENGTH2 variable that controls what we consider to be zero-length for all kicad2step.

Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision f0b3cf80779aabca9e4be9a33ba36629b7a36d03
https://git.launchpad.net/kicad/patch/?id=f0b3cf80779aabca9e4be9a33ba36629b7a36d03

Changed in kicad:
status: In Progress → Fix Committed
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

Fixed in revision 1541cbdf04a471f506f22e133bcfc0db0a5d603e
https://git.launchpad.net/kicad/patch/?id=1541cbdf04a471f506f22e133bcfc0db0a5d603e

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I have slightly modified and merged the two patches. The minimum distance has been settable, but we need to wait for string thaw before we can add a corresponding text input in the STEP exporter dialog. The setting is used universally in place of MIN_LENGTH2 as Seth had suggested.

I have realized that my explanation regarding the automatic contiguity fix for arcs was not sufficient. In fact, kicad2step already does this by maintaining the last outline point, which is used as a starting point for the next segment [1]. It may constitute a problem for arcs, when a starting point is offset regarding the last outline point. In such case, the original arc (A,B,C) with a start point A, end point B and center C becomes an arc (A+delta,B,C) which OCE may handle only for *very* small deltas.

With the contiguity fix in place, the start point is unmodified and connected with an extra segment. For the moment, the fix is only applied when the distance is smaller than 10 micrometers (default setting), which I think is an acceptable threshold. Larger gaps are reported to the user, so he needs to fix them.

1. https://git.launchpad.net/kicad/tree/utils/kicad2step/pcb/oce_utils.cpp#n1452

Revision history for this message
energijapanikoj@gmail.com (energijapanikoj) wrote :

Thanks a lot, guys. Unfortunatelly I am now unable to check the fix as I am travelling, but I will in a week or so. Finally I have found a tedious way to fix this by hand by adding short line segments connecting the unconnected points, but this fix looks like a very good way to solve this!

Changed in kicad:
status: Fix Committed → Fix Released
Revision history for this message
Seth Hillbrand (sethh) wrote :

@energijapanikoj - We recently adjusted this solution to address a related issue. Would you mind verifying that your issue remains addressed with a recent nightly build (9/7 or later)?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.