FeaturePython / Scripted Object question

Need help, or want to share a macro? Post here!
User avatar
Joel_graff
Posts: 1121
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

FeaturePython / Scripted Object question

Postby Joel_graff » Mon Feb 11, 2019 1:59 pm

I have a custom feature python object with a custom function and property. If I create the object, the property is exposed, but the function is not. I have a need to run a FeaturePython object function directly from outside the object itself (rather than letting it be called from execute() or some other event callback).

As I understand FPO's, I don't think that's possible. But just in case I'm wrong, I thought I'd ask.
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails
User avatar
Chris_G
Posts: 966
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: FeaturePython / Scripted Object question

Postby Chris_G » Mon Feb 11, 2019 3:06 pm

You should be able to call your function through the Proxy object :

Code: Select all

my_FPO.Proxy.my_function()
User avatar
Joel_graff
Posts: 1121
Joined: Fri Apr 28, 2017 4:23 pm
Contact:

Re: FeaturePython / Scripted Object question

Postby Joel_graff » Mon Feb 11, 2019 5:44 pm

Chris_G wrote:
Mon Feb 11, 2019 3:06 pm
You should be able to call your function through the Proxy object :
Gotcha. Works as expected. Thanks.
You can find the FreeCAD Trails workbench for transportation engineering on my github at:
https://www.github.com/joelgraff/freecad.trails