Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Another approach to assembly solver (A2plus)

Postby kbwbe » Sun Jun 10, 2018 11:09 am

Hi,

there is a lot of talking about solving an assembly here within the forum.

I developed a small prototype of yet another solver. It is in a very early state now and is only capable to handle plane/circularedge/axis-constraints.
But it can easily be extended. It consist only of one file, which is attached.

The base concept is inspired by physics. Forces(Distances from point to targetpoints) will cause moves and rotations around a spin-center. Also axis-alignments will cause "torque" and cause spinning around. The solver is working iteratively.

It is just a prototype and many things are still missing. But the idea seems to work.
Have a look a the following to tests which i did.

- Test1: assembling some link-beams with circular edges
- Test2: assembling a hose-pump (with plane/circularEdges/axis-constraints)
linkparts-unassembled.png
linkparts-unassembled.png (190.8 KiB) Viewed 2739 times
linparts-assembled.png
linparts-assembled.png (178.95 KiB) Viewed 2739 times
pump-unassembled.png
pump-unassembled.png (289.05 KiB) Viewed 2739 times
pump-assembled.png
pump-assembled.png (197.24 KiB) Viewed 2739 times

Anyone interested? Suggestions ? Important improvements ? Someone who wants to help ?

Thanks,
kbwbe

UPDATE: Look for newest complete testworkbech at newer posts within this tread. (For Win and Linux now)
Attachments
solversystem.py
(20.83 KiB) Downloaded 51 times
Last edited by kbwbe on Tue Jul 10, 2018 5:29 pm, edited 2 times in total.
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc
triplus
Posts: 7452
Joined: Mon Dec 12, 2011 4:45 pm

Re: Another approach to assembly solver

Postby triplus » Sun Jun 10, 2018 12:13 pm

Hi @kbwbe.

I see your work is somehow inspired by Assembly 2 workbench? Do you plan to create a new workbench? What you attached is i guess only a prototype of a potential solver? I would say create a workbench or extend the Assembly 2 workbench and see how that goes. If it will be able to assemble FreeCAD geometry in some straightforward way i am sure end users will use it.
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Re: Another approach to assembly solver

Postby kbwbe » Sun Jun 10, 2018 1:03 pm

Hi triplus,

thanks for your answer. Your are right. I am working with a refurbished assembly2-workbench. I like the base concepts of it very much and did some bigger projects with it. My adapted workbench is somehow ready for LINUX. I use it everyday. Unfortunately I have some problems with fc0.17 and therefore i am still staying with fc0.16

There are two mainproblems of assembly2:
- the solver often fails and does not find a solution. Therefore i started this work with new solver and integrated it into my workbench.
(it should work with assembly2 too)

- topological naming: If a part is been updated, very often the ordering of vertexes, edges and faces is changed.
Hamishs algorithm to recover the indexes is slow and fails very often.
I did a reduced form of toponaming (which is not perfect) only for use with the assembly workbench. But my scripts where blown up
by the fc0.17 body- and partcontainers.

Working within fc0.16, my simple toponaming improved importing parts to assembly very much. It is much more stable with it.

Have no problem to share the code if anyone is interested. Perhaps someone finds a solution to adapt the scripts to fc0.17.

How to share complete workbench ? Do not have a github-account or anything else... (and don't really want it)

kbwbe
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc
triplus
Posts: 7452
Joined: Mon Dec 12, 2011 4:45 pm

Re: Another approach to assembly solver

Postby triplus » Sun Jun 10, 2018 1:08 pm

kbwbe wrote:
Sun Jun 10, 2018 1:03 pm
How to share complete workbench ? Do not have a github-account or anything else... (and don't really want it)

kbwbe
I guess you could create a ZIP archive and attach it to this thread. If the archive is not too big.
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Re: Another approach to assembly solver

Postby kbwbe » Sun Jun 10, 2018 2:03 pm

Hi triplus,
good idea.

Find .zip attached.


UPDATE: Look for newest complete testworkbech at newer posts within this tread. (For Win and Linux now)


Installation-instructions:
- only for Linux (because of filehandling) and fc0.16 (will not work with fc0.17)
- before copying the extracted zip to your mod-folder, setup your CAD-folder (create a new one for testing!!!) according to this:
(you have to create a new entry "projectFolder" within the parameter-Editor.
assembly2-preferences.png
assembly2-preferences.png (85.45 KiB) Viewed 2694 times
- within CAD-folder each file ony has to exist one time or you get strange results.
- do NOT use this test-workbench with important work. It will mismatch existing assemblies. Use newly created files for testing.
- extract zip.archive, copy the a3-folder to your mod-folder.

- Start FreeCAD, work is very similar to assembly2. a3-Workbech should appear in available workbenches:

Be aware: new solver-prototype is active. You can have unexact solutions without warning. The solver has to be improved.

This is the first test in the free wild. I hope that it will work anyway.
Feel free to ask and do what you want with this code.

Klaus
Attachments
a3.zip
(273.17 KiB) Downloaded 28 times
Last edited by kbwbe on Tue Jun 12, 2018 1:39 pm, edited 1 time in total.
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc
triplus
Posts: 7452
Joined: Mon Dec 12, 2011 4:45 pm

Re: Another approach to assembly solver

Postby triplus » Sun Jun 10, 2018 6:39 pm

I did a few quick tests (FreeCAD 0.17 and without messing with the folder instructions). I used some Draft Clone geometry in a single document. As for the short version your solver will solve:
a3_CircualAxial.png
a3_CircualAxial.png (21.76 KiB) Viewed 2660 times
P.S. Did noticed a combination of circular and plane relations can sometimes result in:
a3_CircualPlane.png
a3_CircualPlane.png (9 KiB) Viewed 2660 times
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Re: Another approach to assembly solver

Postby kbwbe » Sun Jun 10, 2018 6:50 pm

thanks for testing :D

if possible please post the fcstd-file of the second image with not functional constraints..
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc
triplus
Posts: 7452
Joined: Mon Dec 12, 2011 4:45 pm

Re: Another approach to assembly solver

Postby triplus » Mon Jun 11, 2018 6:46 am

kbwbe wrote:
Sun Jun 10, 2018 6:50 pm
thanks for testing :D
You're welcome.
if possible please post the fcstd-file of the second image with not functional constraints..
Sure.
Attachments
a3.fcstd
(10.56 KiB) Downloaded 17 times
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Re: Another approach to assembly solver

Postby kbwbe » Mon Jun 11, 2018 3:29 pm

thanks for the file. I can reproduce the problem and will have a look why this happens...
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc
kbwbe
Posts: 551
Joined: Tue Apr 10, 2018 3:12 pm

Re: Another approach to assembly solver

Postby kbwbe » Mon Jun 11, 2018 7:12 pm

I am analyzing the problem. I have detected wrong spin-orientations of the parts during solving.
This work will need a little bit time. I have to an intensive check of the code.
Wondering that i did not recognize this in my tests before..
KBWBE

find recent version of A2plus here: https://github.com/kbwbe/A2plus
latest release: v0.1.6, installable via FreeCAD's addon manager
Paul Randall's tutorial on Youtube: https://youtu.be/mnkecA9S7kc