[Solved] Likely OCC bug: common of shapes outside one shape

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
lambda
Posts: 91
Joined: Sat Feb 25, 2017 3:10 pm
Contact:

[Solved] Likely OCC bug: common of shapes outside one shape

Post by lambda »

Hi!

I'm trying to cut a face with a solid, but the result is not what I expect: It extends outside the original face. See the attached file.

Since there is a warning about boolean operations on faces, I also tried extruding it first. However this even throws an exception:

Code: Select all

14:14:28  <Exception> Intersection failed
14:14:28  90.9013 <App> Document.cpp(3746): Failed to recompute testFuse#Common: Intersection failed
14:14:28  Recompute failed! Please check report view.
Is this a bug in OCC or FreeCAD? Is it already known? Are there any workarounds?

TIA,
Harald
Attachments
boolean_common_bug.FCStd
(16.12 KiB) Downloaded 34 times
Last edited by lambda on Tue Jul 21, 2020 10:58 pm, edited 1 time in total.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Likely OCC bug: common of shapes outside one shape

Post by vocx »

lambda wrote: Tue Jul 21, 2020 12:24 pm Hi!

I'm trying to cut a face with a solid, but the result is not what I expect: It extends outside the original face. See the attached file.
...
Your file shows the a Part Common operation, not a Part Cut. However, with Part Cut I also get a strange result.
Original
Original
Plane_cut_1.png (8.19 KiB) Viewed 812 times
Cut
Cut
Plane_cut_2.png (8.07 KiB) Viewed 812 times
Common (intersection)
Common (intersection)
Plane_cut_3.png (6.5 KiB) Viewed 812 times

The OCCT version is important. I'm still in 7.3, but the AppImage and others already use 7.4. Some people have noted a few regressions from 7.3 to 7.4 as well.

Code: Select all

OS: Ubuntu 18.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22104 (Git)
Build type: Release
Branch: master
Hash: d30e4a508865b02d1545e694dff659e4f8f40a94
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
lambda
Posts: 91
Joined: Sat Feb 25, 2017 3:10 pm
Contact:

Re: Likely OCC bug: common of shapes outside one shape

Post by lambda »

Yes, it seems general fuse gets confused and everything, that relies on it.

I'm sorry, I forgot the version information:

Code: Select all

OS: Debian GNU/Linux bullseye/sid
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.22040 (Git)
Build type: Unknown
Branch: rt-FixTransactionDynamicProp
Hash: a8540c962015e3938e0d908eeacece15675a4f40
Python version: 3.8.4
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: German/Austria (de_AT)
User avatar
Chris_G
Veteran
Posts: 2602
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Likely OCC bug: common of shapes outside one shape

Post by Chris_G »

I don't think there is any bug in the boolean operation.
I think you obtained your "Test" object by a replaceShape() operation, that lead to an unreasonable tolerance :

Code: Select all

o2.Shape.getTolerance(1)
#>>>240.00002400000002
Here is a view of the real geometries :
wrong_shape.png
wrong_shape.png (11.81 KiB) Viewed 794 times
Obtained with :

Code: Select all

doc1 = FreeCAD.getDocument('boolean_common_bug')
o1 = doc1.getObject('Gel__nde_001_body')
o2 = doc1.getObject('Test')

def geometric_wireframe(sh):
	edges = []
	for e in sh.Edges:
		edges.append(e.Curve.toShape(e.FirstParameter, e.LastParameter))
	return Part.Compound(edges)

Part.show(geometric_wireframe(o1.Shape))
Part.show(geometric_wireframe(o2.Shape))


lambda
Posts: 91
Joined: Sat Feb 25, 2017 3:10 pm
Contact:

Re: Likely OCC bug: common of shapes outside one shape

Post by lambda »

Chris_G wrote: Tue Jul 21, 2020 5:26 pm I don't think there is any bug in the boolean operation.
I think you obtained your "Test" object by a replaceShape() operation, that lead to an unreasonable tolerance :

Code: Select all

o2.Shape.getTolerance(1)
#>>>240.00002400000002
Indeed. :oops:

Improving replaceShape() usage as described in https://forum.freecadweb.org/viewtopic.php?f=10&t=48660 fixed the problem with boolean operations.
Post Reply