ShapeBinder still touched after recompute

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: ShapeBinder still touched after recompute

Post by openBrain »

chrisb wrote: Thu Jul 01, 2021 7:32 am I would have liked to see some more experts having a look, because it is rather cumbersome and I have the feeling that I missed something.
This only due to fact that an expression is used in 'inner' Body position.
Specifically in this case, 'Position.Z' as a (useless) expression but it's enough.
A ShapeBinder with TraceSupport=True is NOT compatible with using an expression in its Body position as it creates a cyclic dependency.

Compute the shape of ShapeBinder -> Compute the relative placement of ShapeBinder -> Compute the shape of Body -> Compute the placement of Body -> Compute the relative placement of ShapeBinder (ERROR) -> ...

It's IMO not a bug.
ulidtko
Posts: 11
Joined: Tue Oct 27, 2020 10:19 pm

Re: ShapeBinder still touched after recompute

Post by ulidtko »

openBrain wrote: Mon Jul 26, 2021 5:40 pm It's IMO not a bug.
Hi... I beg to disagree.

First, it should be documented and/or nicely handled, if indeed not a bug. Arguably, not crashing is "nicely handled" enough... But.

I use parametric Body placement (with expressions) for a reason. Hitting this bug too. How do I simply align mounting holes if this is not a bug? Datum points/lines don't work across Bodies, even within a Part. Disabling TraceSupport in the shapebinder is not an option for me either; doing that produces garbage doesn't compensate for cross-body origin mismatch — as a result, no alignment.

Logically, the dependencies in my parameters are sound; I'm deliberately trying to not introduce any cycles in the parametric model. It's the CAD program that invents the cycle, in this case IMO.

The dependency graph looks okay too, I don't see any cycles as well.

Second... I fail to follow your description right here:
openBrain wrote: Mon Jul 26, 2021 5:40 pm […] Compute the relative placement of ShapeBinder -> Compute the shape of Body […]
... But I'm not terribly familiar with FreeCAD internals. That shouldn't be required to be able to judge a bug however, right?
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: ShapeBinder still touched after recompute

Post by openBrain »

ulidtko wrote: Mon Dec 06, 2021 12:31 am Hi... I beg to disagree.
No problem.
First, it should be documented and/or nicely handled, if indeed not a bug. Arguably, not crashing is "nicely handled" enough... But.
Feel free to get a Wiki account and/or make a PR. ;)
The dependency graph looks okay too, I don't see any cycles as well.

Second... I fail to follow your description right here:
openBrain wrote: Mon Jul 26, 2021 5:40 pm […] Compute the relative placement of ShapeBinder -> Compute the shape of Body […]
... But I'm not terribly familiar with FreeCAD internals. That shouldn't be required to be able to judge a bug however, right?
This description just explains why it creates a cyclic dependency, that isn't visible in the Dependency graph. ;)
ulidtko
Posts: 11
Joined: Tue Oct 27, 2020 10:19 pm

Re: ShapeBinder still touched after recompute

Post by ulidtko »

Ah yes, the invisible not-a-bug :lol: Wonderful.

@openBrain so what about aligning holes across bodies, you skipped replying to that?

Broken tutorial would be also "expected result" in this case I presume?..
openBrain
Veteran
Posts: 9034
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: ShapeBinder still touched after recompute

Post by openBrain »

ulidtko wrote: Mon Dec 06, 2021 10:15 am @openBrain so what about aligning holes across bodies, you skipped replying to that?
You skipped giving your FreeCAD version, so don't know what features are available on your side. Also I'm not an expert with this.
Maybe have a look at PartDesign SubShapeBinder. Hopefully it doesn't suffer the same limitations.
Broken tutorial would be also "expected result" in this case I presume?..
Don't know what you're talking about. :?
ulidtko
Posts: 11
Joined: Tue Oct 27, 2020 10:19 pm

Re: ShapeBinder still touched after recompute

Post by ulidtko »

Fair point... I've just updated to Version: 0.19.24291 (Git).

openBrain wrote: Mon Dec 06, 2021 10:19 am Maybe have a look at PartDesign SubShapeBinder. Hopefully it doesn't suffer the same limitations.
Indeed that helped! I simply replaced the binder & re-constrained those sketches. Full parametricity back in the game :lol:

Sincere thanks for the tip BTW; it didn't even occur to me to try it :roll: Have a good one
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: ShapeBinder still touched after recompute

Post by wmayer »

The problem is caused by this function: https://github.com/FreeCAD/FreeCAD/blob ... r.cpp#L241

Whenever the placement of the body changes because the shape binder has been changed, it touches itself as being modified and thus needs again a recompute. So, in order to break this infinite recursion the function must check whether the placement is really different and only then touches the shape binder.
wmayer
Founder
Posts: 20245
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: ShapeBinder still touched after recompute

Post by wmayer »

Post Reply