Assembly3 Angle constraint give me headaches

Report observations made with the new Toponaming branch.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Assembly3 Angle constraint give me headaches

Post by FBXL5 »

Assembly3 Angle constraint give me headaches when I try to animate a skeleton sketch.
It behaves the same with any recent version of FreeCAD, but for this example I used the brand new LinkDaily:

OS: macOS 12.4
Word size of FreeCAD: 64-bit
Version: 2022.704.26244 +4971 (Git)
Build type: Release
Branch: LinkDaily
Hash: a87320cc64699a8e4226bad2e9b37ac3a1296ab9
Python version: 3.9.10
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.6.0
Locale: C/Default (C)

I try to use the kinematic controller described in the Tutorial_KinematicController .
Skeleton2D.png
Skeleton2D.png (299.86 KiB) Viewed 1973 times
The Angle constraint, marked .Driver, defines the angle between the fixed green line and the blue line.
The animated sequence should give the blue line a full rotation from -90° to 270°.
After a lot of tweaking I found out that 103 steps deliver the expected result:
Skeleton2D-103st.gif
Skeleton2D-103st.gif (433.83 KiB) Viewed 1973 times
But in most cases the same controller with different step values (53 in the following animation) gives such a result:
Skeleton2D-53st.gif
Skeleton2D-53st.gif (388.3 KiB) Viewed 1973 times
This made me think (until today) that the Angle constraint with 2D skeleton sketches won't accept negative values.
At least I've got a motion from start to end; other step values may cause the blue line (or the amber line, too) to jump to a not predictable position. The same applies when using the slider too quickly.
The other problem with the Angle constraint is that if it reaches 0°, or 180° (, or 360°) exactly, the solver is unable to tell in which direction to continue, stops and opens an error window telling: Failed to solve (XXX) XXX: inconsistent constraints

For 3D kinematic assemblies the results of the Angle constraint as a driving constraint is far more predictable but still far from perfect.

@realthunder Is there any chance that the behaviour of the Angle constraint can be improved? I think it is the key constraint for skeleton sketches and they are more or less useless without a stable driving constraint that can do full turns.
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: Assembly3 Angle constraint give me headaches

Post by realthunder »

Just don't use the angle constraint. Instead, use any constraint that has a Lock angle option, and animate the Angle property. The most obvious one is the PlaneCoincident constraint. Attachment would be better, but for that you need to change the constraining element's Offset property instead. Not so obvious at first.

Just draw two circles using the green and blue line as the radius. If you are using sketch, you can make those circles as construction lines so they don't show up. You can add those circles as asm3 elements for later constraining while editing the sketch.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: Assembly3 Angle constraint give me headaches

Post by FBXL5 »

Thanks for the quick reply, realthunder.
realthunder wrote: Wed Jul 06, 2022 5:32 am Instead, use any constraint that has a Lock angle option, and animate the Angle property.
That is what I usually do with 3D assemblies and it works well for me.
realthunder wrote: Wed Jul 06, 2022 5:32 am If you are using sketch, you can make those circles as construction lines so they don't show up.
Does this mean I can use lines and circles made with the Sketcher for a 2D skeleton sketch instead of those of the Draft workbench?
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: Assembly3 Angle constraint give me headaches

Post by FBXL5 »

realthunder wrote: Wed Jul 06, 2022 5:32 am If you are using sketch, you can make those circles as construction lines so they don't show up. You can add those circles as asm3 elements for later constraining while editing the sketch.
If I apply constraints to such circles and then switch the circles to construction mode, then the Elements lose their connection with the circles and show an error symbol.
And the sketches can tilt out of the workplane.
It seems that Sketcher geometry doesn't work with the 2D skeleton sketch principle. It's a pity that it is so limited. I really like this principle to build a 2D kinematic and attach 3D objects.

This is how I would build a 2D kinematic assembly using sketches and 3D constraints: Tutorial_KinematicSkeleton

Edit: I found how to use construction geometry now. It is quite painful to search a 198 pages forum thread :roll:
But the tilting is still a problem.
Last edited by FBXL5 on Wed Jul 06, 2022 7:52 am, edited 1 time in total.
User avatar
bambuko
Veteran
Posts: 2161
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: Assembly3 Angle constraint give me headaches

Post by bambuko »

FBXL5 wrote: Wed Jul 06, 2022 7:40 am .. It's a pity that it is so limited. I really like this principle to build a 2D kinematic and attach 3D objects.
what is the problem?
works perfectly OK for me (including using construction geometry for elements etc)...
Thank you for assembly3 realthunder!
https://forum.freecadweb.org/viewtopic. ... 47#p555958
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: Assembly3 Angle constraint give me headaches

Post by FBXL5 »

bambuko wrote: Wed Jul 06, 2022 7:49 am what is the problem?
The problem is to simulate a simple crank driven piston movement with a 2D skeleton sketch using Draft geometry on a workplane.

3D animation is no problem at all.

Your screen shot shows sub-assemblies called skeleton-xxx, but did you really use 2D skeletons or are they 3D skeletons?
User avatar
bambuko
Veteran
Posts: 2161
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: Assembly3 Angle constraint give me headaches

Post by bambuko »

FBXL5 wrote: Wed Jul 06, 2022 8:01 am ...but did you really use 2D skeletons or are they 3D skeletons?
2D only - I didn't use Draft workbench (don't like it), just Part Design sketches.
I am travelling at the moment, so can't use FreeCAD,
but if you still struggling by the time I am back,
I am happy to create simple demonstration for you?
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
User avatar
FBXL5
Posts: 979
Joined: Sat Aug 03, 2019 8:45 pm

Re: Assembly3 Angle constraint give me headaches

Post by FBXL5 »

bambuko wrote: Wed Jul 06, 2022 9:44 am 2D only - I didn't use Draft workbench (don't like it), just Part Design sketches.
I am travelling at the moment, so can't use FreeCAD,
but if you still struggling by the time I am back,
I am happy to create simple demonstration for you?
I'm not in a hurry.

I'd like to spread the collected wisdom about Assembly3 on the wiki. It is far more user-friendly than a 198 pages forum thread.
My attempts beside the command pages are so far:
Tutorial_KinematicAssembly
Tutorial_KinematicController
Tutorial_KinematicSkeleton

But I cannot compile a useful example for the 2D skeleton sketch (plus attached 3D objects).
I am still not successful to use another driving constraint than Angle.

Moving a kinematic back and forth using one of the movers is a pain, too, but I blame that on the macOS (I have no alternative to compare). That was the motivation to code a controller.

BTW I don't like the Draft workbench, too. I'm mostly using PartDesign plus Sketcher, and SheetMetal where applicable and Assembly3, certainly.
User avatar
bambuko
Veteran
Posts: 2161
Joined: Thu Oct 24, 2019 12:53 pm
Location: UK, England, North Devon

Re: Assembly3 Angle constraint give me headaches

Post by bambuko »

Happy to cooperate.
Will have a look at it when I am back...
I am using Link branch and Assembly3
you can also download ... and try it here
excellent Assembly3 tutorials here
Post Reply