STEP exporter never ends

Bug #1784626 reported by Valerio Nappi
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Seth Hillbrand

Bug Description

I'm trying to export a step file and the exporter never stops going. At some point it takes almost all the ram in my system (taking 10GB), then drops the memory usage down to about 1GB, but never ends. Killing the exporter gives some warning and errors, report attached. Happening for multiple projects, but not every one.

Running on kicad 5.0.0, windows 10. Details:

Application: kicad
Version: (5.0.0), release build
Libraries:
    wxWidgets 3.0.3
    libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
Build Info:
    wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
    Boost: 1.60.0
    OpenCASCADE Community Edition: 6.8.0
    Curl: 7.54.1
    Compiler: GCC 7.1.0 with C++ ABI 1011

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

Tags: export step
Revision history for this message
Valerio Nappi (valerio.new) wrote :
Revision history for this message
Nick Østergaard (nickoe) wrote :

Please attach a demo project.

tags: added: export step
Revision history for this message
Valerio Nappi (valerio.new) wrote :
Revision history for this message
Nick Østergaard (nickoe) wrote :

I can confirm this on windows with

Version: (6.0.0-rc1-dev-232-g3d28d0274), release build

Changed in kicad:
status: New → Confirmed
importance: Undecided → High
milestone: none → 5.0.1
Revision history for this message
Seth Hillbrand (sethh) wrote :

This appears to be an issue with OCE. OpenCascade works well. OCE-0.18 breaks hard and OCE-0.17 slows to a crawl.

Can you export using a different origin (grid origin or board center)?

Revision history for this message
Valerio Nappi (valerio.new) wrote :

Exporting with board center gives quirky results (attached, board edges are not respected)
Grid origin and custom origin give the same bug as the first post

Revision history for this message
Valerio Nappi (valerio.new) wrote :

I've done some more testing and the "added segment" warnings seem somehow related to the fact that one end of the imported dxf cutouts is made by two 90° arcs instead of a 180° one. Removing one arc and extending the other and exporting gives no warnings and results in a correct STEP.

The fact that one rounded end of the cutout is made by two separate arcs is not kicad's fault, it's already in the dxf file. I don't know if this is due to dxf specifications or it's a glitch of my drawing program, but still kicad should handle it.

Revision history for this message
Valerio Nappi (valerio.new) wrote :

See attachment, with comments on cmts.user layer

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

I am not having this problem with oce 0.18.3 (6.9.1) which is the latest available on msys2 builds so it looks like the solution is the fix the installer build to use this version of oce to build kicad rather than 6.8.0. I do get an error message about the board outline (which is the actual problem) but it does not hang with the test project provided.

Revision history for this message
Cirilo Bernardo (cirilo-bernardo) wrote : Re: [Bug 1784626] Re: STEP exporter never ends

It is possible that the problem is with the settings or internal bugs
with features such as shape healing. If using 6.9.1 makes the
problem disappear then I think the best course of action is to
make 6.9.1 the minimum requirement.

The only thing we need to be careful about with using a newer
OCE is to ensure that our patch for handling non-ascii filenames
still applies. Just a reminder of what the problem was: when OCE
is built within MinGW it uses the gcc libs to open files and gcc
assumes utf8 and blindly passes the names to the Windows
file open routine which of course is ignorant of utf8. The patch
was an ugly hack but was necessary due to the structure of
OCE and the fact that there is no hope of fixing the problem
from within gcclib.

