Another approach to assembly solver (A2plus)

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

Re: Another approach to assembly solver (A2plus)

Post by Turro75 » Wed Dec 18, 2019 9:42 pm

Hi @Kbwbe!

I'm facing a quite slower importing of complex shapes, I wonder if multithreading the conversion from shape to shell could speed up that process or, as alternative approach, the rewriting of those functions as C code.
What do You think about?

Valerio
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe » Thu Dec 19, 2019 7:50 am

Turro75 wrote:
Wed Dec 18, 2019 9:42 pm
I'm facing a quite slower importing of complex shapes, I wonder if multithreading the conversion from shape to shell could speed up that process or, as alternative approach, the rewriting of those functions as C code.
Hi Turro,
there should be no changes in master branch which have slowed down the imports. Do you register that importing got slower or are you importing bigger shapes bigger than before ?

> Multiprocessing/Multithreading: May be better, i have to check how good this works with FC.
> C-code: Sure faster, but i have no idea about implementing it into FC.

Additional:
I am working on a big update within the devel branch. A2plus creates "xxx.a2p" files during importing of files. The files contain all resulting work of an import process (shape, colours, toponames) and speed up a second time import by factor 3-4.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Turro75
Posts: 175
Joined: Mon Aug 15, 2016 10:23 pm

Re: Another approach to assembly solver (A2plus)

Post by Turro75 » Thu Dec 19, 2019 5:29 pm

kbwbe wrote:
Thu Dec 19, 2019 7:50 am

Hi Turro,
there should be no changes in master branch which have slowed down the imports. Do you register that importing got slower or are you importing bigger shapes bigger than before ?

> Multiprocessing/Multithreading: May be better, i have to check how good this works with FC.
> C-code: Sure faster, but i have no idea about implementing it into FC.

Additional:
I am working on a big update within the devel branch. A2plus creates "xxx.a2p" files during importing of files. The files contain all resulting work of an import process (shape, colours, toponames) and speed up a second time import by factor 3-4.
Hi Kbwbe,

Yes I'm talking about complex objects with many curved surfaces which creates tons of faces.

by analyzing a2p_muxassembly.py it looks like the slowness is mainly caused by Part.Makeshell(faces), other iterations look such as creating the faces list so I don't expect a big improvement in parallelizing them. Am I wrong?

Regarding C code.... rewriting the workbench in C IMHO requires too much work compared to the benefit, it would be interesting writing complex calculation task in a .dll and .so and importing it in python, it could be helpful in replacing some numpy or placement complex iterations within the solver (if any).

threading across cores is quite easy in python, from https://docs.python.org/3/library/multiprocessing.html

Code: Select all


from multiprocessing import Pool

def f(x):
    return x*x

if __name__ == '__main__':
    with Pool(5) as p:
        print(p.map(f, [1, 2, 3]))
        
        
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe » Sun Dec 22, 2019 12:37 pm

Hi Turro,
Turro75 wrote:
Thu Dec 19, 2019 5:29 pm
Yes I'm talking about complex objects with many curved surfaces which creates tons of faces.

by analyzing a2p_muxassembly.py it looks like the slowness is mainly caused by Part.Makeshell(faces), other iterations look such as creating the faces list so I don't expect a big improvement in parallelizing them.
I am not quit sure, but Part.Makeshell(faces) cannot be parallelized, as OCC is only using one core/process. Please tell me if i am wrong.
Turro75 wrote:
Thu Dec 19, 2019 5:29 pm
Regarding C code.... rewriting the workbench in C IMHO requires too much work compared to the benefit,
Yes...

Turro75 wrote:
Thu Dec 19, 2019 5:29 pm
it would be interesting writing complex calculation task in a .dll and .so and importing it in python, it could be helpful in replacing some numpy or placement complex iterations within the solver (if any).
1) I do not have any experience in interfacing python with C/C++, that's my problem
2) The ".dll" and ".so" files would have to be compiled for each OS, probably by the user. Using pure python is much more easy for many users.
Turro75 wrote:
Thu Dec 19, 2019 5:29 pm
threading across cores is quite easy in python
I know, i have been working with that on other projects.

Are you using the toponaming option of A2plus? Using this needs some computation time.
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe » Sun Dec 22, 2019 12:55 pm

Hi people,

A2plus V0.4.33 has a new feature (thanks to a user request). Now you can click a part and move it around under rule of all constraints.

Have a look at this video:
phpBB [video]


Have fun.

Merry christmas to all,
Klaus

P.S: Find the assembly attached (for your own experiments)
Attachments
asm-viergelenk.FCStd
(21 KiB) Downloaded 28 times
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Christoph
Posts: 53
Joined: Fri Jul 08, 2016 9:02 pm

Re: Another approach to assembly solver (A2plus)

Post by Christoph » Sun Dec 22, 2019 2:40 pm

kbwbe wrote:
Sun Dec 22, 2019 12:55 pm
Hi people,

A2plus V0.4.33 has a new feature (thanks to a user request). Now you can click a part and move it around under rule of all constraints.
I'm impressed, thank you very much creating this feature!
dan-miel
Posts: 105
Joined: Thu Sep 13, 2018 12:29 am
Location: Spokane WA. USA

Re: Another approach to assembly solver (A2plus)

Post by dan-miel » Sun Dec 22, 2019 5:48 pm

kbwbe wrote:
Sun Dec 22, 2019 12:55 pm
A2plus V0.4.33 has a new feature (thanks to a user request). Now you can click a part and move it around under rule of all constraints.
kbwbe:
I haven't tried this yet but it is something that I wanted to ask for but, again a but, the animations were so slow I never dreamed that this would be possible. Fantastic!

Dan
User avatar
roerich_64
Posts: 857
Joined: Thu May 21, 2015 7:00 pm
Location: Ostfriesland

Re: Another approach to assembly solver (A2plus)

Post by roerich_64 » Sun Dec 22, 2019 6:38 pm

Hi Klaus,

Also from me: thank you for the new future:-)

Have a nice Christmas with your family and a happy new year:
IMG-20191222-WA0001.jpg
IMG-20191222-WA0001.jpg (174.55 KiB) Viewed 443 times
Bests
Walter
User avatar
uwestoehr
Posts: 1095
Joined: Sun Jan 27, 2019 3:21 am

Re: Another approach to assembly solver (A2plus)

Post by uwestoehr » Mon Dec 23, 2019 12:35 am

kbwbe wrote:
Sun Dec 22, 2019 12:55 pm
A2plus V0.4.33 has a new feature
Documented: A2plus_Workbench#Dragging
Attachments
A2p_example-for-dragging-animation.FCStd
A2p_example-for-dragging-animation
(20.04 KiB) Downloaded 174 times
kbwbe
Posts: 938
Joined: Tue Apr 10, 2018 3:12 pm
Location: Germany, near Köln (Cologne)

Re: Another approach to assembly solver (A2plus)

Post by kbwbe » Fri Dec 27, 2019 7:26 pm

A2plus function "importPart" has been broken today for a short time on master branch. Please update to new version V0.4.34a
Sorry!
KBWBE

https://github.com/kbwbe/A2plus
latest release: v0.4.43a, installable via FreeCAD's addon manager
Tutorial: gripper assembly https://www.youtube.com/watch?v=QMxcQ5tssWk
Documentation: https://www.freecadweb.org/wiki/A2plus_Workbench
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests