FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
Kunda1
Posts: 8739
Joined: Thu Jan 05, 2017 9:03 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby Kunda1 » Fri Feb 07, 2020 12:30 pm

louisgag wrote:
Fri Feb 07, 2020 9:07 am
You're suggesting I write a private message? I already tried two weeks ago, but it just stayed forever in my outbox... maybe because I'm new to the forum?
My post above functioned for the purpose to @mention other users in phpbb (this archaic forum software). josegegas should now get a ping in his forum mail and a ping to his email address (if it's valid) telling him he was mentioned in a forum thread.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby vocx » Fri Feb 07, 2020 6:46 pm

microelly2 wrote:
Fri Feb 07, 2020 10:05 am
No, the receiver died not read the mail yet.
Micro, my man, you have to be very careful with spelling sometimes.

There is a difference between "died" and "did".
microelly2 wrote:
Fri Feb 07, 2020 10:05 am
No, the receiver died ...
microelly2 wrote:
Fri Feb 07, 2020 10:05 am
No, the receiver died not read...
microelly2 wrote:
Fri Feb 07, 2020 10:05 am
No, the receiver did not read...
This reminds me of the contemporary opus, Du Hast.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
mfasano
Posts: 102
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Wed Feb 12, 2020 11:39 am

louisgag wrote:
Thu Feb 06, 2020 2:53 pm
Hi José and everyone,

I read this whole thread and found some quite interesting discussions.
I've been involved with the development of MBDyn and was responsible for the team's participation in GSoC.
We do have another MBDyn pre/postprocessor addon for FreeCAD, but it needs improvement.

I agree with your mention that MBDyn would be suitable as an alternative to animate the currently available assembly options.
To do so, what you want is to build a fully constrained MBDyn model using only static nodes.


-Louis
Hello louisgag;

I don't know what happened to Jose. I had started an MBDyn workbench but suspended my effort because he was much further along, but he suddenly disappeared. I hope it wasn't something like microelly suggested ;)

I looked at your code;
The master branch was the oldest. I had to piece together files from each branch to get what was needed to compete the workbench. I changed things to get the workbench to run. I don't think it will write a viable MBDyn input file.

Initial values and elements etc. are assigned when the work bench is activated; they get reset when you go to another workbench and then back to MBDyn. I think you need longer lasting objects, perhaps save it to a spreadsheet, or in scripted objects.

I think the commands creating the dialogs were misnamed. The dialog where you configure the model was called launchGui, and the dialog that starts MBDyn was called configure. I changed that.

As far as I can see, the only joint you have code for is the total joint.

I could not get the icon for the configure command to show.

I setup a github repo for my changes.
https://github.com/mfasano727/MBDynFCwb/tree/master

I am thinking assembly4 might be paired with MBDyn. It does not use a constraint solver.
josegegas
Posts: 43
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post procesor for MBDyn

Postby josegegas » Thu Feb 13, 2020 7:03 pm

louisgag wrote:
Thu Feb 06, 2020 2:53 pm
Hi José and everyone,

I read this whole thread and found some quite interesting discussions.
I've been involved with the development of MBDyn and was responsible for the team's participation in GSoC.
We do have another MBDyn pre/postprocessor addon for FreeCAD, but it needs improvement.
Because of that, it would be nice if you could release the code, even if it is not production-ready, so that we and others can build on it. (We are planning on participating in GSoC again this year)

I agree with your mention that MBDyn would be suitable as an alternative to animate the currently available assembly options.
To do so, what you want is to build a fully constrained MBDyn model using only static nodes.

Send me an email if you want to discuss this further and I'll get you in touch with the main developer of pre- and post-processing solutions for MBDyn.

Kind regards,

-Louis
Hello Louis!

Sorry about my late reply. I have been very busy since mid December... But getting better now, and planning to get back working on the MBDyn integration! It would be fantastic if we could work together! I still havent released the code yet, only because it is still a bit of a mess. I am also working on the documentation/manual, but still in early stages too. One limitation I have is that Im not very confident codding MBDyn yet. I mean, I can write most of the basic simulations and assemblies, but not very complex stuff yet. As you have probably seen in my videos, the workbench now allows create all the basic simulations, plot results, etc... I still have some problems with orientations, converting all the methods MBDyn has to define orientations into Euler angles for FreeCAD was one of the objective I had in mind a couple of months ago, but never started codding....

I will get back into this project soon :D

Cheers!
josegegas
Posts: 43
Joined: Sat Feb 11, 2017 12:54 am
Location: New Zealand

