Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by Kunda1 »

Discussion thread for: issue #4462: Upgrade from shell to solid failed - UnboundLocalError
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
chrisb
Veteran
Posts: 54280
Joined: Tue Mar 17, 2015 9:14 am

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by chrisb »

Fixed in this version, ticket closed.

OS: macOS 10.15
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22670 (Git)
Build type: Release
Branch: master
Hash: 12155f4aab09047c5697db0c1b3cf93b02edda03
Python version: 3.8.6
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by Kunda1 »

chrisb wrote: Thu Oct 15, 2020 10:47 pm Fixed in this version, ticket closed.
Great. Do we have a git commit associated with the fix?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
HardRock
Posts: 134
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by HardRock »

I have use freecad-daily package for Ubuntu 18.04 and updating when new version come.
In today update still reproduced.

OS: Ubuntu 18.04.4 LTS (Unity:Unity7:ubuntu/unity)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: df9282dc12d45996bb83cb42f6da10fd82519a47
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)

How long it took from commit to freecad-daily package? May be better to compile from sources from github? (i'm developer too, so i can do it)
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by jmaustpc »

HardRock wrote: Fri Oct 16, 2020 4:33 am How long it took from commit to freecad-daily package?
Once daily
HardRock wrote: Fri Oct 16, 2020 4:33 am May be better to compile from sources from github? (i'm developer too, so i can do it)
If you can test and contribute in any way, that could be useful. Normally the compiled versions are not installed. unlike the daily ppa versions, since they can just be directly run once compile and before FreeCAD is installed by running the FreeCAD executable file in the Bin directory under the compile directory.
jmaustpc
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by jmaustpc »

Many of the original faces do not pass the check geometry test. So it is expected that this would not work.

Just select the first face, then hold the Shift key (whatever the equivalent is on Apple) while you click on the last face, then they will all high light, then run Part WB check geometry on all those faces, you will find many are not valid, I think it was 8.

Please ask and confirm that you in fact found a bug before creating tickets on the bug tracker.

So that I guess now resolves this specific issue however opens the next question which was the real question all along for both topics and tickets, how did you create those non-valid faces?

This is a copy of the FCstd file originally from the ticket.
bug_upgrade_from_shell_to_solid_failed(1).FCStd
(797.46 KiB) Downloaded 25 times
HardRock
Posts: 134
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by HardRock »

All was created with standard tools (Part / Surface / Sketch WB) and Cuves workbench to make unbound edges for surrfaces of "square parts" that immitates rag cover.

I'm unable to attach file because it 1.4mb :(

Take a look at the complete model https://forum.freecadweb.org/viewtopic.php?f=24&t=51078

1. Wing was created as surfaces between profiles
2. Sketch (top view) with lines (not solid, not closed) for cut aileron from wing was extruded and aileron was cutted with Part - Slice Apart
3. Sketch (top view) with geometry of "holes" was extruded as solid and cutted from aileron to make holes
4. Using Curves WB extra edges was made in each hole
5. Using Surface WB holes was filled, extra edge from #4 used as unbound edge to make surface twist
6. Round part profile of front of aileron was made with sketches
7. Walls was created with Surface WB - Fill surface, and Part Ruled Surface
8. Part Create shell from faces used to make single shell and lose history

This is completly "clean, simple and legal" way.

In test file I have used Draft Downgrade to split into faces just for test.

May be bug somewhere before in surface operations.

When you work with something complex than cubes, spheres and other simple geometry, this problem occurs very often.
Straight lines and solids - no problem, curved lines and surfaces - pain :)
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by Kunda1 »

HardRock wrote: Fri Oct 16, 2020 10:23 am I'm unable to attach file because it 1.4mb :(
please use dropbox or some 3rd party hosting to share file
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
HardRock
Posts: 134
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by HardRock »

Here is it. This part have some difference from file that was attached in ticket because some intermediate history was lost.
I have redraw round part of aileron (tho sketches and extra walls). Ofcource, same result :)

https://dropmefiles.com/rDgkm

Main problem that you can't predict when errors appear. You may create few parts with same workflow and some of them will contain hidden errors.
Or you interracting with part (cutting, splitting, adding other faces) and all goes right, but after number of operations you may find that something gone wrong and now you are not able to proceed.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Ticket #4462: Upgrade from shell to solid failed - UnboundLocalError

Post by openBrain »

In the example file, the problem is the sewing between the wing front (curved face) and the 2 wing flat faces which isn't correct.
Here is an example that displays the distance between Edge4 of Face014 and Edge4 of Face026 (which is the upper seam).

Code: Select all

>>> diff = lambda x:[(a-b).Length for a,b in zip(App.ActiveDocument.Face014.Shape.Edges[3].discretize(x), App.ActiveDocument.Face026.Shape.Edges[3].discretize(x)[::-1])]
>>> diff(10)
[9.99875737761613e-11, 0.0057411924906165274, 0.010389548255119249, 0.013829369855245206, 0.015928036251299498, 0.016532780350876904, 0.01546673187354468, 0.0125239386577204, 0.007463171788635805, 9.99925751616207e-11]
While the gap is very tight (not perfect though) at the 2 endpoints, it grows up to 16 µm around the center.
Thus no surprise that FreeCAD can't get a solid from the shell as this latter isn't perfectly closed. ;)
Post Reply