FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Tue Dec 29, 2020 1:57 am

I just did a video showing some sample cases put in the workbencg I am working on.

https://www.youtube.com/watch?v=hMCGFkGHnQU

I feel I am almost ready to release the source code and see what people think of it, but honestly I have never used GitHub or anything similar. I don't know much about licenses either. I guess since the software is based on open source software I do not have to worry? It will automatically be under GNU or someting similar? I've just put the text everyone puts at the beginning of the code..

"This program is free software; you can redistribute it and/or modify
it under the terms of the GNU..."

Is this enough?

Cheers...
User avatar
mfasano
Posts: 122
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby mfasano » Wed Dec 30, 2020 2:39 am

josegegas wrote:
Mon Dec 28, 2020 11:30 pm
Hello all.

Can someone please give me some idea on what is wrong with the next input file?

It is a simple crank-slider. A static node at the origin of the global system which is clamped to it. Two dynamic nodes, one at the rotation axis between the "crank" and the "connrod", and another at the slider. The thing is that the initial assembly test fails, and I do not understand why. As you can see, the mechanism moves on the X-Y plane. If I do the same simulation, with the same nodes, the same inertia, all the same, but only rotated 90 deg about the Z axis, the simulation works just fine....

If you can spot my error would be fantastic :D

Merry Christmass to everyone!
It might not work in one configuration(not rotated about z) and work in another(rotated 90deg about z) because you use euler angles for your orientation matrices; FreeCAD uses euler321 angles.
apurvaojas10
Posts: 1
Joined: Mon Jan 04, 2021 4:48 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby apurvaojas10 » Mon Jan 04, 2021 4:55 pm

josegegas wrote:
Tue Dec 29, 2020 1:57 am
I just did a video showing some sample cases put in the workbencg I am working on.

https://www.youtube.com/watch?v=hMCGFkGHnQU

I feel I am almost ready to release the source code and see what people think of it, but honestly I have never used GitHub or anything similar. I don't know much about licenses either. I guess since the software is based on open source software I do not have to worry? It will automatically be under GNU or someting similar? I've just put the text everyone puts at the beginning of the code..

"This program is free software; you can redistribute it and/or modify
it under the terms of the GNU..."

Is this enough?

Cheers...
Hi josegegas

Is this released..?
can we use it..?
josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Sun Jan 10, 2021 10:29 pm

Hello all.

Just one quick question. When one writes the input file for Calculix using the FEM workbench one can see/edit it within FreeCAD, using an "editor". I assume the input file for Calculix is a simple text file? If so, would it be possible to open the input file for MBDyn, within FreeCAD, using the same method?

I ask because by now I am using an external text editor to show the input file to the user. I would like to open it within FreeCAD, as in the FEM workbench, but I can´t figure it out how...

Happy new year to everyone!
josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Mon Jan 11, 2021 3:07 am

apurvaojas10 wrote:
Mon Jan 04, 2021 4:55 pm
josegegas wrote:
Tue Dec 29, 2020 1:57 am
I just did a video showing some sample cases put in the workbencg I am working on.

https://www.youtube.com/watch?v=hMCGFkGHnQU

I feel I am almost ready to release the source code and see what people think of it, but honestly I have never used GitHub or anything similar. I don't know much about licenses either. I guess since the software is based on open source software I do not have to worry? It will automatically be under GNU or someting similar? I've just put the text everyone puts at the beginning of the code..

"This program is free software; you can redistribute it and/or modify
it under the terms of the GNU..."

Is this enough?

Cheers...
Hi josegegas

Is this released..?
can we use it..?
Almost there. I am addapting my code to work both in Linux and Windows. Also learning a bit of GitLab to put the code there and some tutorials...
josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Thu Jan 21, 2021 9:16 pm

Hi.

So the code is now available here:

https://gitlab.com/josegegas/freecad-mb ... -workbench

On Windows just paste the whole thing into your Mod folder and start FreeCAD.

On Ubuntu first install MBDyn and then paste the workbench into your Mod folder. See the README file for details.

You will find a bunch of examples under "Test cases". You should be able to load and run the examples as shown in this video:

