FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
mfasano
Posts: 79
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Wed Apr 15, 2020 11:49 pm

I added a new branch for my MBDyn pre-processor. It is called asm4. It creates an MBDyn input file from a FreeCAD model created with assembly4. I thought it would make it easier to set up the MBDyn elements with it. I am not sure I am calculating the orientation matraces right. They work for my test case, but I'm not sure it will work in the general case. I will need to make more tests. My concern is the the euler angles for FreeCAD are in ZY'X'' order and I make the MBDyn input file orientation matraces in the XY'Z'' order. I am afraid you can't switch the order in general.

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

There are a lot less input fields with this version. I was thinking Assembly 4 would be good because there is no constraint solver. The contraints are alignments of local coordinate systems(LCS). I use the LCS to calculate the position and orientation matraces of the MBDyn elements. I will try to write instructions for this soon.

For my next trick I would like to add FeaturePython App::PropertyLink to the FreeCAD object associated with the MBDyn elements. Then, as the FreeCAD model changes, the MBDyn scripted objects can change with it. This may be a little ambitious.

I really need to get post processing done. I will make that a priority.
User avatar
mfasano
Posts: 79
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Sun May 03, 2020 1:50 pm

I added post processing to the ASM4 branch to my code. There would not be too many changes to add the post processing to the branch that does not use Assembly4, but I like Assembly4. I fixed the problem I had with orientation matraces of the joints by switching to 2 vector instead of Euler angles description. I will be writing instructions for the ASM4 branch very soon.

Here are some videos of pendulums I made. They seem to be in slow motion; I will need to look in to that.

phpBB [video]


phpBB [video]
HoWil
Posts: 1099
Joined: Sun Jun 14, 2015 7:31 pm
Location: Austria

Re: FreeCAD as pre-post procesor for MBDyn

Postby HoWil » Sun May 03, 2020 7:29 pm

Looks very nice.
How difficult is this to achieve? Is this hardcoded an to what extend?
Thanks in advance.
User avatar
mfasano
Posts: 79
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Mon May 04, 2020 9:33 am

It is simple once you have an assembly4 model. There are few input fields you need to type. I only have code for revolute joints so it is very limited, but FreeCAD and MBDyn are comprehensive. I may try a 4-bar linkage as an example next. I should have instructions soon.
T-Garnier
Posts: 1
Joined: Sat Jun 27, 2020 5:30 am

Re: FreeCAD as pre-post procesor for MBDyn

Postby T-Garnier » Sat Jun 27, 2020 6:27 am

Hello mfasano,

I am interested to help in the development of the pre/post procesor mbdyn/freeCAD if the project is still ongoing. Did you get in contact with the mbdyn developer team? if yes, is the project "validated"? Who could I help you on the project?

Regards,
Thomas
User avatar
mfasano
Posts: 79
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Sun Jun 28, 2020 7:34 pm

T-Garnier wrote:
Sat Jun 27, 2020 6:27 am
I am interested to help in the development of the pre/post procesor mbdyn/freeCAD if the project is still ongoing. Did you get in contact with the mbdyn developer team? if yes, is the project "validated"? Who could I help you on the project?
I am still working on it. I have created code to add the total joint and the total pin joint. the total joint is like a joint for all seasons. you should be able to simulate any mechanism with rigid bodies. I tried to model a slide crank mechanism but couldn't get it to work. I did get the pendulums to work with the total joints. I am now trying to do the slide crank with the more traditional inline and prismatic joints.

I have been in contact with Andrea Zanoni. He is working on a library of python code for preprocessing as well as FreeCAD . I started using some of that, but find it easier to write from scratch. I was hoping he would get a Google summer of code student to work on the FreeCad preprocessor, but it did not pan out. I have signed up for the MBDyn email list; asked them about the slide crank. They pointed out my model was over constrained and gave a couple of hints. I did not follow up with them.

I will put what I have on the ASM4 branch of my Github repo soon, even though I can't get the new stuff working. I will post here when have done that. I of course welcome any help given.
User avatar
mfasano
Posts: 79
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post procesor for MBDyn

Postby mfasano » Sat Jul 04, 2020 1:50 pm

I put what I have on the asm4 branch
https://github.com/mfasano727/MBDynFCwb/tree/asm4

I added the total joint and the total pin joint. I will add instructions for those soon. The commands for the axial rotation and the ramp drive caller do not work. I am working on an inline joint and a prismatic joint.

There are many ways other than add more MBDyn elements to improve the workbench.
Here is a list, not in order of importance.

make the workbench compatible with the new namespace workbench.
add idiot proof er uh exception handling (am I dating myself?) like making line editors in pyside only accept numbers where applicable.
make it so you can run MBDyn directly from FreeCAD. This was discussed on page 4 of this thread, so it shouldn't be hard.
include more in the post processing, like force and torque indicators. code for graphing velocity, acceleration etc.
add names to the MBDyn scripted objects and use them as variables in the input file to make it more readable
write/film a tutorial to show how to use the workbench.
use Propertylink in the MBDyn objects so they can change with the FreeCAD model.
test, test, test