pySlicer 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. pyslicer-0.2.0/LICENSE +22 -0
  2. pyslicer-0.2.0/MANIFEST.in +1 -0
  3. pyslicer-0.2.0/PKG-INFO +216 -0
  4. pyslicer-0.2.0/README.md +187 -0
  5. pyslicer-0.2.0/pyproject.toml +70 -0
  6. pyslicer-0.2.0/setup.cfg +4 -0
  7. pyslicer-0.2.0/src/pyslicer/__init__.py +3 -0
  8. pyslicer-0.2.0/src/pyslicer/__main__.py +6 -0
  9. pyslicer-0.2.0/src/pyslicer/cli.py +341 -0
  10. pyslicer-0.2.0/src/pyslicer/clipper_ops.py +78 -0
  11. pyslicer-0.2.0/src/pyslicer/config.py +217 -0
  12. pyslicer-0.2.0/src/pyslicer/config.schema.json +242 -0
  13. pyslicer-0.2.0/src/pyslicer/constants.py +3 -0
  14. pyslicer-0.2.0/src/pyslicer/demo.py +262 -0
  15. pyslicer-0.2.0/src/pyslicer/gcode/__init__.py +24 -0
  16. pyslicer-0.2.0/src/pyslicer/gcode/cooling.py +102 -0
  17. pyslicer-0.2.0/src/pyslicer/gcode/motion.py +193 -0
  18. pyslicer-0.2.0/src/pyslicer/gcode/overhang.py +147 -0
  19. pyslicer-0.2.0/src/pyslicer/gcode/parse.py +39 -0
  20. pyslicer-0.2.0/src/pyslicer/gcode/pressure.py +20 -0
  21. pyslicer-0.2.0/src/pyslicer/gcode/seam.py +191 -0
  22. pyslicer-0.2.0/src/pyslicer/gcode/writer.py +323 -0
  23. pyslicer-0.2.0/src/pyslicer/geometry/__init__.py +47 -0
  24. pyslicer-0.2.0/src/pyslicer/geometry/contour.py +149 -0
  25. pyslicer-0.2.0/src/pyslicer/geometry/exceptions.py +25 -0
  26. pyslicer-0.2.0/src/pyslicer/geometry/facet.py +26 -0
  27. pyslicer-0.2.0/src/pyslicer/geometry/intersection.py +23 -0
  28. pyslicer-0.2.0/src/pyslicer/geometry/line.py +225 -0
  29. pyslicer-0.2.0/src/pyslicer/geometry/math_utils.py +22 -0
  30. pyslicer-0.2.0/src/pyslicer/geometry/vector_ops.py +43 -0
  31. pyslicer-0.2.0/src/pyslicer/geometry/vertex.py +44 -0
  32. pyslicer-0.2.0/src/pyslicer/infill/__init__.py +5 -0
  33. pyslicer-0.2.0/src/pyslicer/infill/linear.py +225 -0
  34. pyslicer-0.2.0/src/pyslicer/mesh/__init__.py +7 -0
  35. pyslicer-0.2.0/src/pyslicer/mesh/layer.py +40 -0
  36. pyslicer-0.2.0/src/pyslicer/mesh/model.py +108 -0
  37. pyslicer-0.2.0/src/pyslicer/mesh/stl_io.py +129 -0
  38. pyslicer-0.2.0/src/pyslicer/preview/__init__.py +25 -0
  39. pyslicer-0.2.0/src/pyslicer/preview/__main__.py +49 -0
  40. pyslicer-0.2.0/src/pyslicer/preview/bead_profile.py +72 -0
  41. pyslicer-0.2.0/src/pyslicer/preview/gcode_html.py +613 -0
  42. pyslicer-0.2.0/src/pyslicer/preview/gcode_parse.py +518 -0
  43. pyslicer-0.2.0/src/pyslicer/preview/render_anim.py +201 -0
  44. pyslicer-0.2.0/src/pyslicer/preview/viewer_js.py +1192 -0
  45. pyslicer-0.2.0/src/pyslicer/slicing/__init__.py +19 -0
  46. pyslicer-0.2.0/src/pyslicer/slicing/perimeters.py +70 -0
  47. pyslicer-0.2.0/src/pyslicer/slicing/plane.py +191 -0
  48. pyslicer-0.2.0/src/pyslicer/slicing/process.py +92 -0
  49. pyslicer-0.2.0/src/pyslicer/slicing/segments.py +174 -0
  50. pyslicer-0.2.0/src/pyslicer/timer.py +23 -0
  51. pyslicer-0.2.0/src/pyslicer.egg-info/PKG-INFO +216 -0
  52. pyslicer-0.2.0/src/pyslicer.egg-info/SOURCES.txt +74 -0
  53. pyslicer-0.2.0/src/pyslicer.egg-info/dependency_links.txt +1 -0
  54. pyslicer-0.2.0/src/pyslicer.egg-info/entry_points.txt +3 -0
  55. pyslicer-0.2.0/src/pyslicer.egg-info/requires.txt +13 -0
  56. pyslicer-0.2.0/src/pyslicer.egg-info/top_level.txt +1 -0
  57. pyslicer-0.2.0/tests/fixtures/cube_10mm.stl +0 -0
  58. pyslicer-0.2.0/tests/fixtures/make_cube_stl.py +44 -0
  59. pyslicer-0.2.0/tests/fixtures/tiny_square.gcode +44 -0
  60. pyslicer-0.2.0/tests/test_bead_profile.py +81 -0
  61. pyslicer-0.2.0/tests/test_cli.py +156 -0
  62. pyslicer-0.2.0/tests/test_clipper_ops.py +75 -0
  63. pyslicer-0.2.0/tests/test_config.py +205 -0
  64. pyslicer-0.2.0/tests/test_corner_concern.py +166 -0
  65. pyslicer-0.2.0/tests/test_demo.py +54 -0
  66. pyslicer-0.2.0/tests/test_gcode_extrusion.py +129 -0
  67. pyslicer-0.2.0/tests/test_gcode_structure.py +208 -0
  68. pyslicer-0.2.0/tests/test_geometry.py +241 -0
  69. pyslicer-0.2.0/tests/test_infill.py +33 -0
  70. pyslicer-0.2.0/tests/test_motion.py +142 -0
  71. pyslicer-0.2.0/tests/test_open_contours.py +36 -0
  72. pyslicer-0.2.0/tests/test_preview.py +273 -0
  73. pyslicer-0.2.0/tests/test_print_quality.py +308 -0
  74. pyslicer-0.2.0/tests/test_segments_join.py +108 -0
  75. pyslicer-0.2.0/tests/test_slice_smoke.py +48 -0
  76. pyslicer-0.2.0/tests/test_stl_io.py +116 -0
