Question

From attribute to published parameter

  • 24 August 2016
  • 6 replies
  • 1 view

Badge

I have a project wich produced a parameter I need in the shutdown python script. The problem is I cannot use it. Maybe I can but I don't know the protocole.

A solution would be to "send" the attribute into a published parameter and then use the published parameter into the python script.

But I dn't know how to do the "send" in this scenario.

Any ideas?

FYI : the attribute become a published parameter in a following workspace. Maybe I can catch it from there.


6 replies

Userlevel 4

It is not possible to modify the contents of private or published parameters while the workspace is running.

A possible solution could be to use a PythonCaller in your workspace to store feature attributes in a global object (e.g. a list or a dictionary), then reference the same global object in your shutdown script.

Userlevel 2
Badge +17

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

Userlevel 2
Badge +17

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

wow, completely same as David's suggestion :)

 

Userlevel 2
Badge +17

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

Example

 

# PythonCaller Script
def processFeature(feature):
    global value
    value = feature.getAttribute("attr")
# Shutdown Python Script
print value
Badge

It is not possible to modify the contents of private or published parameters while the workspace is running.

A possible solution could be to use a PythonCaller in your workspace to store feature attributes in a global object (e.g. a list or a dictionary), then reference the same global object in your shutdown script.

It works fine. Thanks both of you.

 

 

Badge

Hi @slerendu, published/private user parameters are configured before starting translation and you cannot set/change them in the translation process unfortunately. A workaround is to define a Python global variable with a PythonCaller. The global variable can be used in Shutdown Pyhon script.

It works fine. Thanks both of you.

 

 

Reply