FreeCAD as pre-post processor for MBDyn

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: FreeCAD as pre-post processor for MBDyn

Postby mfasano » Wed Jul 29, 2020 1:10 pm

louisgag wrote:
Tue Jul 28, 2020 7:55 pm
@mfasano and @T-Garnier
I've tried the addon quickly, it's a nice start.
I would recommend you provide a step-by-step example.
This will allow more people to try it and give feedback or code... perhaps you'll get some important tips.
I for myself find it somewhat difficult to understand even the simplest task of creating a body.
I don't have much experience with assembly4, but probably many users don't since it's still only in the development version.
Thanks for trying it out.

Writing a tutorial is a priority. I will make that my highest priority. T-Garnier suggested this too. I have made a recent update, no new elements, just minor changes. I will update instructions in the repository's wiki.

I decided to use assembly4 as a base because there is no constraint solver, MBDyn takes care of that, and The LCSs that define the constraints make it so I can set position and orientation with a click instead of calculating and typing in several input fields.

Two things about using Assembly4 with this workbench. You need to create the bodies inside the Assembly4; I do this because I don't know if I can get properties like center of mass or moment of inertia from a part in a linked file. There is discussion about doing this in the assembly 4 thread; post 675 gives instructions to do it.
https://forum.freecadweb.org/viewtopic. ... &start=260
A popular way to use assembly 4 is to create a master sketch and place LCSs in key points, and then link LCSs of parts to the LCSs on Master sketch. I don't do this. I calculate positions and orientations relative the the node, usually at the center of mass. It is easier when the LCS is on the part. I may look in to having the calculations of position and orientations more general. I use the LCSs that are directly in the parent assembly as fixed reference frames and nodes.
User avatar
mfasano
Posts: 88
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby mfasano » Sun Aug 02, 2020 3:00 pm

I have included a tutorial in a page of the wiki.
https://github.com/mfasano727/MBDynFCwb ... m-Tutorial

I hope it is helpful.
User avatar
mfasano
Posts: 88
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby mfasano » Wed Aug 26, 2020 11:24 pm

I have made a mechanism other than a pendulum. It is a slide crank. I had to add quite a few MBDyn elements. to get it. I added commands for a clamp joint, an axial revolution joint, an in line joint, a prismatic joint and a ramp drive caller. I used the slide crank example in Sky Engineering's MBDyn tutorial. http://www.sky-engin.jp/en/MBDynTutorial/index.html. It is an extensive tutorial and there are a lot of examples on there site too. I have updated the repo. with the new commands. I will update the command instructions and maybe another tutorial soon. Here is a link to an animation of the slide crank. I have also included the FreeCAD file and the MBDyn input file.
phpBB [video]
I tried to use the total joints to make the slide crank as well as other examples, but couldn't get it to work. I am going to make getting the total joints working a priority.

I found a bug that has not been fixed in this latest update. The parts in the parts group of the assembly 4 file can't have an attachment offset other than 0 position offset and 0 angle. If it is, the node position and orientation is off.
Attachments
input_SCz.txt
(3.63 KiB) Downloaded 11 times
slide_crankZ.FCStd
(60.19 KiB) Downloaded 10 times
Last edited by Kunda1 on Wed Aug 26, 2020 11:31 pm, edited 1 time in total.
Reason: Put clip in video bbcode
louisgag
Posts: 45
Joined: Fri Jan 17, 2020 9:59 am

Re: FreeCAD as pre-post processor for MBDyn

Postby louisgag » Thu Aug 27, 2020 6:58 am

Your video shows nice progress. When you have it ready I'll try the new tutorial and give feedback.
  • Does your code structure allow easy addition of new joints?
  • What is the issue you're facing with the total joint?
  • Is the bug you are referring to is in the FreeCAD daily assembly4 workbench?
It's still a bit early to talk about GSoC2021, but if you want to try mentoring for MBDyn you should mention that to Andrea Zanoni, he's the most interested in a FreeCAD addon and getting on the same page before the application period can't hurt!
User avatar
mfasano
Posts: 88
Joined: Wed Apr 11, 2018 12:31 pm

Re: FreeCAD as pre-post processor for MBDyn

Postby mfasano » Thu Aug 27, 2020 4:30 pm

louisgag wrote:
Thu Aug 27, 2020 6:58 am
Your video shows nice progress. When you have it ready I'll try the new tutorial and give feedback.
  • Does your code structure allow easy addition of new joints?
  • What is the issue you're facing with the total joint?
  • Is the bug you are referring to is in the FreeCAD daily assembly4 workbench?
The code structure does not make it easy to add new MBDY elements. I hope to improve that. There is a lot of code that gets repeated for each joint; I will try to put them in reusable functions.

I think it is that I don't know how to implement the total joints. I am a novice at MBDyn.

The bug is not and asm4 problem; it is my code.


It's still a bit early to talk about GSoC2021, but if you want to try mentoring for MBDyn you should mention that to Andrea Zanoni, he's the most interested in a FreeCAD addon and getting on the same page before the application period can't hurt!
I will be updating Andrea on my progress soon. It has been a while. He seems more interested in using python to make it easier to write the input file than using FreeCAD. I was considering my classes inheriting his python classes, but I found it easier to write them from scratch. It is not to late to attempt that.