pyslicer-0.2.0/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 abelmont
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1 @@
1
+ recursive-include tests/fixtures *.gcode *.py *.stl
@@ -0,0 +1,216 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyslicer
3
+ Version: 0.2.0
4
+ Summary: A RepRap STL slicer and GCode generator
5
+ License-Expression: MIT
6
+ Project-URL: Homepage, https://github.com/isque03/pyslicer
7
+ Project-URL: Issues, https://github.com/isque03/pyslicer/issues
8
+ Project-URL: Releases, https://github.com/isque03/pyslicer/releases
9
+ Keywords: 3d-printing,fdm,gcode,stl,slicer
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Environment :: Console
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Topic :: Scientific/Engineering
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: numpy>=1.24
18
+ Requires-Dist: pyclipper>=1.3
19
+ Requires-Dist: PyYAML>=6.0
20
+ Requires-Dist: jsonschema>=4.18
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Requires-Dist: coverage>=7.0; extra == "dev"
24
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
25
+ Requires-Dist: pillow>=10.0; extra == "dev"
26
+ Provides-Extra: demo
27
+ Requires-Dist: pillow>=10.0; extra == "demo"
28
+ Dynamic: license-file
29
+
30
+ # pyslicer
31
+
32
+ pyslicer turns a 3D model file (STL) into printer instructions (G-code) for a filament 3D printer.
33
+
34
+ It reads the model, cuts it into layers, and generates walls, infill, and a browser preview of the print paths. PySlicer is early-stage software. Before running its G-code, confirm that the model placement and fixed startup and shutdown commands suit your printer. Automatic support generation is unavailable.
35
+
36
+ ![Simulated #3DBenchy print at 2×](https://raw.githubusercontent.com/isque03/pyslicer/master/docs/benchy_demo.gif)
37
+
38
+ ## Requirements
39
+
40
+ - Python 3.10 or newer
41
+ - A working pip install
42
+
43
+ ## Install
44
+
45
+ ```bash
46
+ python -m pip install pyslicer
47
+ ```
48
+
49
+ The `demo` extra adds GIF rendering support. Install it with `python -m pip install "pyslicer[demo]"`.
50
+
51
+ ## Use it
52
+
53
+ ```bash
54
+ python -m pyslicer model.stl output.gcode
55
+ ```
56
+
57
+ Or, after install:
58
+
59
+ ```bash
60
+ pyslicer model.stl output.gcode
61
+ ```
62
+
63
+ Replace `model.stl` with your model path and `output.gcode` with where you want the G-code saved.
64
+
65
+ ### Common options
66
+
67
+ | Option | What it does | Default |
68
+ |--------|----------------|---------|
69
+ | `-l` / `--layer-height` | Thickness of each layer, in mm | `0.1` |
70
+ | `-n` / `--num-perimeters` | How many outer wall loops to print | `3` |
71
+ | `-d` / `--filament-diameter` | Filament width, in mm | `1.75` |
72
+ | `-o` / `--perimeter_overlap_percent` | How much wall loops overlap (smaller means more overlap) | `1.0` |
73
+ | `-p` / `--perimeters_only` | Walls only; skip fill | off |
74
+ | `-a` / `--append_perimeters` | Also keep the original outline from the STL | off |
75
+ | `-v` / `--verbose` | Print more detail while running | off |
76
+
77
+ Example with a thicker layer and two walls:
78
+
79
+ ```bash
80
+ pyslicer model.stl output.gcode -l 0.2 -n 2
81
+ ```
82
+
83
+ ### YAML config files
84
+
85
+ You can put print settings in one or more YAML files and pass them with `--config`.
86
+ Files are layered left-to-right: later files override overlapping settings and add new ones.
87
+ Explicit CLI flags always win over config (including `--no-perimeters-only` /
88
+ `--no-append-perimeters` to force booleans off).
89
+
90
+ ```yaml
91
+ # base.yaml
92
+ layer_height: 0.2
93
+ num_perimeters: 3
94
+ nozzle_diameter: 0.4
95
+ outer_speed: 50
96
+
97
+ # fine.yaml
98
+ outer_speed: 40
99
+ print_temperature: 205
100
+ ```
101
+
102
+ ```bash
103
+ pyslicer model.stl out.gcode --config base.yaml,fine.yaml -l 0.15
104
+ ```
105
+
106
+ Precedence: CLI historical defaults → config layers → CLI flags.
107
+ Speeds that match CLI names (`outer_speed`, `inner_speed`, `infill_speed`,
108
+ `max_corner_speed`) are in mm/s. You may instead set `outer_perimeter_speed` /
109
+ `inner_perimeter_speed` in mm/min (not both forms for the same setting).
110
+ `infill_speed` and `max_corner_speed` have no mm/min YAML twin—they always mean mm/s.
111
+ Other Model print settings use Model attribute names and native units (for example
112
+ `print_temperature` in °C).
113
+
114
+ ### Print quality settings
115
+
116
+ Defaults bias **outer walls slower than inner** (50 vs 80 mm/s) for surface finish.
117
+ Recover print time on inner walls and infill; keep the outer/inner gap modest if
118
+ pressure advance is not tuned (large flow drops can blob at the seam).
119
+
120
+ | Key | Role |
121
+ |-----|------|
122
+ | `firmware` | `none` / `klipper` / `marlin` / `rrf` — dialect for optional PA emit |
123
+ | `pressure_advance` | Firmware-native PA/LA value; emitted only when `firmware` ≠ `none` |
124
+ | `seam_position` | `aligned` / `nearest` / `rear` / `none` |
125
+ | `wipe_distance` / `wipe_on_loops` / `seam_gap` | Seam cleanup (portable `G1` moves) |
126
+ | `enable_dynamic_overhang_speeds` | Overlap % vs previous layer → lower `F` |
127
+ | `overhang_speed_0`…`_75` | Percent of outer cruise at 0/25/50/75% overlap |
128
+ | `min_layer_time` | Seconds; `0` disables cooling slowdown |
129
+ | `dont_slow_down_outer_wall` | Prefer slowing inner/infill (default true) |
130
+ | `slow_down_min_speed` | Floor in mm/s for cooling/overhang slowdowns |
131
+
132
+ Pressure advance is machine-side and **not** portable across firmwares:
133
+
134
+ - Klipper: `SET_PRESSURE_ADVANCE ADVANCE=…`
135
+ - Marlin: `M900 K…` (requires `LIN_ADVANCE` in the firmware build)
136
+ - RRF: `M572 D0 S…`
137
+
138
+ Values are not interchangeable. Default `firmware: none` emits nothing.
139
+ Do not use slicer coasting / “advanced pressure” hacks with Klipper.
140
+
141
+ Available keys and types are defined in
142
+ [`src/pyslicer/config.schema.json`](https://github.com/isque03/pyslicer/blob/master/src/pyslicer/config.schema.json)
143
+ (validated automatically when you pass `--config`).
144
+ In VS Code / yaml-language-server, point a file at the schema like this:
145
+
146
+ ```yaml
147
+ # yaml-language-server: $schema=./src/pyslicer/config.schema.json
148
+ layer_height: 0.2
149
+ outer_speed: 50
150
+ inner_speed: 80
151
+ ```
152
+
153
+ ## Preview G-code in a browser
154
+
155
+ After you have a `.gcode` file:
156
+
157
+ ```bash
158
+ python -m pyslicer.preview output.gcode preview.html
159
+ ```
160
+
161
+ Or while slicing, write both at once:
162
+
163
+ ```bash
164
+ pyslicer model.stl output.gcode --html-preview preview.html
165
+ ```
166
+
167
+ Open the HTML file in any browser. You get a rotatable 3D view of the toolpaths
168
+ (drag to spin, scroll to zoom), per-layer 2D drawings, and the full G-code listing.
169
+
170
+ ## Demo: slice #3DBenchy and open the viewer
171
+
172
+ Downloads the CC0 [#3DBenchy](https://www.3dbenchy.com/) model (if needed),
173
+ slices it, writes an HTML preview, and opens it in your default browser
174
+ (macOS, Windows, and Linux):
175
+
176
+ ```bash
177
+ python -m pyslicer.demo
178
+ ```
179
+
180
+ Or, after install:
181
+
182
+ ```bash
183
+ pyslicer-demo
184
+ ```
185
+
186
+ Useful flags: `--no-open`, `--force-download`, `-l 0.4`, `-n 2`,
187
+ `--write-readme-gif` (writes `docs/benchy_demo.gif` at 2×; needs Pillow).
188
+
189
+ In the HTML viewer you can **Record movie** (WebM) or **Export GIF** of the simulation.
190
+
191
+ ## Tests
192
+
193
+ From the repository checkout:
194
+
195
+ ```bash
196
+ python -m pip install -e ".[dev]"
197
+ pytest
198
+ ```
199
+
200
+ To also check that most of the code is covered by tests:
201
+
202
+ ```bash
203
+ pytest --cov=pyslicer
204
+ ```
205
+
206
+
207
+ ## Project layout
208
+
209
+ - `src/pyslicer/` — the slicer code (geometry, slicing, fill, G-code)
210
+ - `tests/` — unit tests, including checks that G-code numbers and commands are correct
211
+ - `pyproject.toml` — package and dependency settings
212
+ - [Release procedure](https://github.com/isque03/pyslicer/blob/master/docs/PUBLISHING.md)
213
+
214
+ ## License
215
+
216
+ MIT. See [LICENSE](https://github.com/isque03/pyslicer/blob/master/LICENSE).
@@ -0,0 +1,187 @@
1
+ # pyslicer
2
+
3
+ pyslicer turns a 3D model file (STL) into printer instructions (G-code) for a filament 3D printer.
4
+
5
+ It reads the model, cuts it into layers, and generates walls, infill, and a browser preview of the print paths. PySlicer is early-stage software. Before running its G-code, confirm that the model placement and fixed startup and shutdown commands suit your printer. Automatic support generation is unavailable.
6
+
7
+ ![Simulated #3DBenchy print at 2×](https://raw.githubusercontent.com/isque03/pyslicer/master/docs/benchy_demo.gif)
8
+
9
+ ## Requirements
10
+
11
+ - Python 3.10 or newer
12
+ - A working pip install
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ python -m pip install pyslicer
18
+ ```
19
+
20
+ The `demo` extra adds GIF rendering support. Install it with `python -m pip install "pyslicer[demo]"`.
21
+
22
+ ## Use it
23
+
24
+ ```bash
25
+ python -m pyslicer model.stl output.gcode
26
+ ```
27
+
28
+ Or, after install:
29
+
30
+ ```bash
31
+ pyslicer model.stl output.gcode
32
+ ```
33
+
34
+ Replace `model.stl` with your model path and `output.gcode` with where you want the G-code saved.
35
+
36
+ ### Common options
37
+
38
+ | Option | What it does | Default |
39
+ |--------|----------------|---------|
40
+ | `-l` / `--layer-height` | Thickness of each layer, in mm | `0.1` |
41
+ | `-n` / `--num-perimeters` | How many outer wall loops to print | `3` |
42
+ | `-d` / `--filament-diameter` | Filament width, in mm | `1.75` |
43
+ | `-o` / `--perimeter_overlap_percent` | How much wall loops overlap (smaller means more overlap) | `1.0` |
44
+ | `-p` / `--perimeters_only` | Walls only; skip fill | off |
45
+ | `-a` / `--append_perimeters` | Also keep the original outline from the STL | off |
46
+ | `-v` / `--verbose` | Print more detail while running | off |
47
+
48
+ Example with a thicker layer and two walls:
49
+
50
+ ```bash
51
+ pyslicer model.stl output.gcode -l 0.2 -n 2
52
+ ```
53
+
54
+ ### YAML config files
55
+
56
+ You can put print settings in one or more YAML files and pass them with `--config`.
57
+ Files are layered left-to-right: later files override overlapping settings and add new ones.
58
+ Explicit CLI flags always win over config (including `--no-perimeters-only` /
59
+ `--no-append-perimeters` to force booleans off).
60
+
61
+ ```yaml
62
+ # base.yaml
63
+ layer_height: 0.2
64
+ num_perimeters: 3
65
+ nozzle_diameter: 0.4
66
+ outer_speed: 50
67
+
68
+ # fine.yaml
69
+ outer_speed: 40
70
+ print_temperature: 205
71
+ ```
72
+
73
+ ```bash
74
+ pyslicer model.stl out.gcode --config base.yaml,fine.yaml -l 0.15
75
+ ```
76
+
77
+ Precedence: CLI historical defaults → config layers → CLI flags.
78
+ Speeds that match CLI names (`outer_speed`, `inner_speed`, `infill_speed`,
79
+ `max_corner_speed`) are in mm/s. You may instead set `outer_perimeter_speed` /
80
+ `inner_perimeter_speed` in mm/min (not both forms for the same setting).
81
+ `infill_speed` and `max_corner_speed` have no mm/min YAML twin—they always mean mm/s.
82
+ Other Model print settings use Model attribute names and native units (for example
83
+ `print_temperature` in °C).
84
+
85
+ ### Print quality settings
86
+
87
+ Defaults bias **outer walls slower than inner** (50 vs 80 mm/s) for surface finish.
88
+ Recover print time on inner walls and infill; keep the outer/inner gap modest if
89
+ pressure advance is not tuned (large flow drops can blob at the seam).
90
+
91
+ | Key | Role |
92
+ |-----|------|
93
+ | `firmware` | `none` / `klipper` / `marlin` / `rrf` — dialect for optional PA emit |
94
+ | `pressure_advance` | Firmware-native PA/LA value; emitted only when `firmware` ≠ `none` |
95
+ | `seam_position` | `aligned` / `nearest` / `rear` / `none` |
96
+ | `wipe_distance` / `wipe_on_loops` / `seam_gap` | Seam cleanup (portable `G1` moves) |
97
+ | `enable_dynamic_overhang_speeds` | Overlap % vs previous layer → lower `F` |
98
+ | `overhang_speed_0`…`_75` | Percent of outer cruise at 0/25/50/75% overlap |
99
+ | `min_layer_time` | Seconds; `0` disables cooling slowdown |
100
+ | `dont_slow_down_outer_wall` | Prefer slowing inner/infill (default true) |
101
+ | `slow_down_min_speed` | Floor in mm/s for cooling/overhang slowdowns |
102
+
103
+ Pressure advance is machine-side and **not** portable across firmwares:
104
+
105
+ - Klipper: `SET_PRESSURE_ADVANCE ADVANCE=…`
106
+ - Marlin: `M900 K…` (requires `LIN_ADVANCE` in the firmware build)
107
+ - RRF: `M572 D0 S…`
108
+
109
+ Values are not interchangeable. Default `firmware: none` emits nothing.
110
+ Do not use slicer coasting / “advanced pressure” hacks with Klipper.
111
+
112
+ Available keys and types are defined in
113
+ [`src/pyslicer/config.schema.json`](https://github.com/isque03/pyslicer/blob/master/src/pyslicer/config.schema.json)
114
+ (validated automatically when you pass `--config`).
115
+ In VS Code / yaml-language-server, point a file at the schema like this:
116
+
117
+ ```yaml
118
+ # yaml-language-server: $schema=./src/pyslicer/config.schema.json
119
+ layer_height: 0.2
120
+ outer_speed: 50
121
+ inner_speed: 80
122
+ ```
123
+
124
+ ## Preview G-code in a browser
125
+
126
+ After you have a `.gcode` file:
127
+
128
+ ```bash
129
+ python -m pyslicer.preview output.gcode preview.html
130
+ ```
131
+
132
+ Or while slicing, write both at once:
133
+
134
+ ```bash
135
+ pyslicer model.stl output.gcode --html-preview preview.html
136
+ ```
137
+
138
+ Open the HTML file in any browser. You get a rotatable 3D view of the toolpaths
139
+ (drag to spin, scroll to zoom), per-layer 2D drawings, and the full G-code listing.
140
+
141
+ ## Demo: slice #3DBenchy and open the viewer
142
+
143
+ Downloads the CC0 [#3DBenchy](https://www.3dbenchy.com/) model (if needed),
144
+ slices it, writes an HTML preview, and opens it in your default browser
145
+ (macOS, Windows, and Linux):
146
+
147
+ ```bash
148
+ python -m pyslicer.demo
149
+ ```
150
+
151
+ Or, after install:
152
+
153
+ ```bash
154
+ pyslicer-demo
155
+ ```
156
+
157
+ Useful flags: `--no-open`, `--force-download`, `-l 0.4`, `-n 2`,
158
+ `--write-readme-gif` (writes `docs/benchy_demo.gif` at 2×; needs Pillow).
159
+
160
+ In the HTML viewer you can **Record movie** (WebM) or **Export GIF** of the simulation.
161
+
162
+ ## Tests
163
+
164
+ From the repository checkout:
165
+
166
+ ```bash
167
+ python -m pip install -e ".[dev]"
168
+ pytest
169
+ ```
170
+
171
+ To also check that most of the code is covered by tests:
172
+
173
+ ```bash
174
+ pytest --cov=pyslicer
175
+ ```
176
+
177
+
178
+ ## Project layout
179
+
180
+ - `src/pyslicer/` — the slicer code (geometry, slicing, fill, G-code)
181
+ - `tests/` — unit tests, including checks that G-code numbers and commands are correct
182
+ - `pyproject.toml` — package and dependency settings
183
+ - [Release procedure](https://github.com/isque03/pyslicer/blob/master/docs/PUBLISHING.md)
184
+
185
+ ## License
186
+
187
+ MIT. See [LICENSE](https://github.com/isque03/pyslicer/blob/master/LICENSE).
@@ -0,0 +1,70 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pyslicer"
7
+ version = "0.2.0"
8
+ description = "A RepRap STL slicer and GCode generator"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ keywords = ["3d-printing", "fdm", "gcode", "stl", "slicer"]
14
+ classifiers = [
15
+ "Development Status :: 3 - Alpha",
16
+ "Environment :: Console",
17
+ "Programming Language :: Python :: 3",
18
+ "Topic :: Scientific/Engineering",
19
+ ]
20
+ dependencies = [
21
+ "numpy>=1.24",
22
+ "pyclipper>=1.3",
23
+ "PyYAML>=6.0",
24
+ "jsonschema>=4.18",
25
+ ]
26
+
27
+ [project.urls]
28
+ Homepage = "https://github.com/isque03/pyslicer"
29
+ Issues = "https://github.com/isque03/pyslicer/issues"
30
+ Releases = "https://github.com/isque03/pyslicer/releases"
31
+
32
+ [project.optional-dependencies]
33
+ dev = [
34
+ "pytest>=7.0",
35
+ "coverage>=7.0",
36
+ "pytest-cov>=4.0",
37
+ "pillow>=10.0",
38
+ ]
39
+ demo = [
40
+ "pillow>=10.0",
41
+ ]
42
+
43
+ [project.scripts]
44
+ pyslicer = "pyslicer.cli:main"
45
+ pyslicer-demo = "pyslicer.demo:main"
46
+
47
+ [tool.setuptools.packages.find]
48
+ where = ["src"]
49
+
50
+ [tool.setuptools.package-data]
51
+ pyslicer = ["config.schema.json"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
55
+ pythonpath = ["src"]
56
+
57
+ [tool.coverage.run]
58
+ source = ["pyslicer"]
59
+ omit = [
60
+ "*/pyslicer/__main__.py",
61
+ ]
62
+
63
+ [tool.coverage.report]
64
+ fail_under = 81
65
+ show_missing = true
66
+ skip_empty = true
67
+ exclude_lines = [
68
+ "pragma: no cover",
69
+ "def to_svg",
70
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """pyslicer — STL slicer and GCode generator."""
2
+
3
+ __version__ = "0.2.0"
@@ -0,0 +1,6 @@
1
+ """python -m pyslicer"""
2
+
3
+ from pyslicer.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()