## Another approach to assembly solver (A2plus)

Discussion about the development of the Assembly workbench.
Turro75
Posts: 176
Joined: Mon Aug 15, 2016 10:23 pm

### Re: Another approach to assembly solver (A2plus)

kbwbe wrote:
Mon Jul 30, 2018 4:09 pm
Turro75 wrote:
Mon Jul 30, 2018 12:31 pm
Do You think You can skip move or rotation independently while solving?
Hi Turro,
i do not really know at moment. For coding, it is no problem. But in reality any "magnetic" rotation is inexact per calculation step somehow, and moves are necessary to correct some errors. So i do not know at moment, what will happen if trying this.

A very good thing would be, using your systematics to find the "candidates" for next partial system to solve. Is that possible ?

Do you perhaps have some "pseudo-code" ideas ?
Sure we'll try, there is something You should implement to go straight to the next step, the grouped rigid.
When we find 2 rigid which are fully constrained on each other (is. a circular edge + lock rotation) we have to:
1) solve the constraints that involve only the 2 rigids and remove them from constraint list
2) create a new rigid which has a new center. May be a middle point between the 2 center?
3) the dep of the new rigid are the dep left unsolved, refpoint are the same.
4) every time one of the 2 rigids above are involved in a constraint, the rigid used by solver has to be the group.

Example: in the 6dof_assembly each piston-cylinder couple has 5dof lost, if You set lockrotation = True all DOF are lost so You can solve each piston-cylinder as a reduced set of rigid, create a new rigid group which has only 2 constraints : the spherical to both plates.
now the solver can work on 7 rigids as bottom plate is fixed instead of the 13 rigids if lockrotation is left False.

this, added to several other rules will help reducing the number of rigids involved on each step even when the chain started from a fixed part is somewhere broken.
kbwbe
Posts: 969
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

### Re: Another approach to assembly solver (A2plus)

project4 wrote:
Mon Jul 30, 2018 5:45 pm
Hi guys,

Sorry for being less involved recently. There is a chance I'll have to step down from active involvement due to very big changes in my business that will require all of my time for some period.
Hi @project4,
saying it again: Thank you for all your work done within this project. I wish you the very best and good luck regarding the changes in your business. I would be glad to see you back here in some time if possible !
KBWBE

https://github.com/kbwbe/A2plus
project4
Posts: 192
Joined: Fri Jul 12, 2013 12:53 pm

### Re: Another approach to assembly solver (A2plus)

kbwbe wrote:
Mon Jul 30, 2018 6:30 pm
project4 wrote:
Mon Jul 30, 2018 5:45 pm
Hi guys,

Sorry for being less involved recently. There is a chance I'll have to step down from active involvement due to very big changes in my business that will require all of my time for some period.
Hi @project4,
saying it again: Thank you for all your work done within this project. I wish you the very best and good luck regarding the changes in your business. I would be glad to see you back here in some time if possible !
I'll stay here and will try to contribute with ideas, but probably won't have time to develop.
I still have the project pending that needs the assembly module, so I hope you could move it forward until I'll get back to that project.
kbwbe
Posts: 969
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

### Re: Another approach to assembly solver (A2plus)

Turro75 wrote:
Mon Jul 30, 2018 6:20 pm
You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
KBWBE

https://github.com/kbwbe/A2plus
Turro75
Posts: 176
Joined: Mon Aug 15, 2016 10:23 pm

### Re: Another approach to assembly solver (A2plus)

kbwbe wrote:
Mon Jul 30, 2018 8:12 pm
Turro75 wrote:
Mon Jul 30, 2018 6:20 pm
You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
I agree that probably we won't find directly a group which is made by more than 2 rigids, but with the same strategy we would find a group fully constrained to another rigid or why not to another group. believe me a small group of 2 rigids or 2 groups is a good starting point. few small steps at a time. We only have to define a reliable way to get a rigid center.
Part booleans are not an option as rigids can be fully constrained on each other even without get in touch, we have to find an alternative
Turro75
Posts: 176
Joined: Mon Aug 15, 2016 10:23 pm

### Re: Another approach to assembly solver (A2plus)

Turro75 wrote:
Mon Jul 30, 2018 8:25 pm
kbwbe wrote:
Mon Jul 30, 2018 8:12 pm
Turro75 wrote:
Mon Jul 30, 2018 6:20 pm
You should implement to go straight to the next step, the grouped rigid.
Hi Turro,
i will think about your suggestions. In case of 6DOF platform, it is easy to find a cylinder and a piston which can be combined. Two parts which are fully constrained to each other are forming a group. But we need additional rules, if a group consists of more parts. Maybe that the code has to be heavily modified to match groups of rigids.
I agree that probably we won't find directly a group which is made by more than 2 rigids, but with the same strategy we would find a group fully constrained to another rigid or why not to another group. believe me a small group of 2 rigids or 2 groups is a good starting point. few small steps at a time. We only have to define a reliable way to get a rigid center.
Part booleans are not an option as rigids can be fully constrained on each other even without get in touch, we have to find an alternative
Spoken too fast...
Part.Fusion does the job even if objs are separated. the resulting shape has a boundbox with its center. once found the center, deleting the fusion restore the single parts. it seems a little bit slow but it's not here we need performances.
kbwbe
Posts: 969
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

### Re: Another approach to assembly solver (A2plus)

Turro75 wrote:
Mon Jul 30, 2018 8:36 pm
We only have to define a reliable way to get a rigid center.
This will not be the problem. We can calculate the spin center of a rigid group nearly same way as we are doing now for single rigid.
See function rigid.calcSpinCenter()

P.S.
Forgot to say: master branch is up to date with all changes until now. New branch "devel" is open...
KBWBE

https://github.com/kbwbe/A2plus
Turro75
Posts: 176
Joined: Mon Aug 15, 2016 10:23 pm

### Re: Another approach to assembly solver (A2plus)

actually we need the center of rigid also to correctly handle pointidentity constraints.

just found a way without the need to use fusion

Code: Select all

``````cyl = App.activeDocument().Cylinder
box = App.activeDocument().Box
fusion = App.activeDocument().Fusion

bbCyl = cyl.Shape.BoundBox
bbBox = box.Shape.BoundBox
bbFusion = fusion.Shape.BoundBox

xmin = min(bbCyl.XMin, bbBox.XMin)
xmax = max(bbCyl.XMax, bbBox.XMax)

ymin = min(bbCyl.YMin, bbBox.YMin)
ymax = max(bbCyl.YMax, bbBox.YMax)

zmin = min(bbCyl.ZMin, bbBox.ZMin)
zmax = max(bbCyl.ZMax, bbBox.ZMax)

print center1
print bbFusion.Center``````
Attachments
testrigidcenter.FCStd
kbwbe
Posts: 969
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

### Re: Another approach to assembly solver (A2plus)

Hi @all,

find updated version at github.
- bug during creation of a constrained has been fixed. After creating a new constraint the mirrored constraint was missing
- after deleting imported parts and using FreeCAD's undo functionality, the tree view is now automatically repaired.
KBWBE

https://github.com/kbwbe/A2plus
kbwbe
Posts: 969
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

### Re: Another approach to assembly solver (A2plus)

Hi @all,
find feature update at github.

Solving of constraints can now be undone by FreeCAD's UNDO/REDO system.

If solving the constraints let you get undesired positions of your parts, simple hit FreeCAD's undo button. Your assembly looks again like before the wrong operation.
KBWBE

https://github.com/kbwbe/A2plus