printrun-src/README.md

changeset 45
c82943fb205f
parent 15
0bbb006204fc
equal deleted inserted replaced
44:310be640a303 45:c82943fb205f
1 # PRINTRUN 2.X
2
3 The master branch holds the development of Printrun 2.x. This new version of Printrun supports Python 3 and wxPython 4. All new features and developments should be merged to it.
4
1 Printrun consists of printcore, pronsole and pronterface, and a small collection of helpful scripts. 5 Printrun consists of printcore, pronsole and pronterface, and a small collection of helpful scripts.
2 6
3 * printcore.py is a library that makes writing reprap hosts easy 7 * printcore.py is a library that makes writing reprap hosts easy
4 * pronsole.py is an interactive command-line host software with tabcompletion goodness 8 * pronsole.py is an interactive command-line host software with tabcompletion goodness
5 * pronterface.py is a graphical host software with the same functionality as pronsole 9 * pronterface.py is a graphical host software with the same functionality as pronsole
16 20
17 ## Mac OS X 21 ## Mac OS X
18 22
19 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/ 23 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
20 24
25 Note for OSX users: if OSX tells you the file is corrupted, you don't need to redownload it. Instead, you need to allow OSX to run unsigned apps. To do this, run
26 `sudo spctl --master-disable`
27
28
21 ## Linux 29 ## Linux
22 ### Ubuntu/Debian 30 ### Ubuntu/Debian
23 31
24 You can run Printrun directly from source. Fetch and install the dependencies using 32 There is currently no package for Printrun 2. It must be [run from source](https://github.com/kliment/Printrun/tree/master#running-from-source).
25
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`
27
28 Clone the repository
29
30 `git clone https://github.com/kliment/Printrun.git`
31
32 and you can start using Printrun from the Printrun directory created by the git clone command.
33
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.
35
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.
37 33
38 ### Chrome OS 34 ### Chrome OS
39 35
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. 36 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 printrun with the line given above for Ubuntu/Debian.
41 37
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 38 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
43 39
44 `sudo usermod -G serial -a <username>` 40 `sudo usermod -G serial -a <username>`
45 41
47 43
48 ### Fedora 44 ### Fedora
49 45
50 You can install Printrun from official packages. Install the whole package using 46 You can install Printrun from official packages. Install the whole package using
51 47
52 `sudo yum install printrun` 48 `sudo dnf install printrun`
53 49
54 Or get only apps you need by 50 Or get only apps you need by
55 51
56 `sudo yum install pronsole` or `pronterface` or `plater` 52 `sudo dnf install pronsole` or `pronterface` or `plater`
57 53
58 Adding `--enablerepo updates-testing` option to `yum` might give you newer packages (but also not very tested). 54 Adding `--enablerepo updates-testing` option to `dnf` might sometimes give you newer packages (but also not very tested).
59 55
60 You can also run Printrun directly from source, if the packages are too old for you. Fetch and install the dependencies using
61
62 1. `sudo yum install pyserial wxPython python-pyglet python-cairosvg`
63
64 Optional: `sudo yum install skeinforge simarrange`
65 56
66 ### Archlinux 57 ### Archlinux
67 58
68 Packages are available in AUR. Just run 59 Packages are available in AUR. Just run
69 60
77 68
78 ### Dependencies 69 ### Dependencies
79 70
80 To use pronterface, you need: 71 To use pronterface, you need:
81 72
82 * python (ideally 2.6.x or 2.7.x), 73 * Python 3 (ideally 3.6),
83 * pyserial (or python-serial on ubuntu/debian) 74 * pyserial (or python3-serial on ubuntu/debian)
84 * pyreadline (not needed on Linux) and 75 * pyreadline (not needed on Linux)
85 * argparse (installed by default with python >= 2.7) 76 * wxPython 4
86 * wxPython (some features such as Tabbed mode work better with wx 2.9)
87 * pyglet 77 * pyglet
78 * appdirs
88 * numpy (for 3D view) 79 * numpy (for 3D view)
89 * pycairo (to use Projector feature) 80 * pycairo (to use Projector feature)
90 * cairosvg (to use Projector feature) 81 * cairosvg (to use Projector feature)
91 * dbus (to inhibit sleep on some Linux systems) 82 * dbus (to inhibit sleep on some Linux systems)
92 83
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: 84 ### Use Python virtual environment
94 85
95 ```pip install -r requirements.txt``` 86 Easiest way to run Printrun from source is to create and use a Python [virtual environment](https://docs.python.org/3/tutorial/venv.html).
87 The following section assumes Linux. Please see specific instructions for Windows and macOS X below.
88
89 **Ubuntu/Debian note:** You might need to install `python3-venv` first.
90
91 **Note:** wxPython4 doesn't have Linux wheels available from the Python Package Index yet. Find a proper wheel for your distro at [extras.wxpython.org](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/) and substitute the link in the bellow example. You might skip the wheel installation, but that results in compiling wxPython4 from source, which can be time and resource consuming and might fail.
92
93
94 ```console
95 $ git clone https://github.com/kliment/Printrun.git # clone the repository
96 $ cd Printrun # change to Printrun directory
97 $ python3 -m venv venv # create an virtual environment
98 $ . venv/bin/activate # activate the virtual environment (notice the space after the dot)
99 (venv) $ python -m pip install https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-27/wxPython-4.0.1-cp36-cp36m-linux_x86_64.whl # replace the link with yours
100 (venv) $ python -m pip install -r requirements.txt # intall the rest of dependencies
101 (venv) $ python pronterface.py # run Pronterface
102 ```
96 103
97 ### Cython-based G-Code parser 104 ### Cython-based G-Code parser
98 105
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: 106 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:
100 107
101 python setup.py build_ext --inplace 108 ```console
109 (venv) $ python -m pip install Cython
110 (venv) $ python setup.py build_ext --inplace
111 ```
102 112
103 The warning message 113 The warning message
104 114
105 WARNING:root:Memory-efficient GCoder implementation unavailable: No module named gcoder_line 115 WARNING:root:Memory-efficient GCoder implementation unavailable: No module named gcoder_line
106 116
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. 117 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.
108 118
119 ### Ubuntu/Debian
120
121 The above method is the recommended way to run Printrun 2 from source. However, if you can't find a suitable wxPython4 wheel, or if it fails for other reasons, it could be run without using a python virtual environment. For users of Debian 10 Buster or later and Ubuntu 18.04 Bionic Beaver or later.
122
123 Install the dependencies:
124
125 ```
126 sudo apt install python3-serial python3-numpy cython3 python3-libxml2 python3-gi python3-dbus python3-psutil python3-cairosvg libpython3-dev python3-appdirs python3-wxgtk4.0
127 ```
128
129 ```
130 sudo apt install python3-pip
131 pip3 install --user pyglet
132 ```
133
134 Install git, clone this repository:
135 ```
136 sudo apt install git
137 git clone https://github.com/kliment/Printrun.git
138 cd Printrun
139 ```
140
109 ### Windows 141 ### Windows
110 142
111 Download the following, and install in this order: 143 Download and install [Python 3.6](https://www.python.org/downloads/) and follow the **Python virtual environment** section above except use the following to create and activate the virtual environment and install dependencies:
112 144
113 1. http://python.org/ftp/python/2.7.2/python-2.7.2.msi 145 ```cmd
114 2. http://pypi.python.org/packages/any/p/pyserial/pyserial-2.5.win32.exe 146 > py -3 -m venv venv
115 3. http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.0-py27.exe 147 > venv\Scripts\activate
116 4. https://pypi.python.org/packages/any/p/pyreadline/pyreadline-1.7.1.win32.exe 148 > python -m pip install -r requirements.txt
117 5. http://pyglet.googlecode.com/files/pyglet-1.1.4.zip 149 ```
118 150
119 For the last one, you will need to unpack it, open a command terminal, 151
120 go into the the directory you unpacked it in and run 152 ### macOS X
121 `python setup.py install` 153
122 154 Install Python 3, you can use Brew:
123 ### Mac OS X Lion 155
124 156 ```console
125 1. Ensure that the active Python is the system version. (`brew uninstall python` or other appropriate incantations) 157 $ brew install python3
126 2. Download an install [wxPython2.8-osx-unicode] matching to your python version (most likely 2.7 on Lion, 158 ```
127 check with: python --version) from: http://wxpython.org/download.php#stable 159
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 160 And follow the above **Python virtual environment** section. You don't need to search for wxPython wheel, macOS wheels are available from the Python Package Index.
129 3. Download and unpack pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz 161
130 4. In a terminal, change to the folder you unzipped to, then type in: `sudo python setup.py install`
131 5. Repeat 4. with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
132
133 The tools will probably run just fine in 64bit on Lion, you don't need to mess
134 with any of the 32bit settings. In case they don't, try
135 5. export VERSIONER_PYTHON_PREFER_32_BIT=yes
136 in a terminal before running Pronterface
137
138 ### Mac OS X (pre Lion)
139
140 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
141
142 1. Download and install http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.0-universal-py2.6.dmg
143 2. Grab the source for pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz
144 3. Unzip pyserial to a folder. Then, in a terminal, change to the folder you unzipped to, then type in:
145
146 `defaults write com.apple.versioner.python Prefer-32-Bit -bool yes`
147
148 `sudo python setup.py install`
149
150 Alternatively, you can run python in 32 bit mode by setting the following environment variable before running the setup.py command:
151
152 This alternative approach is confirmed to work on Mac OS X 10.6.8.
153
154 `export VERSIONER_PYTHON_PREFER_32_BIT=yes`
155
156 `sudo python setup.py install`
157
158 Then repeat the same with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
159 162
160 # USING PRINTRUN 163 # USING PRINTRUN
161 164
162 ## USING PRONTERFACE 165 ## USING PRONTERFACE
163 166
165 Select the port name you are using from the first drop-down, select your baud rate, and hit connect. 168 Select the port name you are using from the first drop-down, select your baud rate, and hit connect.
166 Load an STL (see the note on skeinforge below) or GCODE file, and you can upload it to SD or print it directly. 169 Load an STL (see the note on skeinforge below) or GCODE file, and you can upload it to SD or print it directly.
167 The "monitor printer" function, when enabled, checks the printer state (temperatures, SD print progress) every 3 seconds. 170 The "monitor printer" function, when enabled, checks the printer state (temperatures, SD print progress) every 3 seconds.
168 The command box recognizes all pronsole commands, but has no tabcompletion. 171 The command box recognizes all pronsole commands, but has no tabcompletion.
169 172
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. 173 If you want to load stl files, you need to install a slicing program such as Slic3r or Skeinforge and add its path to the settings.
171 See the Slic3r readme for more details on integration. 174
172 175 #### Slic3r integration
176
177 To invoke Slic3r directly from Pronterface your slicing command (_Settings_ > _Options_ > _External Commands_ > _Slice Command_) should look something like `slic3r $s -o $o`. If Slic3r is properly installed "slic3r" will suffice, otherwise, replace it with the full path to Slic3r's executable.
178
179 If the Slic3r integration option (_Settings_ > _Options_ > _User interface_ > _Enable Slic3r integration_) is checked a new menu will appear after application restart which will allow you to choose among your previously saved Slic3r Print/Filament/Printer settings.
173 180
174 ## USING PRONSOLE 181 ## USING PRONSOLE
175 182
176 To use pronsole, you need: 183 To use pronsole, you need:
177 184
178 * python (ideally 2.6.x or 2.7.x), 185 * Python 3 (ideally 3.6),
179 * pyserial (or python-serial on ubuntu/debian) and 186 * pyserial (or python3-serial on ubuntu/debian) and
180 * pyreadline (not needed on Linux) 187 * pyreadline (not needed on Linux)
181 188
182 Start pronsole and you will be greeted with a command prompt. Type help to view the available commands. 189 Start pronsole and you will be greeted with a command prompt. Type help to view the available commands.
183 All commands have internal help, which you can access by typing "help commandname", for example "help connect" 190 All commands have internal help, which you can access by typing "help commandname", for example "help connect"
184 191
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". 192 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".
186 The "skeinforge" folder must be in the same folder as pronsole.py 193 The "skeinforge" folder must be in the same folder as pronsole.py
187 194
188 ## USING PRINTCORE 195 ## USING PRINTCORE
189 196
190 To use printcore you need python (ideally 2.6.x or 2.7.x) and pyserial (or python-serial on ubuntu/debian) 197 To use printcore you need Python 3 (ideally 3.6) and pyserial (or python3-serial on ubuntu/debian)
191 See pronsole for an example of a full-featured host, the bottom of printcore.py for a simple command-line 198 See pronsole for an example of a full-featured host, the bottom of printcore.py for a simple command-line
192 sender, or the following code example: 199 sender, or the following code example:
193 200
194 ```python 201 ```python
195 #to send a file of gcode to the printer 202 #to send a file of gcode to the printer
230 ```pronterface``` and ```pronsole``` start a RPC server, which runs by default 237 ```pronterface``` and ```pronsole``` start a RPC server, which runs by default
231 on localhost port 7978, which provides print progress information. 238 on localhost port 7978, which provides print progress information.
232 Here is a sample Python script querying the print status: 239 Here is a sample Python script querying the print status:
233 240
234 ```python 241 ```python
235 import xmlrpclib 242 import xmlrpc.client
236 243
237 rpc = xmlrpclib.ServerProxy('http://localhost:7978') 244 rpc = xmlrpc.client.ServerProxy('http://localhost:7978')
238 print rpc.status() 245 print(rpc.status())
239 ``` 246 ```
240 247
241 ## CONFIGURATION 248 ## CONFIGURATION
242 249
243 ### Build dimensions 250 ### Build dimensions
309 ```python 316 ```python
310 PC> macro move_down_by 317 PC> macro move_down_by
311 Enter macro using indented lines, end with empty line 318 Enter macro using indented lines, end with empty line
312 ..> G91 319 ..> G91
313 ..> G1 Z-{0} 320 ..> G1 Z-{0}
314 ..> G92 321 ..> G90
315 ..> 322 ..>
316 ``` 323 ```
317 324
318 Invoke the macro to move the printhead down by 5 millimeters: 325 Invoke the macro to move the printhead down by 5 millimeters:
319 326
323 330
324 For more powerful macro programming, it is possible to use python code escaping using ! symbol in front of macro commands. 331 For more powerful macro programming, it is possible to use python code escaping using ! symbol in front of macro commands.
325 Note that this python code invocation also works in interactive prompt: 332 Note that this python code invocation also works in interactive prompt:
326 333
327 ```python 334 ```python
328 PC> !print "Hello, printer!" 335 PC> !print("Hello, printer!")
329 Hello printer! 336 Hello printer!
330 337
331 PC> macro debug_on !self.p.loud = 1 338 PC> macro debug_on !self.p.loud = 1
332 Macro 'debug_on' defined 339 Macro 'debug_on' defined
333 PC> debug_on 340 PC> debug_on
344 351
345 ```python 352 ```python
346 PC> macro toggle_debug_on 353 PC> macro toggle_debug_on
347 Enter macro using indented lines, end with empty line 354 Enter macro using indented lines, end with empty line
348 ..> !self.p.loud = 1 355 ..> !self.p.loud = 1
349 ..> !print "Diagnostic information ON" 356 ..> !print("Diagnostic information ON")
350 ..> macro toggle_debug toggle_debug_off 357 ..> macro toggle_debug toggle_debug_off
351 ..> 358 ..>
352 Macro 'toggle_debug_on' defined 359 Macro 'toggle_debug_on' defined
353 PC> macro toggle_debug_off 360 PC> macro toggle_debug_off
354 Enter macro using indented lines, end with empty line 361 Enter macro using indented lines, end with empty line
355 ..> !self.p.loud = 0 362 ..> !self.p.loud = 0
356 ..> !print "Diagnostic information OFF" 363 ..> !print("Diagnostic information OFF")
357 ..> macro toggle_debug toggle_debug_on 364 ..> macro toggle_debug toggle_debug_on
358 ..> 365 ..>
359 Macro 'toggle_debug_off' defined 366 Macro 'toggle_debug_off' defined
360 PC> macro toggle_debug toggle_debug_on 367 PC> macro toggle_debug toggle_debug_on
361 Macro 'toggle_debug' defined 368 Macro 'toggle_debug' defined
376 For example, following macro toggles the diagnostic information similarily to the previous example: 383 For example, following macro toggles the diagnostic information similarily to the previous example:
377 384
378 ```python 385 ```python
379 !if self.p.loud: 386 !if self.p.loud:
380 !self.p.loud = 0 387 !self.p.loud = 0
381 !print "Diagnostic information OFF" 388 !print("Diagnostic information OFF")
382 !else: 389 !else:
383 !self.p.loud = 1 390 !self.p.loud = 1
384 !print "Diagnostic information ON" 391 !print("Diagnostic information ON")
385 ``` 392 ```
386 393
387 Macro parameters are available in '!'-escaped python code as locally defined list variable: arg[0] arg[1] ... arg[N] 394 Macro parameters are available in '!'-escaped python code as locally defined list variable: arg[0] arg[1] ... arg[N]
388 395
389 All python code is executed in the context of the pronsole (or PronterWindow) object, 396 All python code is executed in the context of the pronsole (or PronterWindow) object,
458 - `exit` 465 - `exit`
459 466
460 # LICENSE 467 # LICENSE
461 468
462 ``` 469 ```
470 Copyright (C) 2011-2020 Kliment Yanev, Guillaume Seguin
471
463 Printrun is free software: you can redistribute it and/or modify 472 Printrun is free software: you can redistribute it and/or modify
464 it under the terms of the GNU General Public License as published by 473 it under the terms of the GNU General Public License as published by
465 the Free Software Foundation, either version 3 of the License, or 474 the Free Software Foundation, either version 3 of the License, or
466 (at your option) any later version. 475 (at your option) any later version.
467 476
473 You should have received a copy of the GNU General Public License 482 You should have received a copy of the GNU General Public License
474 along with Printrun. If not, see <http://www.gnu.org/licenses/>. 483 along with Printrun. If not, see <http://www.gnu.org/licenses/>.
475 ``` 484 ```
476 485
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. 486 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.
487

mercurial