Universal Robots Forum

Reuse method defined in generateScript() many times

I am trying to use the writer from generateScript(…) to write a function and call it many times later on. I need the function to receive a pose as parameter. Though writer.defineFunction only accepts the function name, no parameters. plus writer.returnMethod() is unable to return a value. I know these functionalities are supported in urscript. is there anyway to do it through the writer?

The obvious workaround (which I haveny tried but I believe should work) is to use writer.appendLine or writer.appendRaw and write everything I want through there, but I was wondering if there was a better way to do it.

Hi ocohen

did you have a look at the example: scriptfunctionswing?
API: com.ur.urcap.api.domain.function

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.