05-17-2021, 02:09 PM
(05-11-2021, 07:14 AM)Kosiahn Wrote:(05-10-2021, 09:08 PM)Albert Wrote: Try changing the line that causes issues for this:
Code:set_standard_digital_out(5, False)
Hello,
i changed this and all the other lines by hand and it works.
I wonder about this because there is code in the postprocessor that is supposed to solve this.
def setDO(self, io_var, io_value):
"""Set a Digital Output"""
if type(io_value) != str: # set default variable value if io_value is a number
if io_value > 0:
io_value = 'True'
else:
io_value = 'False'
if type(io_var) != str: # set default variable name if io_var is a number
newline = 'set_standard_digital_out(%s, %s)' % (str(io_var), io_value)
else:
newline = '%s = %s' % (io_var, io_value)
self.addline(newline)
Hello, I have found the mistake. This was in the code I have added from your manual page (https://robodk.com/doc/en/Robot-Machinin...rint3Dpost).
# Update the extruder speed when required
if self.PRINT_LAST_SIGNAL is Noneor abs(extruder_signal - self.PRINT_LAST_SIGNAL) > 1e-6:
self.PRINT_LAST_SIGNAL = extruder_signal
# Use the built-in setDO function to set an analog output
self.setDO(self.PRINT_E_AO,"%.3f" % extruder_signal)
# Alternatively, provoke a program call and handle the integration with the robot controller
#self.addline('ExtruderSpeed(%.3f)' % extruder_signal)
On the one hand, not the analog output is angesprocehn but the digital, I'll come back to that in a moment. When the digital output is called, the variable extruder_signal is converted to a string by "%.3f" and therefore falls through the query for a string in the "def set.DO" function.
More correctly it is therefore as follows
self.setDO(self.PRINT_E_AO, extruder_signal)
Now to the analog output this is defined as follows and must be reprogrammed.
def setAO(self, io_var, io_value):
"""Set an Analog Output"""
self.setDO(io_var, io_value)
Since in "def setDO" always a digital output is called, no analog output can be called here by this function, also the query for a string in this function is not needed for the analog output.