FreeCAD as pre-post processor for MBDyn
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: FreeCAD as pre-post procesor for MBDyn
Here is a test model and resulting input file. It is a double pendulum . I didn't bother to change the units; I guess MBDyn uses SI units, FreeCAD uses mm for length.
- Attachments
-
- test_MBDyn.FCStd
- (9.86 KiB) Downloaded 60 times
-
- input.txt
- (1.79 KiB) Downloaded 76 times
Re: FreeCAD as pre-post procesor for MBDyn
Would it be possible to structure the code how the current Draft Workbench does it?mfasano wrote: ↑Wed Mar 25, 2020 9:38 am ...
Here is the code.
https://github.com/mfasano727/MBDynFCwb
I think many workbenches just throw their files in the root directory and this is very messy. Also many combine graphical code with generic non-GUI code. For maximum flexibility, it's best to keep them separate.
For example, the basic structure that I suggest is the following.
Code: Select all
MBDynFC/
InitGui.py
mbdyn_objects/
mbdyn_guitools/
mbdyn_utilities/
The problem with putting everything in the root directory is that it's messy, and moreover it is in a general namespace. If another module has the same module names, they may clash. Placing the modules inside subdirectories helps a lot with this issue, you just need to modify the imports.
Code: Select all
import mbdyn_guitoos.ref_cmd
See how Draft makes it. See the code of draftguitools/gui_polararray.py, which internally calls drafttaskpanels/task_polararray.py, which is the one importing the appropriate .ui file.
Also, you could take it even further and already prepare the workbench as a "namespace workbench". This is a new style of writing workbenches. See https://github.com/FreeCAD/freecad.workbench_starterkit
Basically, the entire structure is inside a freecad folder.
Code: Select all
freecad/
mbdynfc/
init_gui.py
mbdyn_objects/
mbdyn_guitools/
mbdyn_utilities/
Last edited by vocx on Wed Mar 25, 2020 9:43 pm, edited 1 time in total.
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.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Re: FreeCAD as pre-post procesor for MBDyn
I will restructure my code. I will not be using the namespace workbench at this time.
Thanks vocx.
Thanks vocx.
vocx wrote: ↑Wed Mar 25, 2020 7:03 pm
Would it be possible to structure the code how the current Draft Workbench does it?
I think many workbenches just throw their files in the root directory and this is very messy. Also many combine graphical code with generic non-GUI code. For maximum flexibility, it's best to keep them separate.
For example, the basic structure that I suggest is the following.Code: Select all
MBDynFC/ InitGui.py mbdyn_objects/ mbdyn_guitools/ mbdyn_utilities/
Re: FreeCAD as pre-post procesor for MBDyn
Thanks for sharing your code.
I loaded the workbench but could not do much as the dialogs don't seem to do anything when I press "ok".
I'm on Linux, FreeCAD 18.4
I loaded the workbench but could not do much as the dialogs don't seem to do anything when I press "ok".
I'm on Linux, FreeCAD 18.4
Re: FreeCAD as pre-post procesor for MBDyn
I am in the process of writing instructions in the wiki of repository. I am a windows user, and I am using version 19. I don't know if that is the problem. You need to start with the IVP command and set initial values. when you click ok there it creates an initial values object as well as a few folders for other objects. You can see them in the tree view.
I reached out to Andrea Zanoni. I have not heard from him, but it was only yesterday. Do you have a GSOC student yet?
I reached out to Andrea Zanoni. I have not heard from him, but it was only yesterday. Do you have a GSOC student yet?
Re: FreeCAD as pre-post procesor for MBDyn
We have potential students, yes, but sometimes projects can be divided in more parts.
Are you asking because you are interested?
Are you asking because you are interested?
Re: FreeCAD as pre-post procesor for MBDyn
I am interested in helping out. I don't care if you use any of my code. I think Jose is further a long anyway. I was just experimenting with storing the MBDyn inputs in scripted objects. I'm wondering if a spread sheet may be a better way to store the data. Another way is write code that reads the input file, and then you can make changes if you like.
Re: FreeCAD as pre-post procesor for MBDyn
Ok that's nice of you. Just make sure Zanoni is in the loop, otherwise you risk going on a tangent that he doesn't approve of and, as is often the case with open-source software, end up developing you own code which has nothing to do with the original one anymore. I told him you go in touch with him but he said me he didn't hear from any Fasano, did I get your name right?
I've tried your version of the wqorkbench again, something works indeed (interestingly not with 0.19, that gives a segmentation fault).
What I did notice by browsing your code is that you probably forked the master branch of the MBDynFreeCADGUI Gitlab, but most of what was done in the GSoC project is in the other branches. I thkink you lost a lot of already done work that way. Have a look at this branch for example: https://gitlab.com/zanoni-mbdyn/mbdynfr ... odel-class
I've tried your version of the wqorkbench again, something works indeed (interestingly not with 0.19, that gives a segmentation fault).
What I did notice by browsing your code is that you probably forked the master branch of the MBDynFreeCADGUI Gitlab, but most of what was done in the GSoC project is in the other branches. I thkink you lost a lot of already done work that way. Have a look at this branch for example: https://gitlab.com/zanoni-mbdyn/mbdynfr ... odel-class
Re: FreeCAD as pre-post procesor for MBDyn
I will rewrite Zanoni. I will CC you.louisgag wrote: ↑Thu Mar 26, 2020 7:01 pm Ok that's nice of you. Just make sure Zanoni is in the loop, otherwise you risk going on a tangent that he doesn't approve of and, as is often the case with open-source software, end up developing you own code which has nothing to do with the original one anymore. I told him you go in touch with him but he said me he didn't hear from any Fasano, did I get your name right?
I've tried your version of the wqorkbench again, something works indeed (interestingly not with 0.19, that gives a segmentation fault).
What I did notice by browsing your code is that you probably forked the master branch of the MBDynFreeCADGUI Gitlab, but most of what was done in the GSoC project is in the other branches. I thkink you lost a lot of already done work that way. Have a look at this branch for example: https://gitlab.com/zanoni-mbdyn/mbdynfr ... odel-class
I do not know why the code will not work. I do not have access to linux machine. I will try it on a Mac soon.
I pieced together code from all the branches in the your link to get close to a complete workbench the bulk of the code was in one newer file MBDynModel.py. I only used part of that file; it is in the file model_so.py in my code.
I have updated the code per vocx as well as fixed spelling errors in the dialogs. The biggest change was to make so only the fields in the orientation matrix input that are needed given the orientation matrix type are visible. I will continue with writing instructions.
Re: FreeCAD as pre-post procesor for MBDyn
@louisgag;
I emailed Zanoni using the address he has on his profile I got by selecting his name in the team list in the MBDyn web site. I did not include you.
I emailed Zanoni using the address he has on his profile I got by selecting his name in the team list in the MBDyn web site. I did not include you.