Modelling precision

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Modelling precision

Postby jrheinlaender » Fri Oct 19, 2012 3:57 am

Hi,

I have been wondering why booleans take so much calculation time in OCC but are very fast in Pro/E and AD Inventor. Could this be connected to the modelling precision? Here is what I found with a bit of googling:

OCC: Precision::Confusion = 1E-7
Pro/E: 0.01mm (?)
CATIA V4: 0.02mm
CATIA V5: 0.001mm

Then there is relative and absolute precsion, which have me confused.

In any case, do we need to do something about the OCC precision of 1E-7 to speed up booleans? Maybe you guys don't notice, but I have a single Celeron 1.86MHz and from booleans of 3 cylinders upwards I notice the calculation time! On the same machine, AD Inventor calculation time for much more complex booleans is unnoticeable.

Jan
ivanzero
Posts: 30
Joined: Wed Jan 25, 2012 9:35 pm

Re: Modelling precision

Postby ivanzero » Fri Oct 19, 2012 6:31 am

Hi Jan,
You mix up the kernel and modeling tolerance.

Kernel tolerance (accyracy for math operations)
Parasolid 10E-8
ACIS 10E-6 (I'm not sure about this)

Modeling tolerance
Parasolid 0.0254
ACIS 0.001
CATIA V4 0.1 - 0.02
CATIA V5 0.001
SolidWorks 0.0254

Ivan
mrlukeparry
Posts: 655
Joined: Fri Jul 22, 2011 8:37 pm
Contact:

Re: Modelling precision

Postby mrlukeparry » Fri Oct 19, 2012 8:31 am

From what I read in the OpenCascade manual, general boolean operations in OpenCascade should be avoided and instead if possible use the localised gluing operation to create a union between two parts on a face. I haven't seen test cases to see if there is a performance benefit, but it might make an interesting experiment to see if we can improve performance - especially on the pad and pocket tools which are commonly used.
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Modelling precision

Postby wmayer » Fri Oct 19, 2012 8:49 am

jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: Modelling precision

Postby jrheinlaender » Fri Oct 19, 2012 9:30 am

Here are some very detailed information why BOP's are so slow:
In other words, the fault is solely with the OCC code, not with precision or different underlying mathematics. That's not very encouraging. I can't imagine users switching over from other solid modelers to FC if their models take 10x as long to regenerate... And the blog articles you linked to are 4 years old, with the OCC team apparently not doing anything about it.
if possible use the localised gluing operation to create a union between two parts on a face
mrlukeparry, could you explain this a little more detailed, e.g. with some examples pads/pockets? I don't really see the light yet.

Jan

Offtopic: Is there some policy for/against using user names (e.g. mrlukeparry) over first names in this BB? I certainly prefer first names...
kwahooo
Posts: 204
Joined: Wed May 19, 2010 11:11 pm
Contact:

Re: Modelling precision

Postby kwahooo » Fri Oct 19, 2012 9:49 am

I think a modern CAD modeler doesn't need boolean tool. As example, Pro/Engineer uses none (except some rarely used in Assembly). Also, we should (if possible) rip off internal boolean operations from pad and pocket tools.
mrlukeparry
Posts: 655
Joined: Fri Jul 22, 2011 8:37 pm
Contact:

Re: Modelling precision

Postby mrlukeparry » Fri Oct 19, 2012 10:17 am

First Names are fine with me - my username is my real name anyway.

I am not entirely certain if this is how the process works with OpenCascade but it's based on some light reading I did last summer. The source file that points this out is (which is old now still):
http://opencascade.sourcearchive.com/do ... ource.html

When when we do a global boolean operation (such as adding two features together) every part of the feature is used within the algorithm.

Whereas when we use Gluer (local operation) we specify the faces to glue the parts together and this limits the 'domain' or the areas (such as faces) that the algorithm needs to work in.

The more complex the shape, I would assume the longer it takes for the algorithm to work. However using the gluer, you could connect two faces which are maybe simpler and I think this should be much faster to calculate.

I might experiment with a FreeCAD example to demonstrate this but I don't know if there is anywhere that uses the Gluer...

Feel free to correct me if anyone knows better, but I'm also sure I saw this somewhere else but couldn't find it.
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Modelling precision

Postby NormandC » Fri Oct 19, 2012 12:07 pm

kwahooo wrote:I think a modern CAD modeler doesn't need boolean tool. As example, Pro/Engineer uses none (except some rarely used in Assembly). Also, we should (if possible) rip off internal boolean operations from pad and pocket tools.
The programmers will correct me if I'm wrong, but my understanding is all CAD software use booleans. It is part of every geometric kernel. Only, with parametric software use of booleans is generally hidden from the end user. Like for pad and pocket in FreeCAD. Otherwise how do you add or subtract anything? The best explanation of parametric CAD's inner workings I've read is: see any feature (pad, pocket, pattern) as a macro calling a series of operations.
wmayer
Site Admin
Posts: 15755
Joined: Thu Feb 19, 2009 10:32 am

Re: Modelling precision

Postby wmayer » Fri Oct 19, 2012 12:26 pm

The programmers will correct me if I'm wrong, but my understanding is all CAD software use booleans. It is part of every geometric kernel. Only, with parametric software use of booleans is generally hidden from the end user. Like for pad and pocket in FreeCAD. Otherwise how do you add or subtract anything? The best explanation of parametric CAD's inner workings I've read is: see any feature (pad, pocket, pattern) as a macro calling a series of operations.
Yes, in a certain way you need boolean operations. The other cad applications may not show a command to do that explicitly but internally it needs it for sure.
Luke's suggestion is to use BRepFeat__LocalOperation which also provides fusing and cutting where however the programmer can decide which faces he wants to use and which not and thus increase the performance. But on the other hand, how do you know which faces to use and which not? For more complex objects this is probably not easy to determine, I fear. And about the slowness of the BOP this is due to some programming flaws where it allocates and frees memory in a senseless way and not that the algorithm as such is bad.
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: Modelling precision

Postby jrheinlaender » Mon Jan 21, 2013 9:13 am

IMO this is one of the greatest obstacles to FC becoming a good solid modeller (specifically Part and PartDesign workbench). On my (older) laptop, after 5-10 booleans recalculation becomes so slow that it is a pain to work with it. This means that it is impossible to model bigger parts with FC.

Since both OCC and OCE are tied down by a decade-long legacy of customers and models, what about branching our own version and applying fixes there? The point is that when OCC/OCE introduce a fix, they have to do intensive regression checking to make sure that none of their customers/users suddenly complains about existing models not working. But since FC does not have such a big legacy, we could apply changes much faster. What would be a regression for OCC because it breaks existing models would simply be a bug for us that breaks future models.

I can't see any other way of getting the booleans fixed. OCC and OCE have been sitting on this for years and nothing has happened. Even if we were to supply a ready-made patch to them, they might still take years to apply it (or decide to never do it for fear of regressions).

And the longer we wait, the more difficult it will be for us to fix the booleans, because our legacy is also growing. Since 0.14 is introducing massive changes anyway, why not do it there?