Discussion: Merging A2plus and Assembly4

Discussion about the development of the Assembly workbench.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Another approach to assembly solver (A2plus)

Post by Zolko »

kbwbe wrote: Sun Nov 29, 2020 4:23 pm The first thing, we should implement, is a constraint object. It is just needed to test all other things, as recoding the a2p_solversystem.py and co.
Can't we simply re-use the A2+ constraints as they are now :

A2p_constraint.png
A2p_constraint.png (311.06 KiB) Viewed 856 times

An Asm4 assembly has a group called "Constraints" and every constraint should go in there. Thus, the solver should parse that group, find all constraints, also parse all the App::Link objects in the assembly, through the AssemblyType property find those that should be solved by A2+, consider all others fixed, and do the magic between the parts and constraints.

Asm4_constraint.png
Asm4_constraint.png (267.95 KiB) Viewed 856 times
try the Assembly4 workbench for FreCAD — tutorials here and here
kbwbe
Veteran
Posts: 1052
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe »

Zolko wrote: Mon Nov 30, 2020 1:12 pm Can't we simply re-use the A2+ constraints as they are now ...

An Asm4 assembly has a group called "Constraints" and every constraint should go in there. Thus, the solver should parse that group, find all constraints, also parse all the App::Link objects in the assembly, through the AssemblyType property find those that should be solved by A2+, consider all others fixed, and do the magic between the parts and constraints.
Yes, we can start this way and test how this goes. If something is found to be missing, it can simply be added. Nothing is written to stone at first steps. At first i will make a small file for the proxies of the constraint object. Then we need a first command for testing a first constraint (mainly the constraint-setup, solving of that constraint is a later step)

When only allowing datums at moment, we need for the solver:
- definition of a point (could be datum point, center of a LCS, center of an origin-object?)
- definition of an axis (datum line? base axis of an LCS? base axis of origin object?)
- definition of a plane (datum plane, base plane of Origin?, something else?)

Important criteria IMHO is that the necessary datums can be picked by mouse click in 3D, to define a constraint. Selection in the tree view is only a second choice with less usability. What's your opinion ?

P.S: I have cloned your master branch. Wouldn't it be better you create a separate branch at your repo ? If not, you can rebase my PR's to your desired branch later.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.56, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Another approach to assembly solver (A2plus)

Post by Zolko »

kbwbe wrote: Mon Nov 30, 2020 4:47 pm
Zolko wrote: Mon Nov 30, 2020 1:12 pm Can't we simply re-use the A2+ constraints as they are now ...
Yes, we can start this way and test how this goes.
actually, I changed my mind: let's use the A2+ solver as-is, with all geometries, and let the user decide if/when to use datum objects.

P.S: I have cloned your master branch. Wouldn't it be better you create a separate branch at your repo ? If not, you can rebase my PR's to your desired branch later.
You shouldn't clone the master branch, I never make any direct PR to it. I do the development in the development branch (https://github.com/Zolko-123/FreeCAD_As ... evelopment), and merge the development branch into the master branch when things are stable. There is also a "solver" branch with a tentative solver from Alonso-JAMM (https://github.com/Alonso-JAMM/FreeCAD_ ... ree/solver), but it's behind master and development, so I'd not suggest to use it.

I think the best would be to clone the development branch, create a folder (solver_a2p for example) and put all your stuff there.

I created a test assembly : it has 3 parts, all in the same file.
  • Bielle is free, has manual placement
  • Cuve is fixed as per Asm4 with the ExpressionEngine
  • Bague is free, has manual placement
  • there are also some fasteners
I'd suggest to try an axisCoincident constraint an Bague and the hole in Bielle.
A4p.png
A4p.png (315.02 KiB) Viewed 798 times
A2p.png
A2p.png (283.56 KiB) Viewed 798 times
Attachments
a4p_Bielle.FCStd
(137.38 KiB) Downloaded 32 times
try the Assembly4 workbench for FreCAD — tutorials here and here
jp_math
Posts: 4
Joined: Tue Dec 01, 2020 3:39 pm

Re: Discussion: Merging A2plus and Assembly4

Post by jp_math »

Guys, what you are trying to achieve here is quite interesting and impressive.
I'm new to "assemblies" (in FreeCAD), and I'm not really aware of the python magic inside it nor of the FreeCAD objects structure.

I've tested A2+ and A4 to create simple mechanisms form scratch from Zolko's tutos, and here are my feelings...
We need both.

As I see it A2+ is way more "user friendly and intuitive", A4 seems more robust and adapted for deep top-down design.
Nothing you ignore I guess.

Also, when creating animations, it seems to me that A2+ solver is really faster: I can make interactive animation by simply moving my mouse where A4 somehow seems to struggles to animate with 3 parts.
(maybe it is just the animate assembly toolbox that causes it to be slow and unresponsive, and this is not a criticism, just a fact, I guess animation is not the center of your aim when doing an assembly WB).

So if you can merge them, just be aware that both use-case should be addressed :
- I'm doing a tremendous top-down assembly that will update nicely when changing one parameter (like @ppemawm is doing in his wonderful threads)
- I want to go for a more intuitive (or messy) approach and would like to do it quickly and to see how it moves...

Also for movement, I would really like to have tools that help me rely on existing geometries or datum (For instance, using a datum plane in the middle of the slot of an arm and link it to my nipple axis on the disk... Which seems impossible in A2+.)
Not to mention a 'tangent' constraint between two surfaces...
The relative movements between gears or belt driven gears would also require to be easily defined but I don't know how far this would be in terms of development... Maybe using LCS and variables here is the most efficient approach.

That's it for my Santa list, if you guys manage to get the best of both these approach (apparently simple, and capable of complex things), I would be really impressed.

Anyway, this was just my thoughts and also my great thanks for doing all this, I guess your work takes a lot of time, and you don't need some lazy end-user come around and ask for new features...Do you? ;)
Post Reply