CS-Lab Support Forum for CNC Community
Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help!
Error message
Quote from carbonkid on 11 August 2024, 20:57What does the error message mean? It says that the error in line 75 is something wrong?
G91
Probing Z: Schnelltasten-Code = G31.1 Z-20.0 F300.0
Traceback (most recent call last):
File "C:\Program Files\simCNC\profiles\CNC\scripts\___INIT.py", line 34, in <module>
exec(open(fileName, encoding='utf-8').read())
File "<string>", line 115, in <module>
File "<string>", line 75, in Probing_Z
File "C:\Program Files\simCNC\profiles\CNC\scripts\___DEVICE.py", line 175, in getDigitalIO
return DIOPinVal[self.comm.sendAndWait( "getDigitalIO:" + direction.name + ':' + str(digitalPin) + ':' + self.type + ';' + self.id )]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\simCNC\profiles\CNC\scripts\___COMM.py", line 189, in sendAndWait
raise SimCncException(":".join(res[1:]))
___EXCEPTION.SimCncException: ' Wrong argument 2 type, expected int'
Script C:\Program Files\simCNC\screens\carbonkid_vertical_de_v016_Test_experimentell\scripts\m501_2.py execution error (Unknown error: 1).This is the function from the script and I marked line 75 in red:
def Probing_Z():
# Z-probing fast
GCode="G31.1 Z-" + str(searchDistance) +" F" + str(touch_fast)
print("Probing Z: Schnelltasten-GCode = ", GCode)
move = d.executeGCode(GCode)
# Probing ok?
mod_IP = d.getModule(ModuleType.IP, 0)
if mod_IP.getDigitalIO( IOPortDir.InputPort, touchProbe) == DIOPinVal.PinSet:
sys.exit("Probing Z: Tasten: Fehler Z-Achse!!")
else:
print("Probing Z: Tasten ok")# Saving the fast measurement
fast_measurement = d.getPosition(CoordMode.Machine)[2]# Move Z on top
GCode="G01 Z" + str(goUpDistance) +" F" + str(vel_Zreturn)
time.sleep(0.5)
print("Probing Z: Fahre Z nach oben ", GCode)
move = d.executeGCode(GCode)# Z-probing slow
GCode="G31.1 Z-" + str (searchDistance) +" F" + str(touch_slow)
print("Probing Z: Langsamtasten-GCode = ", GCode)
move = d.executeGCode(GCode)
# Probing ok?
mod_IP = d.getModule(ModuleType.IP, 0)
if mod_IP.getDigitalIO( IOPortDir.InputPort, touchProbe) == DIOPinVal.PinSet:
sys.exit("Probing Z: Tasten: Fehler Z-Achse!!")
else:
print("Probing Z: Tasten ok")# Saving the slow measurement
slow_measurement = d.getPosition(CoordMode.Machine)[2]# Comparison of measurements
difference = abs(fast_measurement - slow_measurement)
if difference > max_difference:
sys.exit(f"Probing Z: Fehler - Unterschied zwischen schneller und langsamer Messung ({difference:.3f} mm) überschreitet den Grenzwert ({max_difference:.3f} mm)")d.setAxisProgPosition(Axis.Z, 0)
pos=d.getPosition(CoordMode.Program)
posz = pos[2]
print("Probing Z: Position Z = ", posz)# Move Z on top
GCode="G01 Z" +str(zSafeHeight) +" F" +str(vel_Zreturn)
print("Probing Z: Fahre Z nach oben ", GCode)
move = d.executeGCode(GCode)
print("Z Nullpunkt erfolgreich gesetzt.")
What does the error message mean? It says that the error in line 75 is something wrong?
G91
Probing Z: Schnelltasten-Code = G31.1 Z-20.0 F300.0
Traceback (most recent call last):
File "C:\Program Files\simCNC\profiles\CNC\scripts\___INIT.py", line 34, in <module>
exec(open(fileName, encoding='utf-8').read())
File "<string>", line 115, in <module>
File "<string>", line 75, in Probing_Z
File "C:\Program Files\simCNC\profiles\CNC\scripts\___DEVICE.py", line 175, in getDigitalIO
return DIOPinVal[self.comm.sendAndWait( "getDigitalIO:" + direction.name + ':' + str(digitalPin) + ':' + self.type + ';' + self.id )]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\simCNC\profiles\CNC\scripts\___COMM.py", line 189, in sendAndWait
raise SimCncException(":".join(res[1:]))
___EXCEPTION.SimCncException: ' Wrong argument 2 type, expected int'
Script C:\Program Files\simCNC\screens\carbonkid_vertical_de_v016_Test_experimentell\scripts\m501_2.py execution error (Unknown error: 1).
This is the function from the script and I marked line 75 in red:
def Probing_Z():
# Z-probing fast
GCode="G31.1 Z-" + str(searchDistance) +" F" + str(touch_fast)
print("Probing Z: Schnelltasten-GCode = ", GCode)
move = d.executeGCode(GCode)
# Probing ok?
mod_IP = d.getModule(ModuleType.IP, 0)
if mod_IP.getDigitalIO( IOPortDir.InputPort, touchProbe) == DIOPinVal.PinSet:
sys.exit("Probing Z: Tasten: Fehler Z-Achse!!")
else:
print("Probing Z: Tasten ok")
# Saving the fast measurement
fast_measurement = d.getPosition(CoordMode.Machine)[2]
# Move Z on top
GCode="G01 Z" + str(goUpDistance) +" F" + str(vel_Zreturn)
time.sleep(0.5)
print("Probing Z: Fahre Z nach oben ", GCode)
move = d.executeGCode(GCode)
# Z-probing slow
GCode="G31.1 Z-" + str (searchDistance) +" F" + str(touch_slow)
print("Probing Z: Langsamtasten-GCode = ", GCode)
move = d.executeGCode(GCode)
# Probing ok?
mod_IP = d.getModule(ModuleType.IP, 0)
if mod_IP.getDigitalIO( IOPortDir.InputPort, touchProbe) == DIOPinVal.PinSet:
sys.exit("Probing Z: Tasten: Fehler Z-Achse!!")
else:
print("Probing Z: Tasten ok")
# Saving the slow measurement
slow_measurement = d.getPosition(CoordMode.Machine)[2]
# Comparison of measurements
difference = abs(fast_measurement - slow_measurement)
if difference > max_difference:
sys.exit(f"Probing Z: Fehler - Unterschied zwischen schneller und langsamer Messung ({difference:.3f} mm) überschreitet den Grenzwert ({max_difference:.3f} mm)")
d.setAxisProgPosition(Axis.Z, 0)
pos=d.getPosition(CoordMode.Program)
posz = pos[2]
print("Probing Z: Position Z = ", posz)
# Move Z on top
GCode="G01 Z" +str(zSafeHeight) +" F" +str(vel_Zreturn)
print("Probing Z: Fahre Z nach oben ", GCode)
move = d.executeGCode(GCode)
print("Z Nullpunkt erfolgreich gesetzt.")
Quote from CS-Lab Support on 13 August 2024, 07:20Python told you exactly what it doesn't like :
___EXCEPTION.SimCncException: ' Wrong argument 2 type, expected int'
Probably the variable "touchProbe" is not an int (not an integer)
Python told you exactly what it doesn't like :
___EXCEPTION.SimCncException: ' Wrong argument 2 type, expected int'
Probably the variable "touchProbe" is not an int (not an integer)
Quote from carbonkid on 13 August 2024, 11:18Oh yes, great, thank you. I already understood it but still didn't see the error. The line for touchProbe looked like this: touchProbe = (d.getMachineParam(321)). I forgot to write the "int" in front of it. touchProbe = int(d.getMachineParam(321)) the correct version 😉
Another question in this context. Would it somehow be possible to fully test the scripts without a machine in simCNC's simulation mode. This means that random values are generated for the measurements. I hope you understand what I mean. It is quite annoying to always have to drive to the workshop to test whether the script is working properly. I can also work much faster on the PC at home with two screens.
Oh yes, great, thank you. I already understood it but still didn't see the error. The line for touchProbe looked like this: touchProbe = (d.getMachineParam(321)). I forgot to write the "int" in front of it. touchProbe = int(d.getMachineParam(321)) the correct version 😉
Another question in this context. Would it somehow be possible to fully test the scripts without a machine in simCNC's simulation mode. This means that random values are generated for the measurements. I hope you understand what I mean. It is quite annoying to always have to drive to the workshop to test whether the script is working properly. I can also work much faster on the PC at home with two screens.
Quote from CS-Lab Support on 19 August 2024, 07:59The simulator does not provide this option. Use the random number generator as the measurement result.
The simulator does not provide this option. Use the random number generator as the measurement result.