Bug 1589520

Summary: Cura can not open a simple stl file generated by OpenSCAD
Product: [Fedora] Fedora Reporter: Tomi Leppänen <tomi.leppanen>
Component: curaAssignee: Miro Hrončok <mhroncok>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 28CC: jskarvad, mhroncok
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-19 01:50:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Problematic stl file.
none
Terminal output for Cura none

Description Tomi Leppänen 2018-06-10 12:44:57 UTC
Created attachment 1449667 [details]
Problematic stl file.

Description of problem:
I made a model using OpenSCAD and then tried to slice it in Cura but it can not load the model. I reduced the model to a simple test case that has the problem so it should be easy to reproduce.

Version-Release number of selected component (if applicable):
3.3.0-1.fc28

How reproducible:
Always.

Steps to Reproduce:
1. Download the attached stl file (test.stl).
2. Open Cura.
3. Load the stl file to Cura.

Actual results:
I get error message:
"Invalid File
Failed to load .../test.stl"
and exceptions thrown to terminal output. (... is just a placeholder for file path)

Expected results:
Cura loads the file just fine.

Additional info:
The stl is generated with following OpenSCAD source:
translate([0, 0, 10]) rotate([-90, 0, 0]) cube(10);

The rotation is the important part here and cube is just something simple to render. Translation is there to keep the model above 0 but it doesn't seem to make any difference. This stl file loads just fine with Cura 3.3.0 AppImage (and also versions 3.2.1 and 3.3.1) downloaded from Ultimaker Cura website so this is something specific to Fedora packaging of Cura.

Comment 1 Tomi Leppänen 2018-06-10 12:47:49 UTC
Created attachment 1449668 [details]
Terminal output for Cura

Exception: Exception occurred while loading file /home/tomi/Dropbox/3D/test.stl
Traceback (most recent call last):
  File "/usr/lib64/python3.6/site-packages/stl/stl.py", line 75, in load
    fh, header, speedups=speedups)
  File "/usr/lib64/python3.6/site-packages/stl/stl.py", line 218, in _load_ascii
    return _speedups.ascii_read(fh, header)
  File "stl/_speedups.pyx", line 129, in stl._speedups.ascii_read
RuntimeError: (0, "Can't read vertex (18:b'vertex 0 2.22045e-15 -10')")

Comment 2 Miro Hrončok 2018-06-10 18:55:37 UTC
Thanks for the report. 

I can reproduce with cura. Yet fail to reproduce with pure python-numpy-stl :(

This is very similar to:

https://github.com/Ultimaker/Cura/issues/1785

https://github.com/WoLpH/numpy-stl/issues/52

Comment 3 Miro Hrončok 2018-06-12 09:56:28 UTC
Tomi, as a workaround please convert your file to binary STL (for example in ADMeshGUI or admesh CLI).

Comment 4 Miro Hrončok 2018-10-31 13:46:59 UTC
*** Bug 1644657 has been marked as a duplicate of this bug. ***

Comment 5 Miro Hrončok 2018-12-10 14:21:09 UTC
Fix ready.

Comment 6 Fedora Update System 2018-12-19 01:50:41 UTC
python-numpy-stl-2.8.0-1.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2018-12-19 02:28:08 UTC
python-numpy-stl-2.8.0-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.