Is it possible to add methods from a trusted module to a python featured object
Something like this:
Code: Select all
c3.addProperty("App::PropertyMethod","key","MyProps","")
c3.key=myModule.myMethod
....
c3.key(args)
Code: Select all
c3.addProperty("App::PropertyMethod","key","MyProps","")
c3.key=myModule.myMethod
....
c3.key(args)
No, the code is NOT serialized because of two reasons:As far as I understood "Scripted Objects" http://freecadweb.org/wiki/index.php?ti ... ed_objects the code is serialized and saved together with the object. So if one later reads the object the code will get materialized again and can be invoked.
I am wondering how this works. Is there an hands-on instruction how to work with those scripted objects? From the wiki I cannot grasp it.wmayer wrote: No, the code is NOT serialized ...
Properties are stored as for c++ objects in XML. Attributes of the proxy are serialized using JSON. git commit 7032f5f329f1atzensepp wrote:I am wondering how this works. Is there an hands-on instruction how to work with those scripted objects? From the wiki I cannot grasp it.
I have started a new project here: http://freecadbuch.de/doku.php?id=Sipocatzensepp wrote: B.t.w.: Do you provide a download of your code?
Code: Select all
dir__='/usr/lib/freecad/Mod/mylib'