On Thu, Aug 23, 2018 at 7:12 PM, Wayne Stambaugh
<email address hidden> wrote:
> I am not having this problem with oce 0.18.3 (6.9.1) which is the latest
> available on msys2 builds so it looks like the solution is the fix the
> installer build to use this version of oce to build kicad rather than
> 6.8.0. I do get an error message about the board outline (which is the
> actual problem) but it does not hang with the test project provided.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1784626
>
> Title:
> STEP exporter never ends
>
> Status in KiCad:
> Confirmed
>
> Bug description:
> I'm trying to export a step file and the exporter never stops going.
> At some point it takes almost all the ram in my system (taking 10GB),
> then drops the memory usage down to about 1GB, but never ends. Killing
> the exporter gives some warning and errors, report attached. Happening
> for multiple projects, but not every one.
>
> Running on kicad 5.0.0, windows 10. Details:
>
> Application: kicad
> Version: (5.0.0), release build
> Libraries:
> wxWidgets 3.0.3
> libcurl/7.54.1 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1 librtmp/2.3
> Platform: Windows 8 (build 9200), 64-bit edition, 64 bit, Little endian, wxMSW
> Build Info:
> wxWidgets: 3.0.3 (wchar_t,wx containers,compatible with 2.8)
> Boost: 1.60.0
> OpenCASCADE Community Edition: 6.8.0
> Curl: 7.54.1
> Compiler: GCC 7.1.0 with C++ ABI 1011
>
> Build settings:
> USE_WX_GRAPHICS_CONTEXT=OFF
> USE_WX_OVERLAY=OFF
> KICAD_SCRIPTING=ON
> KICAD_SCRIPTING_MODULES=ON
> KICAD_SCRIPTING_WXPYTHON=ON
> KICAD_SCRIPTING_ACTION_MENU=OFF
> BUILD_GITHUB_PLUGIN=ON
> KICAD_USE_OCE=ON
> KICAD_USE_OCC=OFF
> KICAD_SPICE=ON
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/kicad/+bug/1784626/+subscriptions

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Since this is a windows build, I'm assuming the bug reporter is using an official installer download from the website (would the bug reporter please confirm this?) so I'm guessing the windows builder is using an older package of oce. How much trouble would it be to update the windows builder to use the latest version (0.18.3) of oce?

Revision history for this message
Valerio Nappi (valerio.new) wrote :

Yes i've downloaded the installer from the website as soon as it was released

tags: added: packaging windows
Changed in kicad:
assignee: nobody → Nick Østergaard (nickoe)
Revision history for this message
Seth Hillbrand (sethh) wrote :

I can confirm this behavior on MacOS as well, using OCE 6.9.1.

Application: pcbnew
Version: (6.0.0-rc1-dev-404-g60620ea2a), debug build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.54.0 LibreSSL/2.0.20 zlib/1.2.11 nghttp2/1.24.0
Platform: Mac OS X (Darwin 17.6.0 x86_64), 64 bit, Little endian, wxMac
Build Info:
    wxWidgets: 3.0.4 (UTF-8,STL containers,compatible with 2.8)
    Boost: 1.66.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.54.0
    Compiler: Clang 9.0.0 with C++ ABI 1002

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

Revision history for this message
Wayne Stambaugh (stambaughw) wrote :

Have we update windows package builds to use the newer version of oce yet so we can close out this bug report?

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

@Wayne, I don't think we can close this out just yet. Mac shows the issue even using OCE 6.9.1. This may require some re-thinking of how we close arc-arc cuts in the step exporter.

tags: removed: packaging windows
Revision history for this message
KiCad Janitor (kicad-janitor) wrote :

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

Changed in kicad:
status: Confirmed → Fix Committed
assignee: Nick Østergaard (nickoe) → Seth Hillbrand (sethh)
Revision history for this message
Seth Hillbrand (sethh) wrote :

The issue appears to have been caused by OCE having a difficult small segment remover. It was effectively trying to remove the small segments that we were adding to close the outline.

This was added to address https://bugs.launchpad.net/kicad/+bug/1774351 that appears to be more effectively addressed by decreasing the default gap size to consider an outline closed. This was used for curve matching, and it appears that a curve was prematurely matched in 1774351.

Everyone who experienced this issue would be encouraged to test the solution as it appears to be rather dependent on the OCE algorithm and platform.

Changed in kicad:
status: Fix Committed → Fix Released
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.