printrun-src/README.md

Thu, 07 Jul 2016 11:58:38 +0200

author
mbayer
date
Thu, 07 Jul 2016 11:58:38 +0200
changeset 27
c82c30811edd
parent 15
0bbb006204fc
child 45
c82943fb205f
permissions
-rw-r--r--

svg crowbar fixes

15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
1 Printrun consists of printcore, pronsole and pronterface, and a small collection of helpful scripts.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
2
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
3 * printcore.py is a library that makes writing reprap hosts easy
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
4 * pronsole.py is an interactive command-line host software with tabcompletion goodness
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
5 * pronterface.py is a graphical host software with the same functionality as pronsole
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
6
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
7 # GETTING PRINTRUN
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
8
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
9 This section suggests using precompiled binaries, this way you get everything bundled into one single package for an easy installation.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
10
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
11 If you want the newest, shiniest features, you can run Printrun from source using the instructions further down this README.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
12
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
13 ## Windows
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
14
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
15 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
16
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
17 ## Mac OS X
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
18
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
19 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
20
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
21 ## Linux
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
22 ### Ubuntu/Debian
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
23
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
24 You can run Printrun directly from source. Fetch and install the dependencies using
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
25
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
26 1. `sudo apt-get install python-serial python-wxgtk2.8 python-pyglet python-numpy cython python-libxml2 python-gobject python-dbus python-psutil python-cairosvg git`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
27
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
28 Clone the repository
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
29
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
30 `git clone https://github.com/kliment/Printrun.git`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
31
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
32 and you can start using Printrun from the Printrun directory created by the git clone command.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
33
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
34 Users of Ubuntu Xenial Xerus or later and Debian Jessie or later won't find the package "python-wxgtk2.8" available, having been replaced by "python-wxgtk3.0". Running Printrun with "python-wxgtk3.0" instead, is possible but it is known to be affected by issue #615.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
35
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
36 A Printrun preliminary package is already available in Ubuntu Yakkety Yak and Debian Stretch/Sid repositories. Please be aware that this initial package is also known to be affected by issue #615.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
37
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
38 ### Chrome OS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
39
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
40 You can use Printrun via crouton ( https://github.com/dnschneid/crouton ). Assuming you want Ubuntu Trusty, you used probably `sudo sh -e ~/Downloads/crouton -r trusty -t xfce` to install Ubuntu. Fetch and install dependencies with the line given above for Ubuntu/Debian, and obtain the source via git clone.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
41
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
42 By default you have no access to the serial port under Chrome OS crouton, so you cannot connect to your 3D printer. Add yourself to the serial group within the linux environment to fix this
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
43
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
44 `sudo usermod -G serial -a <username>`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
45
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
46 where `<username>` should be your username. Log out and in to make this group change active and allow communication with your printer.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
47
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
48 ### Fedora
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
49
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
50 You can install Printrun from official packages. Install the whole package using
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
51
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
52 `sudo yum install printrun`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
53
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
54 Or get only apps you need by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
55
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
56 `sudo yum install pronsole` or `pronterface` or `plater`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
57
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
58 Adding `--enablerepo updates-testing` option to `yum` might give you newer packages (but also not very tested).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
59
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
60 You can also run Printrun directly from source, if the packages are too old for you. Fetch and install the dependencies using
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
61
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
62 1. `sudo yum install pyserial wxPython python-pyglet python-cairosvg`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
63
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
64 Optional: `sudo yum install skeinforge simarrange`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
65
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
66 ### Archlinux
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
67
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
68 Packages are available in AUR. Just run
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
69
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
70 `yaourt printrun`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
71
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
72 and enjoy the `pronterface`, `pronsole`, ... commands directly.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
73
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
74 ## RUNNING FROM SOURCE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
75
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
76 Run Printrun for source if you want to test out the latest features.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
77
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
78 ### Dependencies
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
79
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
80 To use pronterface, you need:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
81
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
82 * python (ideally 2.6.x or 2.7.x),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
83 * pyserial (or python-serial on ubuntu/debian)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
84 * pyreadline (not needed on Linux) and
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
85 * argparse (installed by default with python >= 2.7)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
86 * wxPython (some features such as Tabbed mode work better with wx 2.9)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
87 * pyglet
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
88 * numpy (for 3D view)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
89 * pycairo (to use Projector feature)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
90 * cairosvg (to use Projector feature)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
91 * dbus (to inhibit sleep on some Linux systems)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
92
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
93 Please see specific instructions for Windows and Mac OS X below. Under Linux, you should use your package manager directly (see the "GETTING PRINTRUN" section), or pip:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
94
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
95 ```pip install -r requirements.txt```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
96
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
97 ### Cython-based G-Code parser
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
98
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
99 Printrun default G-Code parser is quite memory hungry, but we also provide a much lighter one which just needs an extra build-time dependency (Cython), plus compiling the extension with:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
100
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
101 python setup.py build_ext --inplace
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
102
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
103 The warning message
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
104
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
105 WARNING:root:Memory-efficient GCoder implementation unavailable: No module named gcoder_line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
106
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
107 means that this optimized G-Code parser hasn't been compiled. To get rid of it and benefit from the better implementation, please install Cython and run the command above.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
108
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
109 ### Windows
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
110
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
111 Download the following, and install in this order:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
112
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
113 1. http://python.org/ftp/python/2.7.2/python-2.7.2.msi
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
114 2. http://pypi.python.org/packages/any/p/pyserial/pyserial-2.5.win32.exe
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
115 3. http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.0-py27.exe
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
116 4. https://pypi.python.org/packages/any/p/pyreadline/pyreadline-1.7.1.win32.exe
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
117 5. http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
118
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
119 For the last one, you will need to unpack it, open a command terminal,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
120 go into the the directory you unpacked it in and run
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
121 `python setup.py install`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
122
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
123 ### Mac OS X Lion
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
124
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
125 1. Ensure that the active Python is the system version. (`brew uninstall python` or other appropriate incantations)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
126 2. Download an install [wxPython2.8-osx-unicode] matching to your python version (most likely 2.7 on Lion,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
127 check with: python --version) from: http://wxpython.org/download.php#stable
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
128 Known to work PythonWX: http://superb-sea2.dl.sourceforge.net/project/wxpython/wxPython/2.8.12.1/wxPython2.8-osx-unicode-2.8.12.1-universal-py2.7.dmg
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
129 3. Download and unpack pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
130 4. In a terminal, change to the folder you unzipped to, then type in: `sudo python setup.py install`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
131 5. Repeat 4. with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
132
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
133 The tools will probably run just fine in 64bit on Lion, you don't need to mess
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
134 with any of the 32bit settings. In case they don't, try
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
135 5. export VERSIONER_PYTHON_PREFER_32_BIT=yes
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
136 in a terminal before running Pronterface
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
137
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
138 ### Mac OS X (pre Lion)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
139
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
140 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
141
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
142 1. Download and install http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.0-universal-py2.6.dmg
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
143 2. Grab the source for pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
144 3. Unzip pyserial to a folder. Then, in a terminal, change to the folder you unzipped to, then type in:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
145
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
146 `defaults write com.apple.versioner.python Prefer-32-Bit -bool yes`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
147
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
148 `sudo python setup.py install`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
149
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
150 Alternatively, you can run python in 32 bit mode by setting the following environment variable before running the setup.py command:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
151
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
152 This alternative approach is confirmed to work on Mac OS X 10.6.8.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
153
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
154 `export VERSIONER_PYTHON_PREFER_32_BIT=yes`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
155
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
156 `sudo python setup.py install`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
157
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
158 Then repeat the same with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
159
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
160 # USING PRINTRUN
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
161
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
162 ## USING PRONTERFACE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
163
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
164 When you're done setting up Printrun, you can start pronterface.py in the directory you unpacked it.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
165 Select the port name you are using from the first drop-down, select your baud rate, and hit connect.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
166 Load an STL (see the note on skeinforge below) or GCODE file, and you can upload it to SD or print it directly.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
167 The "monitor printer" function, when enabled, checks the printer state (temperatures, SD print progress) every 3 seconds.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
168 The command box recognizes all pronsole commands, but has no tabcompletion.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
169
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
170 If you want to load stl files, you need to install a slicing program such as Slic3r and add its path to the settings.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
171 See the Slic3r readme for more details on integration.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
172
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
173
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
174 ## USING PRONSOLE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
175
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
176 To use pronsole, you need:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
177
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
178 * python (ideally 2.6.x or 2.7.x),
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
179 * pyserial (or python-serial on ubuntu/debian) and
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
180 * pyreadline (not needed on Linux)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
181
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
182 Start pronsole and you will be greeted with a command prompt. Type help to view the available commands.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
183 All commands have internal help, which you can access by typing "help commandname", for example "help connect"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
184
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
185 If you want to load stl files, you need to put a version of skeinforge (doesn't matter which one) in a folder called "skeinforge".
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
186 The "skeinforge" folder must be in the same folder as pronsole.py
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
187
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
188 ## USING PRINTCORE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
189
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
190 To use printcore you need python (ideally 2.6.x or 2.7.x) and pyserial (or python-serial on ubuntu/debian)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
191 See pronsole for an example of a full-featured host, the bottom of printcore.py for a simple command-line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
192 sender, or the following code example:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
193
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
194 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
195 #to send a file of gcode to the printer
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
196 from printrun.printcore import printcore
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
197 from printrun import gcoder
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
198 p=printcore('/dev/ttyUSB0',115200) # or p.printcore('COM3',115200) on Windows
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
199 gcode=[i.strip() for i in open('filename.gcode')] # or pass in your own array of gcode lines instead of reading from a file
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
200 gcode = gcoder.LightGCode(gcode)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
201 p.startprint(gcode) # this will start a print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
202
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
203 #If you need to interact with the printer:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
204 p.send_now("M105") # this will send M105 immediately, ahead of the rest of the print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
205 p.pause() # use these to pause/resume the current print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
206 p.resume()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
207 p.disconnect() # this is how you disconnect from the printer once you are done. This will also stop running prints.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
208 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
209
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
210 ## PLATERS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
211
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
212 Printrun provides two platers: a STL plater (```plater.py```) and a G-Code plater (```gcodeplater.py```).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
213
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
214 ## 3D VIEWER CONTROLS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
215
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
216 When the 3D viewer is enabled, the controls are the following:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
217 - Mousewheel: zoom (Control reduces the zoom change steps)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
218 - Shift+mousewheel: explore layers (in print gcode view ; Control key makes layer change by increments of 10 instead of 1) or rotate object (in platers)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
219 - Left-click dragging: rotate view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
220 - Right-click dragging: pan view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
221 - Shift + left-click dragging: move object (in platers)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
222 - Page up/down keys: zoom (Control reduces the zoom change steps)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
223 - Up/down keys: explore layers
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
224 - R key: reset view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
225 - F key: fit view to display entire print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
226 - C key: toggle "display current layer only" mode (in print gcode view)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
227
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
228 ## RPC SERVER
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
229
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
230 ```pronterface``` and ```pronsole``` start a RPC server, which runs by default
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
231 on localhost port 7978, which provides print progress information.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
232 Here is a sample Python script querying the print status:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
233
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
234 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
235 import xmlrpclib
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
236
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
237 rpc = xmlrpclib.ServerProxy('http://localhost:7978')
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
238 print rpc.status()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
239 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
240
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
241 ## CONFIGURATION
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
242
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
243 ### Build dimensions
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
244
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
245 Build dimensions can be specified using the build_dimensions option (which can
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
246 be graphically edited in Pronterface settings). This option is formed of 9 parameters:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
247 3 for the build volume dimensions, 3 for the build volume coordinate system
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
248 offset minimum, 3 for the endstop positions.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
249
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
250 The default value is `200x200x100+0+0+0+0+0+0`, which corresponds to a
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
251 200x200mm (width x height) bed with 100mm travel in Z (there are the first
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
252 three numbers) and no offset. The absolute coordinates system origin (0,0,0) is
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
253 at the bottom left corner on the bed surface, and the top right corner on the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
254 bed surface is (200,200,0).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
255
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
256 A common practice is to have the origin of the coordinate system (0,0,0) at the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
257 center of the bed surface. This is achieved by using the next three parameters,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
258 for instance with `200x200x100-100-100+0+0+0+0`.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
259 In this case, the bottom left corner of the bed will be at (-100,-100,0) and
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
260 the top right one at (100,100,0).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
261
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
262 These two sets of settings should be sufficient for most people. However, for
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
263 some specific complicated setups and GCodes and some features, we might also
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
264 need the endstops positions for perfect display. These positions (which are
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
265 usually 0,0,0, so if you don't know you probably have a standard setup) are
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
266 specified in absolute coordinates, so if you have your bed starting at
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
267 (-100,-100,0) and your endstops are 10mm away from the bed left and right and
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
268 the Z endstop 5mm above the bed, you'll want to set the endstops positions to
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
269 (-110,-110,5) for this option.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
270
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
271 ## USING MACROS AND CUSTOM BUTTONS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
272
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
273 ### Macros in pronsole and pronterface
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
274
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
275 To send simple G-code (or pronsole command) sequence is as simple as entering them one by one in macro definition.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
276 If you want to use parameters for your macros, substitute them with {0} {1} {2} ... etc.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
277
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
278 All macros are saved automatically immediately after being entered.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
279
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
280 Example 1, simple one-line alias:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
281
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
282 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
283 PC> macro where M114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
284 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
285
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
286 Instead of having to remember the code to query position, you can query the position:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
287
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
288 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
289 PC> where
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
290 X:25.00Y:11.43Z:5.11E:0.00
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
291 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
292
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
293 Example 2 - macros to switch between different slicer programs, using "set" command to change options:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
294
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
295 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
296 PC> macro use_slicer
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
297 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
298 ..> set sliceoptscommand Slic3r/slic3r.exe --load slic3r.ini
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
299 ..> set slicecommand Slic3r/slic3r.exe $s --load slic3r.ini --output $o
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
300 Macro 'use_slicer' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
301 PC> macro use_sfact
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
302 ..> set sliceoptscommand python skeinforge/skeinforge_application/skeinforge.py
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
303 ..> set slicecommand python skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py $s
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
304 Macro 'use_sfact' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
305 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
306
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
307 Example 3, simple parametric macro:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
308
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
309 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
310 PC> macro move_down_by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
311 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
312 ..> G91
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
313 ..> G1 Z-{0}
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
314 ..> G92
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
315 ..>
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
316 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
317
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
318 Invoke the macro to move the printhead down by 5 millimeters:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
319
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
320 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
321 PC> move_down_by 5
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
322 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
323
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
324 For more powerful macro programming, it is possible to use python code escaping using ! symbol in front of macro commands.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
325 Note that this python code invocation also works in interactive prompt:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
326
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
327 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
328 PC> !print "Hello, printer!"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
329 Hello printer!
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
330
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
331 PC> macro debug_on !self.p.loud = 1
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
332 Macro 'debug_on' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
333 PC> debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
334 PC> M114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
335 SENT: M114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
336 X:0.00Y:0.00Z:0.00E:0.00 Count X:0.00Y:0.00Z:0.00
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
337 RECV: X:0.00Y:0.00Z:0.00E:0.00 Count X:0.00Y:0.00Z:0.00
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
338 RECV: ok
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
339 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
340
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
341 You can use macro command itself to create simple self-modify or toggle functionality:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
342
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
343 Example: swapping two macros to implement toggle:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
344
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
345 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
346 PC> macro toggle_debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
347 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
348 ..> !self.p.loud = 1
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
349 ..> !print "Diagnostic information ON"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
350 ..> macro toggle_debug toggle_debug_off
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
351 ..>
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
352 Macro 'toggle_debug_on' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
353 PC> macro toggle_debug_off
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
354 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
355 ..> !self.p.loud = 0
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
356 ..> !print "Diagnostic information OFF"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
357 ..> macro toggle_debug toggle_debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
358 ..>
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
359 Macro 'toggle_debug_off' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
360 PC> macro toggle_debug toggle_debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
361 Macro 'toggle_debug' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
362 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
363
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
364 Now, each time we invoke "toggle_debug" macro, it toggles debug information on and off:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
365
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
366 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
367 PC> toggle_debug
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
368 Diagnostic information ON
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
369
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
370 PC> toggle_debug
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
371 Diagnostic information OFF
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
372 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
373
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
374 When python code (using ! symbol) is used in macros, it is even possible to use blocks/conditionals/loops.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
375 It is okay to mix python code with pronsole commands, just keep the python indentation.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
376 For example, following macro toggles the diagnostic information similarily to the previous example:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
377
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
378 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
379 !if self.p.loud:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
380 !self.p.loud = 0
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
381 !print "Diagnostic information OFF"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
382 !else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
383 !self.p.loud = 1
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
384 !print "Diagnostic information ON"
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
385 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
386
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
387 Macro parameters are available in '!'-escaped python code as locally defined list variable: arg[0] arg[1] ... arg[N]
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
388
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
389 All python code is executed in the context of the pronsole (or PronterWindow) object,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
390 so it is possible to use all internal variables and methods, which provide great deal of functionality.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
391 However the internal variables and methods are not very well documented and may be subject of change, as the program is developed.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
392 Therefore it is best to use pronsole commands, which easily contain majority of the functionality that might be needed.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
393
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
394 Some useful python-mode-only variables:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
395
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
396 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
397 !self.settings - contains all settings, e.g.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
398 port (!self.settings.port), baudrate, xy_feedrate, e_feedrate, slicecommand, final_command, build_dimensions
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
399 You can set them also via pronsole command "set", but you can query the values only via python code.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
400 !self.p - printcore object (see USING PRINTCORE section for using printcore object)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
401 !self.cur_button - if macro was invoked via custom button, the number of the custom button, e.g. for usage in "button" command
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
402 !self.gwindow - wx graphical interface object for pronterface (highly risky to use because the GUI implementation details may change a lot between versions)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
403 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
404
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
405 Some useful methods:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
406
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
407 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
408 !self.onecmd - invokes raw command, e.g.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
409 !self.onecmd("move x 10")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
410 !self.onecmd("!print self.p.loud")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
411 !self.onecmd("button "+self.cur_button+" fanOFF /C cyan M107")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
412 !self.project - invoke Projector
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
413 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
414
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
415 ## USING HOST COMMANDS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
416
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
417 Pronsole and the console interface in Pronterface accept a number of commands
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
418 which you can either use directly or inside your G-Code. To run a host command
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
419 from inside a G-Code, simply prefix it with `;@`.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
420
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
421 List of available commands:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
422
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
423 - `pause`: pauses the print until the user resumes it
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
424 - `run_script scriptname [arg1 ...]`: runs a custom script or program on the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
425 host computer. This can for instance be used to produce a sound to warn the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
426 user (e.g. `run_script beep -r 2` on machines were the `beep` util is
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
427 available), or to send an email or text message at the end of a print. The $s
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
428 token can be used in the arguments to get the current gcode file name
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
429 - `run_gcode_script scripname [arg1 ...]`: same as `run_script`, except that
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
430 all lines displayed by the script will be interpreted in turn (so that G-Code
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
431 lines will be immediately sent to the printer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
432 - `shell pythoncommand`: run a python command (can also be achieved by doing
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
433 `!pythoncommand`)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
434 - `set option value`: sets the value of an option, e.g. `set mainviz 3D`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
435 - `connect`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
436 - `block_until_online`: wait for the printer to be online. For instance you can
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
437 do `python pronsole.py -e "connect" -e "block_until_online" -e "upload
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
438 object.gcode"` to start pronsole, connect for the printer, wait for it to be
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
439 online to start uploading the `object.gcode` file.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
440 - `disconnect`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
441 - `load gcodefile`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
442 - `upload gcodefile target.g`: upload `gcodefile` to `target.g` on the SD card
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
443 - `slice stlfile`: slice `stlfile` and load the produced G-Code
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
444 - `print`: print the currently loaded file
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
445 - `sdprint target.g`: start a SD print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
446 - `ls`: list files on SD card
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
447 - `eta`: display remaining print time
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
448 - `gettemp`: get current printer temperatures
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
449 - `settemp`: set hotend target temperature
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
450 - `bedtemp`: set bed target temperature
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
451 - `monitor`: monitor printer progress during a print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
452 - `tool K`: switch to tool K
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
453 - `move xK`: move along `x` axis (works with other axes too)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
454 - `extrude length [speed]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
455 - `reverse length [speed]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
456 - `home [axis]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
457 - `off`: turns off fans, motors, extruder, heatbed, power supply
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
458 - `exit`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
459
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
460 # LICENSE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
461
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
462 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
463 Printrun is free software: you can redistribute it and/or modify
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
464 it under the terms of the GNU General Public License as published by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
465 the Free Software Foundation, either version 3 of the License, or
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
466 (at your option) any later version.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
467
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
468 Printrun is distributed in the hope that it will be useful,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
469 but WITHOUT ANY WARRANTY; without even the implied warranty of
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
470 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
471 GNU General Public License for more details.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
472
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
473 You should have received a copy of the GNU General Public License
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
474 along with Printrun. If not, see <http://www.gnu.org/licenses/>.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
475 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
476
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
477 All scripts should contain this license note, if not, feel free to ask us. Please note that files where it is difficult to state this license note (such as images) are distributed under the same terms.

mercurial