View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004622||FreeCAD||Bug||public||2021-04-07 10:03||2021-08-17 16:46|
|Platform||Linux||OS||Arch Linux||OS Version||5.11.11|
|Fixed in Version||0.20|
|Summary||0004622: OpenSCAD/OpenSCADTest/app/test_importCSG.py assertion failure|
|Description||I have an OpenSCAD test failing on recent builds from git|
|Steps To Reproduce||- have a recent stable release of occt installed (tested here with 7.5.0)|
- build the latest commit from the master git branch ( a855033f215014d993fc067ea6d6ba89f0a369d5 as of this writing)
- run the built in tests with `FreeCADCmd --console --run-test 0`
|Tags||No tags attached.|
|FreeCAD Information||with commit a855033 from the master branch|
-- Build type: None
-- Compiler: /usr/lib/ccache/bin/c++ (10.2.0)
-- Flags: -Wall -Wextra -Wno-write-strings -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fPIC -w
-- Standard: Requires C++14
-- Python: 3.9.2 [/usr/bin/python] [.cpython-39-x86_64-linux-gnu]
-- PCL: not enabled
-- pybind11: not enabled
-- Boost: 1.75.0 (1.75.0)
-- XercesC: 3.2.3 [/usr/lib/libxerces-c.so] [/usr/include]
-- ZLIB: 1.2.11
-- PyCXX: 6.2.8 [/home/grey/git/freecad-git/src/FreeCAD/src]
-- OCC: 7.5.0 [TKFillet;TKMesh;TKernel;TKG2d;TKG3d;TKMath;TKIGES;TKSTL;TKShHealing;TKXSBase;TKBool;TKBO;TKBRep;TKTopAlgo;TKGeomAlgo;TKGeomBase;TKOffset;TKPrim;TKSTEPBase;TKSTEPAttr;TKSTEP209;TKSTEP;TKHLR;TKFeat] [/usr/lib] [/usr/include/opencascade]
-- SMESH: build internal
-- MEDFile: 4.1.0 [/usr/lib/libmedC.so;/usr/lib/libmed.so] [/usr/include]
-- HDF5: 1.12.0
-- VTK: 8.2.0
-- NETGEN: not enabled
-- SWIG: 4.0.2
-- Eigen3 3.3.9
-- Qt5Core: 5.15.2
-- Qt5Network: 5.15.2
-- Qt5Xml: 5.15.2
-- Qt5XmlPatterns: 5.15.2
-- Qt5Widgets: 5.15.2
-- Qt5PrintSupport: 5.15.2
-- Qt5OpenGL: 5.15.2
-- Qt5Svg: 5.15.2
-- Qt5UiTools: 5.15.2
-- Qt5Concurrent: 5.15.2
-- Qt5WebKitWidgets: 5.212.0
-- Shiboken2: 5.15.2 [/usr/lib64/cmake/Shiboken2-5.15.2] [/usr/include/shiboken2;/usr/include/python3.9]
-- PySide2: 5.15.2 [/usr/include/PySide2]
-- PySide2Tools: [/usr/bin/uic-qt5] [/usr/bin/rcc-qt5]
-- Freetype: 2.10.4
-- OpenGL: /usr/lib/libGL.so
-- OpenGLU: [/usr/lib/libGLU.so][/usr/include]
-- Coin3D: 4.0.1 [Coin] 
-- Pivy: 0.6.5
-- SPNAV: [/usr/lib/libspnav.so] [/usr/include]
-- Matplotlib: 3.4.1
-- Rift: not enabled (BUILD_VR)
-- Doxygen: 1.9.1
-- Language: English
-- Coin3D_DOC: not found
@greyltc I am having a hard time reproducing this -- when you have a minute, could you use the OpenSCAD workbench to insert the following object and then save and attach the resulting FCStd file?
I see the same error, built from commit 33cca2e6c6a6ace4b1203a9ad0f9002a6c841e99.
Attached the requested FCStd file.
Issue-4622.FCStd (5,069 bytes)
||Thanks, @floesche -- the object in your FCStd file has the correct bounding box, so probably the test just needs a recompute() before the check. What kind of system are you on?|
Very similar to @greyltc, just python is at 3.9.3 by now and the kernel at 5.11.15. Do you need any other information?
Not sure if this is helpful, but if I step through the test, I see the following:
I tried to do a recompute on the doc.ActiveObject, with no result:
Let me know if I can test something else.
||In that FCStd file, when you view it from the top, are you seeing a circle, or an oval?|
It's a circle from the top, an oval from front.
In the "Report view" window I am also seeing the following when creating the OpenSCAD element:
…and the attached file is generated directly from the test_import.CSG.py file: I set a breakpoint at line 350 (after doc=self.utility_create_scad…) and the ran
. Just in case this is different from what the GUI does.
test_import_resize_l350.FCStd (3,118 bytes)
||I wonder if the active object isn't what the test expects it to be. If you are seeing a circle from the top, then the bounding box being reported can't correspond to that object, since the reported box has different X and Y components. Can you verify that doc.ActiveObject is in fact giving you that spheroid, and not some other object?|
Sorry, how could I do that?
gives me 'Matrix_Deformation'.
||That's what I expect to see. Can you recompute the entire document and see if the bounds changes?|
Is that how I can recompute a document?
In any case, the XLength doesn't seem to be correct.
||Are you also on Arch, or are using using a different distro? It looks like I'm going to have to find a way of reproducing it locally, there's a disconnect between what you are seeing onscreen (and posting here in your FCStd files) and the reported bounding box, and I can't figure out what that could be.|
Yes, I am also on Arch.
I don't know much about the data structures used in FreeCAD, but I know a bit about coding. So if you have ideas what I can try, I'd be happy to.
||First, thanks for all the help you've provided so far! Second: to be honest I'm at a bit of a loss about what's going on, but my first order of business will be to add some print statements around the matrix deformation to make sure that at least the values going in and out of it are being calculated correctly.|
The bounding box seems to originate from the OpenCASCADE transformation. The test code ultimately calls
in TopoShape.cpp L3234. This is where the dimensions of the boundingbox changes from the expected to the unexpected dimensions.
The most fundamental way I could replicate this, was to do the transformation directly in DRAWEXE:
This creates the first bounding box:
and the second:
These numbers are basically the same as the test generates.
Possibly all this is related to the (non)issue https://tracker.dev.opencascade.org/view.php?id=27042?
After playing around with this for a bit, I have a few questions – maybe you can help with the answers?
1) I am guess, that the FreeCAD GUI is doing some additional steps when rendering the OpenSCAD parts. I might be on the wrong track, but is it possible, that OpenSCAD for FreeCAD GUI are converted from Part to Mesh and back to Part via "process3D_ObjectsViaOpenSCADShape" in OpenSCADUtils.py?
2) I am guessing, a similar transformation would defeat the purpose of this test. Alternatively, would a different mapping of "newsize" to another transformation in p_resize_action (importCSG.py L:494) make sense?
3) Is it possible to reproduce the test error or the DRAWEXE script on another system than Arch Linux?
Apologies if these questions have obvious answers. Any hints welcome.
I think the ci robot isn't even running this test case (maybe why it's been missed?).
I just looked at a recent ci log: https://api.travis-ci.org/v3/job/770257561/log.txt and I can't see that OpenSCAD is even installed or configured in that environment. Is this test being run successfully somewhere else that I can look at?
In case it's helpful, here's some more verbose output during the test failure on my system.
Don't ask me what all the Token warnings or the permissions errors are about.
Here is a screenshot of how it goes when I do this manually in the gui. Looks okay I think.
EDIT: I can't seem to upload a picture for direct attachment to the issue here. Maybe this works:
||In case it wasn't obvious, I've bisected it and this is the commit that creates this issue: https://github.com/FreeCAD/FreeCAD/commit/69f24859b5cc51af788654c86c3438aa6cef11ef|
But when I do this on the command line via FreeCADCmd, I can see the failure appear clearly
So yes, it seems broken in the terminal and not broken in the GUI.
||That's very helpful -- I only ever run this test from the GUI (as you noted upthread, Travis doesn't run this test because it doesn't have OpenSCAD installed and currently that is required). I'll try running from the command line later this week and see if I can reproduce locally.|
||Just to confirm: I can reproduce the issue with the example @greyltc provided.|
I think I have a fix for this, but would appreciate an additional check on my work. Can you edit line 494 of importCSG.py to read
and see if that resolves the issue for you?
Thank you for this suggestion. Sadly for me it doesn't solve the problem.
Not surprisingly, if I set a breakpoint right after the changed line and then check the size of the bounding box, it is the wrong size:
A suggestion from the forums is to try adding
before the transform, so it would then read:
||Just an update that the recompute suggestion does not work. I continue to try tracking this down...|
Finally tracked this one down to as issue with the way OCCT calculates bounding boxes when a tessellation is not available -- added explicit tessellation before any bounding box calculations in the importer in PR 4970: https://github.com/FreeCAD/FreeCAD/pull/4970
|2021-04-07 10:03||greyltc||New Issue|
|2021-04-10 02:48||chennes||Assigned To||=> chennes|
|2021-04-10 02:48||chennes||Status||new => assigned|
|2021-04-12 18:19||chennes||Status||assigned => feedback|
|2021-04-12 18:19||chennes||Note Added: 0015611|
|2021-04-18 00:58||floesche||Note Added: 0015614|
|2021-04-18 00:58||floesche||File Added: Issue-4622.FCStd|
|2021-04-18 22:10||chennes||Note Added: 0015615|
|2021-04-18 22:20||floesche||Note Added: 0015616|
|2021-04-18 22:21||floesche||Note Edited: 0015616|
|2021-04-18 22:30||floesche||Note Edited: 0015616|
|2021-04-19 14:50||floesche||Note Added: 0015617|
|2021-04-19 14:50||floesche||Note Edited: 0015617|
|2021-04-19 14:50||floesche||Note Edited: 0015617|
|2021-04-19 16:07||chennes||Note Added: 0015618|
|2021-04-19 18:41||floesche||Note Added: 0015619|
|2021-04-19 18:58||floesche||Note Added: 0015620|
|2021-04-19 18:58||floesche||File Added: test_import_resize_l350.FCStd|
|2021-04-19 19:22||chennes||Note Added: 0015621|
|2021-04-19 19:37||floesche||Note Added: 0015622|
|2021-04-19 19:42||chennes||Note Added: 0015623|
|2021-04-19 19:54||floesche||Note Added: 0015624|
|2021-04-19 21:45||chennes||Note Added: 0015626|
|2021-04-19 21:49||floesche||Note Added: 0015627|
|2021-04-19 22:02||chennes||Note Added: 0015628|
|2021-04-20 04:50||floesche||Note Added: 0015629|
|2021-04-22 15:30||floesche||Note Added: 0015642|
|2021-05-09 16:11||greyltc||Note Added: 0015652|
|2021-05-09 16:11||greyltc||Status||feedback => assigned|
|2021-05-09 16:27||greyltc||Note Added: 0015653|
|2021-05-09 17:28||greyltc||Note Added: 0015654|
|2021-05-09 17:28||greyltc||Note Edited: 0015654|
|2021-05-09 17:30||greyltc||Note Added: 0015655|
|2021-05-09 17:32||greyltc||Note Edited: 0015655|
|2021-05-09 17:36||greyltc||Note Edited: 0015654|
|2021-05-09 17:44||greyltc||Note Added: 0015656|
|2021-05-09 18:09||greyltc||Note Added: 0015657|
|2021-05-10 17:17||chennes||Note Added: 0015659|
|2021-06-03 06:04||floesche||Note Added: 0015691|
|2021-06-27 19:24||chennes||Note Added: 0015720|
|2021-06-29 02:26||floesche||Note Added: 0015721|
|2021-07-07 14:36||chennes||Note Added: 0015730|
|2021-08-10 22:42||chennes||Note Added: 0015799|
|2021-08-17 16:41||chennes||Note Added: 0015823|
|2021-08-17 16:42||chennes||Note Edited: 0015823|
|2021-08-17 16:46||chennes||Status||assigned => closed|
|2021-08-17 16:46||chennes||Resolution||open => fixed|
|2021-08-17 16:46||chennes||Fixed in Version||=> 0.20|
|2021-08-17 16:46||chennes||Note Added: 0015824|