1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
<html><head>
<title>Extrude Documentation</title>
<style type="text/css">
hr {color: sienna}
p {margin-left: 20px}
</style>
</head>
<body>
<h1>Extrude Documentation</h1>
<h2>Introduction</h2>
Extrude requires pySerial installed for this module to work. If you are using Fedora it is available on yum (run "sudo yum install pyserial").
<br />
<br />
To actually control the reprap requires write access to the serial device, running as root is one way to get that access.
<br />
<br />
<b>Extrude</b> is a python 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.
<br>
<h2>Example</h2>
<p>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.</p>
<pre><p>
>>> import reprap.extrude as 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()
</p></pre>
<br>
<h2>Display Commands</h2>
<h3>display</h3>
<p>Parse a gcode file and display the commands.<br>
<b>extrude.display( filename = '' )</b><br>
<ul><li><i>filename</i> - Name of the file. If no filename is specified, parse all the gcode files which are not log files in this folder.</li>
</ul>
Returns: Nothing<br></p>
<h3>displayFile</h3>
<p>Parse a gcode file and display the commands.<br>
<b>extrude.displayFile( filename )</b><br>
<ul><li><i>filename</i> - Name of the file.</li>
</ul>
Returns: Nothing<br></p>
<h3>displayFiles</h3>
<p>Parse gcode files and display the commands.<br>
<b>extrude.displayFiles( filenames )</b><br>
<ul><li><i>filenames</i> - List of filenames.</li>
</ul>
Returns: Nothing<br></p>
<br>
<h3>displayText</h3>
<p>Parse a gcode text and display the commands.<br>
<b>extrude.displayText( gcodeText )</b><br>
<ul><li><i>gcodeText</i> - Gcode text.</li>
</ul>
Returns: Gcode text and commands.<br></p>
<h2>Extrude Commands</h2>
<h3>extrude</h3>
<p>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.<br>
<b>extrude.extrude( filename = '' )</b><br>
<ul><li><i>filename</i> - Name of the file. If no filename is specified, parse all the gcode files which are not log files in this folder.</li>
</ul>
Returns: Nothing<br></p>
<h3>extrudeFile</h3>
<p>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.<br>
<b>extrude.extrudeFile( filename )</b><br>
<ul><li><i>filename</i> - Name of the file.</li>
</ul>
Returns: Nothing<br></p>
<h3>extrudeFiles</h3>
<p>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.<br>
<b>extrude.extrudeFiles( filenames )</b><br>
<ul><li><i>filenames</i> - List of filenames.</li>
</ul>
Returns: Nothing<br></p>
<h3>extrudeText</h3>
<p>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.<br>
<b>extrude.extrudeText( gcodeText )</b><br>
<ul><li><i>gcodeText</i> - Gcode text.</li>
</ul>
Returns: Gcode text and commands.<br></p>
<br>
</body></html>
|