printrun-src/README.md

Wed, 20 Jan 2021 10:15:13 +0100

author
mdd
date
Wed, 20 Jan 2021 10:15:13 +0100
changeset 46
cce0af6351f0
parent 45
c82943fb205f
permissions
-rw-r--r--

updated and added new files for printrun

45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
1 # PRINTRUN 2.X
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
2
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
4
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
5 Printrun consists of printcore, pronsole and pronterface, and a small collection of helpful scripts.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
6
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
7 * printcore.py is a library that makes writing reprap hosts easy
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
8 * pronsole.py is an interactive command-line host software with tabcompletion goodness
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
9 * pronterface.py is a graphical host software with the same functionality as pronsole
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
10
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
11 # GETTING PRINTRUN
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
12
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
13 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
14
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
15 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
16
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
17 ## Windows
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 ## Mac OS X
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
22
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
23 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
24
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
26 `sudo spctl --master-disable`
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
27
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
28
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
29 ## Linux
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
30 ### Ubuntu/Debian
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
31
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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).
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
33
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
34 ### Chrome OS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
35
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
37
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
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
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
39
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
40 `sudo usermod -G serial -a <username>`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
41
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
42 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
43
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
44 ### Fedora
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
45
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
46 You can install Printrun from official packages. Install the whole package using
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
47
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
48 `sudo dnf install printrun`
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
49
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
50 Or get only apps you need by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
51
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
52 `sudo dnf install pronsole` or `pronterface` or `plater`
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
53
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
54 Adding `--enablerepo updates-testing` option to `dnf` might sometimes give you newer packages (but also not very tested).
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
55
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
56
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
57 ### Archlinux
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
58
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
59 Packages are available in AUR. Just run
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
60
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
61 `yaourt printrun`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
62
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
63 and enjoy the `pronterface`, `pronsole`, ... commands directly.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
64
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
65 ## RUNNING FROM SOURCE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
66
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
67 Run Printrun for source if you want to test out the latest features.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
68
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
69 ### Dependencies
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
70
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
71 To use pronterface, you need:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
72
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
73 * Python 3 (ideally 3.6),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
74 * pyserial (or python3-serial on ubuntu/debian)
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
75 * pyreadline (not needed on Linux)
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
76 * wxPython 4
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
77 * pyglet
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
78 * appdirs
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
79 * numpy (for 3D view)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
80 * pycairo (to use Projector feature)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
81 * cairosvg (to use Projector feature)
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
82 * dbus (to inhibit sleep on some Linux systems)
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
83
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
84 ### Use Python virtual environment
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
85
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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).
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
87 The following section assumes Linux. Please see specific instructions for Windows and macOS X below.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
88
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
89 **Ubuntu/Debian note:** You might need to install `python3-venv` first.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
90
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
92
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
93
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
94 ```console
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
95 $ git clone https://github.com/kliment/Printrun.git # clone the repository
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
96 $ cd Printrun # change to Printrun directory
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
97 $ python3 -m venv venv # create an virtual environment
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
98 $ . venv/bin/activate # activate the virtual environment (notice the space after the dot)
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
100 (venv) $ python -m pip install -r requirements.txt # intall the rest of dependencies
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
101 (venv) $ python pronterface.py # run Pronterface
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
102 ```
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
103
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
104 ### Cython-based G-Code parser
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
105
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
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:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
107
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
108 ```console
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
109 (venv) $ python -m pip install Cython
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
110 (venv) $ python setup.py build_ext --inplace
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
111 ```
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
112
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
113 The warning message
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
115 WARNING:root:Memory-efficient GCoder implementation unavailable: No module named gcoder_line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
116
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
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.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
118
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
119 ### Ubuntu/Debian
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
120
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
122
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
123 Install the dependencies:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
124
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
125 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
127 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
128
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
129 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
130 sudo apt install python3-pip
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
131 pip3 install --user pyglet
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
132 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
133
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
134 Install git, clone this repository:
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
135 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
136 sudo apt install git
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
137 git clone https://github.com/kliment/Printrun.git
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
138 cd Printrun
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
139 ```
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
140
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
141 ### Windows
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
142
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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:
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
144
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
145 ```cmd
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
146 > py -3 -m venv venv
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
147 > venv\Scripts\activate
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
148 > python -m pip install -r requirements.txt
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
149 ```
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
150
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
151
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
152 ### macOS X
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
153
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
154 Install Python 3, you can use Brew:
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
155
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
156 ```console
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
157 $ brew install python3
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
158 ```
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
159
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
161
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
162
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
163 # USING PRINTRUN
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
164
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
165 ## USING PRONTERFACE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
166
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
167 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
168 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
169 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
170 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
171 The command box recognizes all pronsole commands, but has no tabcompletion.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
172
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
174
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
175 #### Slic3r integration
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
176
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
178
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
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.
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
180
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
181 ## USING PRONSOLE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
182
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
183 To use pronsole, you need:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
184
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
185 * Python 3 (ideally 3.6),
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
186 * pyserial (or python3-serial on ubuntu/debian) and
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
187 * pyreadline (not needed on Linux)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
188
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
189 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
190 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
191
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
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".
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
193 The "skeinforge" folder must be in the same folder as pronsole.py
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
194
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
195 ## USING PRINTCORE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
196
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
197 To use printcore you need Python 3 (ideally 3.6) and pyserial (or python3-serial on ubuntu/debian)
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
198 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
199 sender, or the following code example:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
200
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
201 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
202 #to send a file of gcode to the printer
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
203 from printrun.printcore import printcore
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
204 from printrun import gcoder
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
205 p=printcore('/dev/ttyUSB0',115200) # or p.printcore('COM3',115200) on Windows
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
206 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
207 gcode = gcoder.LightGCode(gcode)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
208 p.startprint(gcode) # this will start a print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
209
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
210 #If you need to interact with the printer:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
211 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
212 p.pause() # use these to pause/resume the current print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
213 p.resume()
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
214 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
215 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
216
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
217 ## PLATERS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
218
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
219 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
220
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
221 ## 3D VIEWER CONTROLS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
222
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
223 When the 3D viewer is enabled, the controls are the following:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
224 - Mousewheel: zoom (Control reduces the zoom change steps)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
225 - 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
226 - Left-click dragging: rotate view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
227 - Right-click dragging: pan view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
228 - Shift + left-click dragging: move object (in platers)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
229 - Page up/down keys: zoom (Control reduces the zoom change steps)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
230 - Up/down keys: explore layers
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
231 - R key: reset view
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
232 - F key: fit view to display entire print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
233 - C key: toggle "display current layer only" mode (in print gcode view)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
234
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
235 ## RPC SERVER
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
236
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
237 ```pronterface``` and ```pronsole``` start a RPC server, which runs by default
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
238 on localhost port 7978, which provides print progress information.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
239 Here is a sample Python script querying the print status:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
240
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
241 ```python
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
242 import xmlrpc.client
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
243
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
244 rpc = xmlrpc.client.ServerProxy('http://localhost:7978')
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
245 print(rpc.status())
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
246 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
247
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
248 ## CONFIGURATION
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
249
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
250 ### Build dimensions
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
251
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
252 Build dimensions can be specified using the build_dimensions option (which can
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
253 be graphically edited in Pronterface settings). This option is formed of 9 parameters:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
254 3 for the build volume dimensions, 3 for the build volume coordinate system
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
255 offset minimum, 3 for the endstop positions.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
256
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
257 The default value is `200x200x100+0+0+0+0+0+0`, which corresponds to a
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
258 200x200mm (width x height) bed with 100mm travel in Z (there are the first
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
259 three numbers) and no offset. The absolute coordinates system origin (0,0,0) is
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
260 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
261 bed surface is (200,200,0).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
262
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
263 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
264 center of the bed surface. This is achieved by using the next three parameters,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
265 for instance with `200x200x100-100-100+0+0+0+0`.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
266 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
267 the top right one at (100,100,0).
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
268
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
269 These two sets of settings should be sufficient for most people. However, for
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
270 some specific complicated setups and GCodes and some features, we might also
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
271 need the endstops positions for perfect display. These positions (which are
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
272 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
273 specified in absolute coordinates, so if you have your bed starting at
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
274 (-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
275 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
276 (-110,-110,5) for this option.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
277
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
278 ## USING MACROS AND CUSTOM BUTTONS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
279
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
280 ### Macros in pronsole and pronterface
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
281
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
282 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
283 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
284
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
285 All macros are saved automatically immediately after being entered.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
286
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
287 Example 1, simple one-line alias:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
288
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
289 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
290 PC> macro where M114
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 Instead of having to remember the code to query position, you can query the position:
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> where
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
297 X:25.00Y:11.43Z:5.11E:0.00
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
298 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
299
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
300 Example 2 - macros to switch between different slicer programs, using "set" command to change options:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
301
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
302 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
303 PC> macro use_slicer
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
304 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
305 ..> set sliceoptscommand Slic3r/slic3r.exe --load slic3r.ini
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
306 ..> set slicecommand Slic3r/slic3r.exe $s --load slic3r.ini --output $o
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
307 Macro 'use_slicer' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
308 PC> macro use_sfact
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
309 ..> set sliceoptscommand python skeinforge/skeinforge_application/skeinforge.py
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
310 ..> set slicecommand python skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py $s
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
311 Macro 'use_sfact' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
312 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
313
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
314 Example 3, simple parametric macro:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
315
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
316 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
317 PC> macro move_down_by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
318 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
319 ..> G91
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
320 ..> G1 Z-{0}
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
321 ..> G90
15
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
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
325 Invoke the macro to move the printhead down by 5 millimeters:
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> move_down_by 5
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
329 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
330
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
331 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
332 Note that this python code invocation also works in interactive prompt:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
333
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
334 ```python
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
335 PC> !print("Hello, printer!")
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
336 Hello printer!
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
337
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
338 PC> macro debug_on !self.p.loud = 1
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
339 Macro 'debug_on' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
340 PC> debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
341 PC> M114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
342 SENT: M114
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
343 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
344 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
345 RECV: ok
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
346 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
347
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
348 You can use macro command itself to create simple self-modify or toggle functionality:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
349
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
350 Example: swapping two macros to implement toggle:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
351
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
352 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
353 PC> macro toggle_debug_on
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 = 1
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
356 ..> !print("Diagnostic information ON")
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
357 ..> macro toggle_debug toggle_debug_off
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
358 ..>
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
359 Macro 'toggle_debug_on' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
360 PC> macro toggle_debug_off
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
361 Enter macro using indented lines, end with empty line
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
362 ..> !self.p.loud = 0
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
363 ..> !print("Diagnostic information OFF")
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
364 ..> macro toggle_debug toggle_debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
365 ..>
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
366 Macro 'toggle_debug_off' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
367 PC> macro toggle_debug toggle_debug_on
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
368 Macro 'toggle_debug' defined
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
369 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
370
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
371 Now, each time we invoke "toggle_debug" macro, it toggles debug information on and off:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
372
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
373 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
374 PC> toggle_debug
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
375 Diagnostic information ON
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
376
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
377 PC> toggle_debug
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
378 Diagnostic information OFF
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
379 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
380
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
381 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
382 It is okay to mix python code with pronsole commands, just keep the python indentation.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
383 For example, following macro toggles the diagnostic information similarily to the previous example:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
384
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
385 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
386 !if self.p.loud:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
387 !self.p.loud = 0
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
388 !print("Diagnostic information OFF")
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
389 !else:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
390 !self.p.loud = 1
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
391 !print("Diagnostic information ON")
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
392 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
393
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
394 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
395
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
396 All python code is executed in the context of the pronsole (or PronterWindow) object,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
397 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
398 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
399 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
400
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
401 Some useful python-mode-only variables:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
402
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
403 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
404 !self.settings - contains all settings, e.g.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
405 port (!self.settings.port), baudrate, xy_feedrate, e_feedrate, slicecommand, final_command, build_dimensions
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
406 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
407 !self.p - printcore object (see USING PRINTCORE section for using printcore object)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
408 !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
409 !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
410 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
411
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
412 Some useful methods:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
413
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
414 ```python
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
415 !self.onecmd - invokes raw command, e.g.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
416 !self.onecmd("move x 10")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
417 !self.onecmd("!print self.p.loud")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
418 !self.onecmd("button "+self.cur_button+" fanOFF /C cyan M107")
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
419 !self.project - invoke Projector
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
420 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
421
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
422 ## USING HOST COMMANDS
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
423
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
424 Pronsole and the console interface in Pronterface accept a number of commands
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
425 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
426 from inside a G-Code, simply prefix it with `;@`.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
427
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
428 List of available commands:
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
429
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
430 - `pause`: pauses the print until the user resumes it
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
431 - `run_script scriptname [arg1 ...]`: runs a custom script or program on the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
432 host computer. This can for instance be used to produce a sound to warn the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
433 user (e.g. `run_script beep -r 2` on machines were the `beep` util is
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
434 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
435 token can be used in the arguments to get the current gcode file name
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
436 - `run_gcode_script scripname [arg1 ...]`: same as `run_script`, except that
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
437 all lines displayed by the script will be interpreted in turn (so that G-Code
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
438 lines will be immediately sent to the printer)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
439 - `shell pythoncommand`: run a python command (can also be achieved by doing
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
440 `!pythoncommand`)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
441 - `set option value`: sets the value of an option, e.g. `set mainviz 3D`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
442 - `connect`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
443 - `block_until_online`: wait for the printer to be online. For instance you can
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
444 do `python pronsole.py -e "connect" -e "block_until_online" -e "upload
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
445 object.gcode"` to start pronsole, connect for the printer, wait for it to be
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
446 online to start uploading the `object.gcode` file.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
447 - `disconnect`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
448 - `load gcodefile`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
449 - `upload gcodefile target.g`: upload `gcodefile` to `target.g` on the SD card
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
450 - `slice stlfile`: slice `stlfile` and load the produced G-Code
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
451 - `print`: print the currently loaded file
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
452 - `sdprint target.g`: start a SD print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
453 - `ls`: list files on SD card
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
454 - `eta`: display remaining print time
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
455 - `gettemp`: get current printer temperatures
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
456 - `settemp`: set hotend target temperature
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
457 - `bedtemp`: set bed target temperature
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
458 - `monitor`: monitor printer progress during a print
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
459 - `tool K`: switch to tool K
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
460 - `move xK`: move along `x` axis (works with other axes too)
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
461 - `extrude length [speed]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
462 - `reverse length [speed]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
463 - `home [axis]`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
464 - `off`: turns off fans, motors, extruder, heatbed, power supply
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
465 - `exit`
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
466
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
467 # LICENSE
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
468
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
469 ```
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
470 Copyright (C) 2011-2020 Kliment Yanev, Guillaume Seguin
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
471
15
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
472 Printrun is free software: you can redistribute it and/or modify
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
473 it under the terms of the GNU General Public License as published by
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
474 the Free Software Foundation, either version 3 of the License, or
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
475 (at your option) any later version.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
476
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
477 Printrun is distributed in the hope that it will be useful,
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
478 but WITHOUT ANY WARRANTY; without even the implied warranty of
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
479 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
480 GNU General Public License for more details.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
481
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
482 You should have received a copy of the GNU General Public License
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
483 along with Printrun. If not, see <http://www.gnu.org/licenses/>.
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
484 ```
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
485
0bbb006204fc Added printrun sourcecode from
mbayer
parents:
diff changeset
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.
45
c82943fb205f updated main files to new github master version
mdd
parents: 15
diff changeset
487

mercurial