https://www.youtube.com/watch?v=hMCGFkGHnQU&t=722s

Be sure you run MBDyn before you animate the model.

Cheers!
abghrnjd
Posts: 21
Joined: Tue Dec 22, 2020 12:02 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby abghrnjd » Fri Jan 22, 2021 8:25 pm

josegegas wrote:
Thu Jan 21, 2021 9:16 pm
Hi.

So the code is now available here:

https://gitlab.com/josegegas/freecad-mb ... -workbench

On Windows just paste the whole thing into your Mod folder and start FreeCAD.

On Ubuntu first install MBDyn and then paste the workbench into your Mod folder. See the README file for details.

You will find a bunch of examples under "Test cases". You should be able to load and run the examples as shown in this video:

https://www.youtube.com/watch?v=hMCGFkGHnQU&t=722s

Be sure you run MBDyn before you animate the model.

Cheers!
Thank you for sharing this amazing workbench.
I opened one of the examples. I get errors related to "MBdynGui.py" file when I click on everything.

'MBdyn_Animate1' failed:
Traceback (most recent call last):
File "C:\Users\Abbas\AppData\Roaming\FreeCAD\Mod\freecad-mbdyn-dynamics-workbench-master\MBdynGui.py", line 316, in Activated
dyn.StartAnimation()


just the code line in error messages are different.
josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Fri Jan 22, 2021 9:39 pm

abghrnjd wrote:
Fri Jan 22, 2021 8:25 pm
josegegas wrote:
Thu Jan 21, 2021 9:16 pm
Hi.

So the code is now available here:

https://gitlab.com/josegegas/freecad-mb ... -workbench

On Windows just paste the whole thing into your Mod folder and start FreeCAD.

On Ubuntu first install MBDyn and then paste the workbench into your Mod folder. See the README file for details.

You will find a bunch of examples under "Test cases". You should be able to load and run the examples as shown in this video:

https://www.youtube.com/watch?v=hMCGFkGHnQU&t=722s

Be sure you run MBDyn before you animate the model.

Cheers!
Thank you for sharing this amazing workbench.
I opened one of the examples. I get errors related to "MBdynGui.py" file when I click on everything.

'MBdyn_Animate1' failed:
Traceback (most recent call last):
File "C:\Users\Abbas\AppData\Roaming\FreeCAD\Mod\freecad-mbdyn-dynamics-workbench-master\MBdynGui.py", line 316, in Activated
dyn.StartAnimation()


just the code line in error messages are different.
line 316 in "MBdynGui.py" only calls the "StartAnimation()" method within "dynamics.py", which at the same time calls the "start()" method in "animation.py". The problem must be in "animation.py".

Do you get any message telling us where in "animation.py" may be the error? I guess this error apperars only when you try to start the animation? Are you using FreeCAD 0.19?
abghrnjd
Posts: 21
Joined: Tue Dec 22, 2020 12:02 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby abghrnjd » Sat Jan 23, 2021 4:10 am

line 316 in "MBdynGui.py" only calls the "StartAnimation()" method within "dynamics.py", which at the same time calls the "start()" method in "animation.py". The problem must be in "animation.py".

Do you get any message telling us where in "animation.py" may be the error? I guess this error apperars only when you try to start the animation? Are you using FreeCAD 0.19?
The workbench does not appear on 0.19 so i'm using 0.18.
Yes, that error happened when I presses animation button. but same error shows up for anything , just the code line ref changes.
josegegas
Posts: 92
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post processor for MBDyn

Postby josegegas » Sat Jan 23, 2021 4:42 am

It does not work well on 0.18. All the examples were created and tested on 0.19. I have just tried on a fresh Ubuntu 20.04 installation with the FreeCAD 0.19 AppImage and it worked. Same on Windows (FreeCAD_0.19.23578-Win-Conda_vc14.x-x86_64). On Windows is easier because one does not need to install MBDyn. Just download FreeCAD 0.19 and paste the workbench into the Mod folder.

I am still curious what may be happening. Do you mind trying with 0.19 and letting me know?