Extrude is a script to display and extrude a gcode file.
It controls the extruder and movement. It can read linear and helical move commands. It saves a log file with the suffix _log.
To run extrude, install python 2.x on your machine, which is avaliable from http://www.python.org/download/
Then in the folder which extrude is in, type 'python' in a shell to run the python interpreter. Finally type 'import extrude' to import
this program. Extrude requires pySerial installed for this module to work. If you are using Fedora it is available on yum
(run "sudo yum install pyserial"). To actually control the reprap requires write access to the serial device, running as root is
one way to get that access.
This example displays and extrudes a gcode file. This example is run in a terminal as root in the folder which contains
Hollow Square.gcode, and extrude.py.
>>> import extrude
Extrude has been imported.
The gcode files in this directory that are not log files are the following:
['Hollow Square.gcode']
>>> extrude.display()
File Hollow Square.gcode is being displayed.
reprap.serial = serial.Serial(0, 19200, timeout = 60)
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True
reprap.cartesian.x.setNotify()
reprap.cartesian.y.setNotify()
reprap.cartesian.z.setNotify()
reprap.cartesian.x.limit = 2523
reprap.cartesian.y.limit = 2000
reprap.cartesian.homeReset( 200, True )
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
M100 P210
M103
reprap.extruder.setMotor(reprap.CMD_REVERSE, 0)
..
many lines of gcode and extruder commands
..
reprap.cartesian.homeReset( 600, True )
reprap.cartesian.free()
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.displayFile("Hollow Square.gcode")
File Hollow Square.gcode is being displayed.
..
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.displayFiles(["Hollow Square.gcode"])
File Hollow Square.gcode is being displayed.
..
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.displayText("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
reprap.serial = serial.Serial(0, 19200, timeout = 60)
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True
reprap.cartesian.x.setNotify()
reprap.cartesian.y.setNotify()
reprap.cartesian.z.setNotify()
reprap.cartesian.x.limit = 2523
reprap.cartesian.y.limit = 2000
reprap.cartesian.homeReset( 200, True )
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
M100 P210
M103
reprap.extruder.setMotor(reprap.CMD_REVERSE, 0)
..
many lines of gcode and extruder commands
..
reprap.cartesian.homeReset( 600, True )
reprap.cartesian.free()
Note: On my system the reprap is not connected, so I get can not connect messages, like:
>>> extrude.extrude()
File Hollow Square.gcode is being extruded.
reprap.serial = serial.Serial(0, 19200, timeout = 60)
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True
reprap.cartesian.x.setNotify()
Error: Serial timeout
Error: ACK not recieved
..
On a system where a reprap is connected to the serial port, you should get the following:
>>> extrude.extrude()
File Hollow Square.gcode is being extruded.
..
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.extrudeFile("Hollow Square.gcode")
File Hollow Square.gcode is being extruded.
..
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.extrudeFiles(["Hollow Square.gcode"])
File Hollow Square.gcode is being extruded.
..
The gcode log file is saved as Hollow Square_log.gcode
>>> extrude.extrudeText("
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
..
many lines of gcode
..
")
reprap.serial = serial.Serial(0, 19200, timeout = 60)
reprap.cartesian.x.active = True
reprap.cartesian.y.active = True
reprap.cartesian.z.active = True
reprap.extruder.active = True
reprap.cartesian.x.setNotify()
reprap.cartesian.y.setNotify()
reprap.cartesian.z.setNotify()
reprap.cartesian.x.limit = 2523
reprap.cartesian.y.limit = 2000
reprap.cartesian.homeReset( 200, True )
( GCode generated by March 29,2007 Skeinforge )
( Extruder Initialization )
M100 P210
M103
reprap.extruder.setMotor(reprap.CMD_REVERSE, 0)
..
many lines of gcode and extruder commands
..
reprap.cartesian.homeReset( 600, True )
reprap.cartesian.free()
Classes |
| |
- displaySkein
-
- extrudeSkein
class displaySkein |
|
A class to display a gcode skein of extrusions. |
|
Methods defined here:
- __init__(self)
- addToOutput(self, line)
- Add line with a newline at the end to the output.
- evaluateCommand(self, command)
- Add an extruder command to the output.
- helicalMove(self, isCounterclockwise, splitLine)
- Parse a helical move gcode line and send the commands to the extruder.
- homeReset(self)
- Send all axies to home position. Wait until arrival.
- linearMove(self, splitLine)
- Parse a linear move gcode line and send the commands to the extruder.
- moveExtruder(self, location)
- Seek to location. Wait until arrival.
- parseGCode(self, lines)
- Parse gcode and send the commands to the extruder.
- parseLine(self, line)
- Parse a gcode line and send the command to the extruder.
- parseText(self, text)
- Parse a gcode text and evaluate the commands.
- setFeedrate(self, splitLine)
- Set the feedrate to the gcode split line.
- setPointComponent(self, point, splitLine)
- Set a point to the gcode split line.
|
class extrudeSkein(displaySkein) |
|
A class to extrude a gcode skein of extrusions. |
|
Methods defined here:
- evaluateCommand(self, command)
- Add an extruder command to the output and evaluate the extruder command.
Display the entire command, but only evaluate the command after the first equal sign.
Methods inherited from displaySkein:
- __init__(self)
- addToOutput(self, line)
- Add line with a newline at the end to the output.
- helicalMove(self, isCounterclockwise, splitLine)
- Parse a helical move gcode line and send the commands to the extruder.
- homeReset(self)
- Send all axies to home position. Wait until arrival.
- linearMove(self, splitLine)
- Parse a linear move gcode line and send the commands to the extruder.
- moveExtruder(self, location)
- Seek to location. Wait until arrival.
- parseGCode(self, lines)
- Parse gcode and send the commands to the extruder.
- parseLine(self, line)
- Parse a gcode line and send the command to the extruder.
- parseText(self, text)
- Parse a gcode text and evaluate the commands.
- setFeedrate(self, splitLine)
- Set the feedrate to the gcode split line.
- setPointComponent(self, point, splitLine)
- Set a point to the gcode split line.
| |
Functions |
| |
- display(filename='')
- Parse a gcode file and display the commands. If no filename is specified, parse all the gcode files which are not log files in this folder.
- displayFile(filename)
- Parse a gcode file and display the commands.
- displayFiles(filenames)
- Parse gcode files and display the commands.
- displayText(gcodeText)
- Parse a gcode text and display the commands.
- extrude(filename='')
- Parse a gcode file and send the commands to the extruder. If no filename is specified, parse all the gcode files which are not log files in this folder.
This function requires write access to the serial device, running as root is one way to get that access.
- extrudeFile(filename)
- Parse a gcode file and send the commands to the extruder.
This function requires write access to the serial device, running as root is one way to get that access.
- extrudeFiles(filenames)
- Parse gcode files and send the commands to the extruder.
This function requires write access to the serial device, running as root is one way to get that access.
- extrudeText(gcodeText)
- Parse a gcode text and send the commands to the extruder.
This function requires write access to the serial device, running as root is one way to get that access.
- getAngleAroundZAxisDifference(subtractFromVector3, subtractVector3)
- Get the angle around the Z axis difference between a pair of vec3s.
Keyword arguments:
subtractFromVector3 -- vec3 whose angle will be subtracted from
subtractVector3 -- vec3 whose angle will be subtracted
- getDoubleAfterFirstLetter(word)
- Get the double value of the word after the first letter.
Keyword arguments:
word -- string with value starting after the first letter
- getDoubleForLetter(letter, splitLine)
- Get the double value of the word after the first occurence of the letter in the split line.
- getFileText(filename)
- Get the entire text of a file.
Keyword arguments:
filename -- name of the file
- getFilesWithExtensionWithoutWords(extension, words)
- Get files which have a given extension, but with do not contain a word in a list.
Keyword arguments:
extension -- extension required
words -- list of words which the file must not have
- getGCodeFilesWithAreNotLogFiles()
- Get gcode files which are not log files.
- getIntegerString(number)
- Get integer as string.
- getPlaneDot(vector3First, vector3Second)
- Get the dot product of the x and y components of a pair of Vec3s.
Keyword arguments:
vector3First -- first Vec3
vector3Second -- second Vec3
- getPointPlusSegmentWithLength(length, point, segment)
- Get point plus to a segment scaled to a given length.
- getPolar(angle, radius)
- Get polar complex from counterclockwise angle from 1, 0 and radius.
Keyword arguments:
angle -- counterclockwise angle from 1, 0
radius -- radius of complex
- getRotatedWiddershinsQuarterAroundZAxis(vector3)
- Get Vec3 rotated a quarter widdershins turn around Z axis.
Keyword arguments:
vector3 -- vec3 whose rotation will be returned
- getTextLines(text)
- Get the all the lines of text of a text.
Keyword arguments:
text -- text
- getVectorRotatedByPlaneAngle(planeAngle, vector3)
- Get vec3 rotated by a plane angle.
Keyword arguments:
planeAngle - plane angle of the rotation
vector3 - vec3 whose rotation will be returned
- indexOfStartingWithSecond(letter, splitLine)
- Get index of the first occurence of the given letter in the split line, starting with the second word. Return - 1 if letter is not found
- isFileWithExtensionWithoutWords(extension, filename, words)
- Determine if file has a given extension, but with does not contain a word in a list.
Keyword arguments:
extension -- extension required
filename -- name of the file
words -- list of words which the filename must not have
- writeFileMessageSuffix(filename, fileText, message, suffix)
- Write to a filename with a suffix and print a message.
- writeFileText(filename, fileText)
- Write a text to a file.
Keyword arguments:
filename -- name of the file
fileText -- text which will be written to the file
|
Data |
| |
__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GPL 3.0' |
Author |
| |
Enrique Perez (perez_enrique@yahoo.com) |