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
Yes, you are right, I think I need a bit more planning and less coding haha. Great advice, thanks!
Re: FreeCAD as pre-post procesor for MBDyn
Try reload(). See here: https://forum.freecadweb.org/viewtopic. ... lit=reloadjosegegas wrote: ↑Wed Nov 20, 2019 5:04 am Hi. Every time I make a change to the code, to test if it works as intended, I have to close FreeCAD and open it again, so that it "loads" the module with the changes... This is making me loose too much time. Is there a way to avoid this? Like forcing FreeCAD to load the module without closing it and opening again? I've tested to go from one workbench to another, but it seems FreeCAD loads all only once. How do you guys work?
Re: FreeCAD as pre-post procesor for MBDyn
Another quick question. Is there any method that gets executed when the user clicks (single click) on a given object in the tree view? What I want to achieve: When the user clicks on an object, some other objects in the 3D scene get highlighted. Is this possible?
Re: FreeCAD as pre-post procesor for MBDyn
I think what you want sounds like is possible but only in C++. That's basically what realthunder did in 0.19. Now when you hover over an object in the tree view, the corresponding element is highlighted in the 3D view.josegegas wrote: ↑Wed Nov 20, 2019 12:08 pm Another quick question. Is there any method that gets executed when the user clicks (single click) on a given object in the tree view? What I want to achieve: When the user clicks on an object, some other objects in the 3D scene get highlighted. Is this possible?
Maybe there is an interface to override this behavior, but I wouldn't know for certain, you'd have to ask realthunder.
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.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: FreeCAD as pre-post procesor for MBDyn
selection observer can handle selections
Code: Select all
class SelObserver:
def addSelection(self,doc,obj,sub,pnt):
print ("Selection added",obj)
s =SelObserver()
FreeCADGui.Selection.addObserver(s) # install the function mode resident
#FreeCADGui.Selection.removeObserver(s) # Uninstall the resident function
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: FreeCAD as pre-post procesor for MBDyn
here an example how I use reload for fast development. I use some naming convention and reloads the implementation file for each call
The class definition - here I only define the interface (parameters)
and the compute fucntion in noteeditor/dev.py
Code: Select all
class FreeCadNodeBase(NodeBase):
'''common methods for FreeCAD integration'''
def __init__(self, name="FreeCADNode",**kvargs):
super(FreeCadNodeBase, self).__init__(name)
self._debug = False
self._preview=False
@timer
def compute(self, *args, **kwargs):
if self._debug:
say("debug on for ",self)
import nodeeditor.dev
reload (nodeeditor.dev)
a=eval("nodeeditor.dev.run_{}(self)".format(self.__class__.__name__))
if self._debug: say("Done:",self)
if self._preview:
say("create preview")
self.preview()
Code: Select all
class FreeCAD_Blinker(FreeCadNodeBase):
'''
blinker sender
'''
def __init__(self, name="baked",**kvargs):
super(self.__class__, self).__init__(name)
self.inExec = self.createInputPin(DEFAULT_IN_EXEC_NAME, 'ExecPin', None, self.compute)
self.outExec = self.createOutputPin(DEFAULT_OUT_EXEC_NAME, 'ExecPin')
self.signal=self.createInputPin('signalName', 'StringPin', 'blink')
self.data=self.createInputPin('signalMessage', 'StringPin')
self.d3=self.createInputPin('signalObject', 'FCobjPin')
self.d3=self.createInputPin('sleep', 'FloatPin')
Code: Select all
def run_FreeCAD_Blinker(self):
....
Re: FreeCAD as pre-post procesor for MBDyn
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
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
Re: FreeCAD as pre-post procesor for MBDyn
josegegas wrote:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: FreeCAD as pre-post procesor for MBDyn
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?
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact: