Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Program Event or Function Call for 3D Printing Extruder Control

#12
Hi !!
Please help I put the program in the postprocessor

Code:
def ekstruder():

# This script shows an example to integrate an extruder with RoboDK
# We need to add this script to the RoboDK project ot trigger sending the E value (Extruder parameter)
# This script meant to work when we are running 3D printing with the driver ("Run on robot" option)

# Send the E_Value over Ethernet (ASCII numbers)
EXTRUDER_IP = '192.168.1.15' # The IP of the extruder
EXTRUDER_PORT = 100 # The same port as used by the Extruder server

E_Value = None

import sys
if len(sys.argv) > 1:
E_Value = float(sys.argv[1])


# Implement socket communication to send the E_Value over Ethernet/socket
import socket
BUFFER_SIZE = 1024

# Build the byte array to send
bytes2send = bytes(str(E_Value) + '\0', 'ascii')

print("Sending: " + str(bytes2send))
print("Connecting to %s:%i" % (EXTRUDER_IP, EXTRUDER_PORT))

# Connect to the extruder and send byte array
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((EXTRUDER_IP, EXTRUDER_PORT))
s.send(bytes2send)
s.close()

The program connects to the printer and sends the G-code I'll capture the extruder value

Code:
if code.startswith("Extruder("):

# Intercept the extruder command.
# if the program call is Extruder(123.56)
# we extract the number as a string
# and convert it to a number

self.PRINT_E_NEW = float(code[9:-1])

sys.argv = str(self.PRINT_E_NEW)

self.uruchom_ekstruder() ?????? !!!!!!!!!!!!!!!!!!!!!!
return
else:
self.addline(code + "()")

How to call extruder () functions ??
The robot reports an error Am I doing it right?
Thank you and greetings



Messages In This Thread
RE: Program Event or Function Call for 3D Printing Extruder Control - byrobo1973- 06-24-2022, 07:27 PM



Users browsing this thread:
1 Guest(s)