RoboDK Forum
getDI(io_var) with postprocessor- Printable Version

+- RoboDK Forum (//m.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//m.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//m.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: getDI(io_var) with postprocessor (/Thread-getDI-io-var-with-postprocessor)



getDI(io_var) with postprocessor-JanisP-03-31-2021

I try to integrate digital inputs into my robotprogramm, which is generated by the postprocessor.
As written in the manual for getDI(io_var):This function is only useful when connected to a real robot using the robot driver.
It's logic, that if no robot is connected to RoboDK, getDI has no function in a simulationprogramm. But I could give the simulation a sample value, and work with that. But if I want to get a digital input in an offline robotprogramm, generated with a postprocessor, how could I implement this?


也许代码解释说,我是什么意思了。我得到了a Python-Script which checks, if a DI is true. If it's true, a movement will be started. r is the robot.

Code:
if getDI(2):
r.MoveJ(somePoint)
r.MoveJ(somePoint2)

This code will be interpreted and sent to the postprocessor like this:

Code:
r.RunMessage(r"""getDI(2) command is only available when using the API""", True)
r.MoveJ(somePoint)
r.MoveJ(somePoint2)

Technically, I could catch this RunMessage and I would know, where the if-condition starts. But I got no information about how far the if condition reaches and if MoveJ(somePoint2) was inside of the condition or not. Is there any possibility to get this to work?
Thanks.