Re: FreeCAD as pre-post procesor for MBDyn

Postby josegegas » Thu Feb 13, 2020 7:06 pm

Pd. Does anyone have any idea on how to install/compile? MBDyn under Windows? Not sure if not being able to execute it in Windows will be a limitation? I do not have any issue working only with Linux, but this may reduce the number of people using/interested on the workbench, no?
vocx
Posts: 5206
Joined: Thu Oct 18, 2018 9:18 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby vocx » Thu Feb 13, 2020 10:38 pm

josegegas wrote:
Thu Feb 13, 2020 7:06 pm
...Not sure if not being able to execute it in Windows will be a limitation?...
It seems the authors themselves don't use Windows too much, so in any case whoever uses this "body dynamics" workbench in FreeCAD will probably use MBDyn in Linux.

Building in Windows with Cygwin should be the same as building in Linux with GCC so I guess we just need somebody willing to try. I don't have a Windows machine to try this, unfortunately.

Frequently Asked Questions about MBDyn
MBDyn wrote: Does MBDyn run on Windows?
MBDyn is developed keeping standard C++ in mind and using free development tools like GNU's gcc/g++/gfortran and autotools. Nothing should prevent it from building under Windows, provided the standard headers and the C/C++ standard library are available.

Having said this, no one of the developers ever tried to build it using Windows-specific compilers, like Visual Studio. As explained here, MBDyn can be built for Windows using MSYS/MinGW or Cygwin. Note that currently the MSYS/MinGW build does not support networking, so no MATLAB/Simulink interface is available. Volunteers are welcome to work on adding Winsock support.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
mfasano
Posts: 102
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Fri Feb 14, 2020 12:26 am

josegegas wrote:
Thu Feb 13, 2020 7:06 pm
Pd. Does anyone have any idea on how to install/compile? MBDyn under Windows? Not sure if not being able to execute it in Windows will be a limitation? I do not have any issue working only with Linux, but this may reduce the number of people using/interested on the workbench, no?
Here are instructions for installing mbdyn using Windows 10's windows linux shell(WLS). I don't know if you can run a program in WLS from a windows program. You could run FreeCAD in the linux shell.

https://github.com/zanoni-mbdyn/blendyn ... yn#windows
louisgag
Posts: 47
Joined: Fri Jan 17, 2020 9:59 am

Re: FreeCAD as pre-post procesor for MBDyn

Postby louisgag » Mon Feb 17, 2020 2:02 pm

Hi Jose and M,

I'm glad both of you are motivated with the MBDyn implementation.

On windows you can use this unofficial build of MBDyn, but be aware that you will get no support from the developers for Windows-related problems.

I was neither the person who developed nor mainly supervised the FreeCAD-MBDyn workbench developed for GSoC, but I am pretty sure more that just the total joint was there (the Workbench was however not really functional).

In the meantime, if you have questions to the development I will do my best to answer or ask the main supervisor of the GSoC-MBDyn-FreeCAD to drop-in here and give some wise tips.
louisgag
Posts: 47
Joined: Fri Jan 17, 2020 9:59 am

Re: FreeCAD as pre-post procesor for MBDyn

Postby louisgag » Mon Mar 09, 2020 8:42 am

MBDyn is once again participating in GSoC, so if a student (any level) is interested in further developing the FreeCAD-MBDyn interface and being paid for it, it would be time to start chatting with MBDyn's developers, in particular with the mentor (see link above).
User avatar
mfasano
Posts: 102
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Wed Mar 25, 2020 9:38 am

I have been working on preprocessing MBDyn with FreeCAD. I have modified MBDyn's GSOC project by experimenting with scripted objects. The MBDyn model gets saved in scripted objects. A write command used the scripted objects to write a MBDyn input file. I have a command to create rigid bodies; when you create a rigid body it also created a structural node at the center of gravity with an orientation rotated as the part is in FreeCad. A command to create structural nodes I haven't used it because I create a node with the rigid body. I don't use the reference command either, because the rigid body uses the reference of the node it refers to. The nodes are to be in absolute coordinates. I have commands to create revolute pin and revolute hinge joints.

I will try to write how to use it. I am having trouble using the freeCAD model to get the right positions in the MBDyn input. I get an error "initial derivative calculation 1 does not converge". Increasing the derivative tolerance fixes it but I don't think it should need it.

The todo list is endless. I am sure the program is infested with bugs. post-processing is obvious item.

Here is the code.
https://github.com/mfasano727/MBDynFCwb