virtual-extruders 0.1.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.
- virtual_extruders-0.1.0/LICENSE +21 -0
- virtual_extruders-0.1.0/MANIFEST.in +2 -0
- virtual_extruders-0.1.0/PKG-INFO +157 -0
- virtual_extruders-0.1.0/README.rst +133 -0
- virtual_extruders-0.1.0/pyproject.toml +114 -0
- virtual_extruders-0.1.0/setup.cfg +4 -0
- virtual_extruders-0.1.0/tests/__init__.py +0 -0
- virtual_extruders-0.1.0/tests/data/basic.gcode +949 -0
- virtual_extruders-0.1.0/tests/data/basic_out.gcode +964 -0
- virtual_extruders-0.1.0/tests/data/basic_out_custom_gcode.gcode +961 -0
- virtual_extruders-0.1.0/tests/data/basic_out_skip_first_tc.gcode +965 -0
- virtual_extruders-0.1.0/tests/data/custom_tc_block.gcode +961 -0
- virtual_extruders-0.1.0/tests/data/custom_tc_block_out.gcode +964 -0
- virtual_extruders-0.1.0/tests/data/custom_tc_block_out_skip_first_tc.gcode +965 -0
- virtual_extruders-0.1.0/tests/data/err_different_tool_temperatures.gcode +962 -0
- virtual_extruders-0.1.0/tests/data/err_unknown_tool_gcode.gcode +1 -0
- virtual_extruders-0.1.0/tests/data/err_unmatched_block_end.gcode +11 -0
- virtual_extruders-0.1.0/tests/data/err_unmatched_block_start.gcode +12 -0
- virtual_extruders-0.1.0/tests/data/err_unmatched_block_start_2.gcode +11 -0
- virtual_extruders-0.1.0/tests/data/single_extruder.gcode +733 -0
- virtual_extruders-0.1.0/tests/test_cli.py +131 -0
- virtual_extruders-0.1.0/tests/test_process.py +51 -0
- virtual_extruders-0.1.0/tests/test_utils.py +160 -0
- virtual_extruders-0.1.0/tests/util.py +16 -0
- virtual_extruders-0.1.0/virtual_extruders.egg-info/PKG-INFO +157 -0
- virtual_extruders-0.1.0/virtual_extruders.egg-info/SOURCES.txt +28 -0
- virtual_extruders-0.1.0/virtual_extruders.egg-info/dependency_links.txt +1 -0
- virtual_extruders-0.1.0/virtual_extruders.egg-info/entry_points.txt +2 -0
- virtual_extruders-0.1.0/virtual_extruders.egg-info/top_level.txt +1 -0
- virtual_extruders-0.1.0/virtual_extruders.py +310 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stygian-violet.
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: virtual-extruders
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A CLI tool to convert multi-extruder 3D printer G-code to single extruder.
|
|
5
|
+
Author-email: stygian-violet <stygianviol3t@proton.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/stygian-violet/virtual-extruders
|
|
8
|
+
Project-URL: Source, https://github.com/stygian-violet/virtual-extruders
|
|
9
|
+
Project-URL: Issues, https://github.com/stygian-violet/virtual-extruders/issues
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Manufacturing
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
+
Classifier: Topic :: File Formats
|
|
18
|
+
Classifier: Topic :: Printing
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/x-rst
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
virtual-extruders
|
|
26
|
+
=================
|
|
27
|
+
|
|
28
|
+
.. image:: https://img.shields.io/pypi/v/virtual-extruders.svg
|
|
29
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
30
|
+
.. image:: https://img.shields.io/pypi/status/virtual-extruders.svg
|
|
31
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
32
|
+
.. image:: https://img.shields.io/pypi/format/virtual-extruders.svg
|
|
33
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
34
|
+
.. image:: https://img.shields.io/pypi/pyversions/virtual-extruders.svg
|
|
35
|
+
:target: https://python.org
|
|
36
|
+
.. image:: https://img.shields.io/pypi/l/virtual-extruders.svg
|
|
37
|
+
:target: https://github.com/stygian-violet/virtual-extruders/blob/master/LICENSE
|
|
38
|
+
|
|
39
|
+
Overview
|
|
40
|
+
--------
|
|
41
|
+
|
|
42
|
+
Convert G-code for a multi-extruder 3D printer to single extruder,
|
|
43
|
+
substituting tool selection with manual filament change.
|
|
44
|
+
|
|
45
|
+
Requirements
|
|
46
|
+
------------
|
|
47
|
+
|
|
48
|
+
- `Python <https://www.python.org/>`__ >= 3.10
|
|
49
|
+
|
|
50
|
+
Installation
|
|
51
|
+
------------
|
|
52
|
+
|
|
53
|
+
Pip
|
|
54
|
+
^^^
|
|
55
|
+
|
|
56
|
+
.. code-block:: console
|
|
57
|
+
|
|
58
|
+
pip install virtual-extruders
|
|
59
|
+
|
|
60
|
+
Portable
|
|
61
|
+
^^^^^^^^
|
|
62
|
+
|
|
63
|
+
Copy `virtual_extruders.py
|
|
64
|
+
<https://github.com/stygian-violet/virtual-extruders/blob/master/virtual_extruders.py>`__
|
|
65
|
+
to any directory and make it executable.
|
|
66
|
+
|
|
67
|
+
.. code-block:: console
|
|
68
|
+
|
|
69
|
+
install -m755 -D -t ~/.config/PrusaSlicer/scripts virtual_extruders.py
|
|
70
|
+
|
|
71
|
+
Usage
|
|
72
|
+
-----
|
|
73
|
+
|
|
74
|
+
CLI
|
|
75
|
+
^^^
|
|
76
|
+
|
|
77
|
+
The command-line interface can be used
|
|
78
|
+
with ``virtual-extruders`` if it was installed with a package manager
|
|
79
|
+
or with ``/path/to/virtual_extruders.py`` otherwise.
|
|
80
|
+
|
|
81
|
+
::
|
|
82
|
+
|
|
83
|
+
> ./virtual_extruders.py -h
|
|
84
|
+
usage: virtual_extruders.py [-h] [-V] [-i] [-f] [-g GCODE [GCODE ...]] file
|
|
85
|
+
|
|
86
|
+
positional arguments:
|
|
87
|
+
file g-code file
|
|
88
|
+
|
|
89
|
+
options:
|
|
90
|
+
-h, --help show this help message and exit
|
|
91
|
+
-V, --version show program's version number and exit
|
|
92
|
+
-i, --in-place edit the file in place
|
|
93
|
+
-f, --skip-first skip first tool change
|
|
94
|
+
-g, --tool-change-gcode GCODE [GCODE ...]
|
|
95
|
+
set tool change g-code (default: [';TOOL_CHANGE',
|
|
96
|
+
'M117 Insert filament [next_extruder] and resume
|
|
97
|
+
printing', 'M600', ';TOOL_CHANGE_END'])
|
|
98
|
+
|
|
99
|
+
PrusaSlicer
|
|
100
|
+
^^^^^^^^^^^
|
|
101
|
+
|
|
102
|
+
To use this program as a post-processing script in PrusaSlicer,
|
|
103
|
+
add the following line to the **Post-processing scripts** parameter
|
|
104
|
+
in **Print Settings** → **Output options**:
|
|
105
|
+
|
|
106
|
+
.. code-block:: console
|
|
107
|
+
|
|
108
|
+
virtual-extruders -i -f
|
|
109
|
+
|
|
110
|
+
For more detailed configuration instructions and a test model, see
|
|
111
|
+
`How to change filament mid-layer
|
|
112
|
+
<https://www.printables.com/model/1908968-how-to-change-filament-mid-layer>`__.
|
|
113
|
+
|
|
114
|
+
Development
|
|
115
|
+
-----------
|
|
116
|
+
|
|
117
|
+
Installation
|
|
118
|
+
^^^^^^^^^^^^
|
|
119
|
+
|
|
120
|
+
.. code-block:: console
|
|
121
|
+
|
|
122
|
+
python -m venv env
|
|
123
|
+
source env/bin/activate
|
|
124
|
+
pip install --group dev -e .
|
|
125
|
+
|
|
126
|
+
Building
|
|
127
|
+
^^^^^^^^
|
|
128
|
+
|
|
129
|
+
.. code-block:: console
|
|
130
|
+
|
|
131
|
+
python -m build
|
|
132
|
+
|
|
133
|
+
Testing
|
|
134
|
+
^^^^^^^
|
|
135
|
+
|
|
136
|
+
.. code-block:: console
|
|
137
|
+
|
|
138
|
+
coverage run && coverage report
|
|
139
|
+
|
|
140
|
+
Linting
|
|
141
|
+
^^^^^^^
|
|
142
|
+
|
|
143
|
+
.. code-block:: console
|
|
144
|
+
|
|
145
|
+
ruff check && mypy
|
|
146
|
+
|
|
147
|
+
Uploading
|
|
148
|
+
^^^^^^^^^
|
|
149
|
+
|
|
150
|
+
.. code-block:: console
|
|
151
|
+
|
|
152
|
+
twine upload dist/*
|
|
153
|
+
|
|
154
|
+
Licenses
|
|
155
|
+
--------
|
|
156
|
+
|
|
157
|
+
- `virtual-extruders <https://github.com/stygian-violet/virtual-extruders/blob/master/LICENSE>`__
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
virtual-extruders
|
|
2
|
+
=================
|
|
3
|
+
|
|
4
|
+
.. image:: https://img.shields.io/pypi/v/virtual-extruders.svg
|
|
5
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
6
|
+
.. image:: https://img.shields.io/pypi/status/virtual-extruders.svg
|
|
7
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
8
|
+
.. image:: https://img.shields.io/pypi/format/virtual-extruders.svg
|
|
9
|
+
:target: https://pypi.python.org/pypi/virtual-extruders
|
|
10
|
+
.. image:: https://img.shields.io/pypi/pyversions/virtual-extruders.svg
|
|
11
|
+
:target: https://python.org
|
|
12
|
+
.. image:: https://img.shields.io/pypi/l/virtual-extruders.svg
|
|
13
|
+
:target: https://github.com/stygian-violet/virtual-extruders/blob/master/LICENSE
|
|
14
|
+
|
|
15
|
+
Overview
|
|
16
|
+
--------
|
|
17
|
+
|
|
18
|
+
Convert G-code for a multi-extruder 3D printer to single extruder,
|
|
19
|
+
substituting tool selection with manual filament change.
|
|
20
|
+
|
|
21
|
+
Requirements
|
|
22
|
+
------------
|
|
23
|
+
|
|
24
|
+
- `Python <https://www.python.org/>`__ >= 3.10
|
|
25
|
+
|
|
26
|
+
Installation
|
|
27
|
+
------------
|
|
28
|
+
|
|
29
|
+
Pip
|
|
30
|
+
^^^
|
|
31
|
+
|
|
32
|
+
.. code-block:: console
|
|
33
|
+
|
|
34
|
+
pip install virtual-extruders
|
|
35
|
+
|
|
36
|
+
Portable
|
|
37
|
+
^^^^^^^^
|
|
38
|
+
|
|
39
|
+
Copy `virtual_extruders.py
|
|
40
|
+
<https://github.com/stygian-violet/virtual-extruders/blob/master/virtual_extruders.py>`__
|
|
41
|
+
to any directory and make it executable.
|
|
42
|
+
|
|
43
|
+
.. code-block:: console
|
|
44
|
+
|
|
45
|
+
install -m755 -D -t ~/.config/PrusaSlicer/scripts virtual_extruders.py
|
|
46
|
+
|
|
47
|
+
Usage
|
|
48
|
+
-----
|
|
49
|
+
|
|
50
|
+
CLI
|
|
51
|
+
^^^
|
|
52
|
+
|
|
53
|
+
The command-line interface can be used
|
|
54
|
+
with ``virtual-extruders`` if it was installed with a package manager
|
|
55
|
+
or with ``/path/to/virtual_extruders.py`` otherwise.
|
|
56
|
+
|
|
57
|
+
::
|
|
58
|
+
|
|
59
|
+
> ./virtual_extruders.py -h
|
|
60
|
+
usage: virtual_extruders.py [-h] [-V] [-i] [-f] [-g GCODE [GCODE ...]] file
|
|
61
|
+
|
|
62
|
+
positional arguments:
|
|
63
|
+
file g-code file
|
|
64
|
+
|
|
65
|
+
options:
|
|
66
|
+
-h, --help show this help message and exit
|
|
67
|
+
-V, --version show program's version number and exit
|
|
68
|
+
-i, --in-place edit the file in place
|
|
69
|
+
-f, --skip-first skip first tool change
|
|
70
|
+
-g, --tool-change-gcode GCODE [GCODE ...]
|
|
71
|
+
set tool change g-code (default: [';TOOL_CHANGE',
|
|
72
|
+
'M117 Insert filament [next_extruder] and resume
|
|
73
|
+
printing', 'M600', ';TOOL_CHANGE_END'])
|
|
74
|
+
|
|
75
|
+
PrusaSlicer
|
|
76
|
+
^^^^^^^^^^^
|
|
77
|
+
|
|
78
|
+
To use this program as a post-processing script in PrusaSlicer,
|
|
79
|
+
add the following line to the **Post-processing scripts** parameter
|
|
80
|
+
in **Print Settings** → **Output options**:
|
|
81
|
+
|
|
82
|
+
.. code-block:: console
|
|
83
|
+
|
|
84
|
+
virtual-extruders -i -f
|
|
85
|
+
|
|
86
|
+
For more detailed configuration instructions and a test model, see
|
|
87
|
+
`How to change filament mid-layer
|
|
88
|
+
<https://www.printables.com/model/1908968-how-to-change-filament-mid-layer>`__.
|
|
89
|
+
|
|
90
|
+
Development
|
|
91
|
+
-----------
|
|
92
|
+
|
|
93
|
+
Installation
|
|
94
|
+
^^^^^^^^^^^^
|
|
95
|
+
|
|
96
|
+
.. code-block:: console
|
|
97
|
+
|
|
98
|
+
python -m venv env
|
|
99
|
+
source env/bin/activate
|
|
100
|
+
pip install --group dev -e .
|
|
101
|
+
|
|
102
|
+
Building
|
|
103
|
+
^^^^^^^^
|
|
104
|
+
|
|
105
|
+
.. code-block:: console
|
|
106
|
+
|
|
107
|
+
python -m build
|
|
108
|
+
|
|
109
|
+
Testing
|
|
110
|
+
^^^^^^^
|
|
111
|
+
|
|
112
|
+
.. code-block:: console
|
|
113
|
+
|
|
114
|
+
coverage run && coverage report
|
|
115
|
+
|
|
116
|
+
Linting
|
|
117
|
+
^^^^^^^
|
|
118
|
+
|
|
119
|
+
.. code-block:: console
|
|
120
|
+
|
|
121
|
+
ruff check && mypy
|
|
122
|
+
|
|
123
|
+
Uploading
|
|
124
|
+
^^^^^^^^^
|
|
125
|
+
|
|
126
|
+
.. code-block:: console
|
|
127
|
+
|
|
128
|
+
twine upload dist/*
|
|
129
|
+
|
|
130
|
+
Licenses
|
|
131
|
+
--------
|
|
132
|
+
|
|
133
|
+
- `virtual-extruders <https://github.com/stygian-violet/virtual-extruders/blob/master/LICENSE>`__
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools >= 77.0.3"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "virtual-extruders"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "A CLI tool to convert multi-extruder 3D printer G-code to single extruder."
|
|
9
|
+
readme = "README.rst"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICEN[CS]E*"]
|
|
13
|
+
keywords = []
|
|
14
|
+
authors = [
|
|
15
|
+
{ name = "stygian-violet", email = "stygianviol3t@proton.me" }
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 4 - Beta",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Intended Audience :: Manufacturing",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
25
|
+
"Topic :: File Formats",
|
|
26
|
+
"Topic :: Printing",
|
|
27
|
+
"Topic :: Utilities"
|
|
28
|
+
]
|
|
29
|
+
dependencies = []
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/stygian-violet/virtual-extruders"
|
|
33
|
+
Source = "https://github.com/stygian-violet/virtual-extruders"
|
|
34
|
+
Issues = "https://github.com/stygian-violet/virtual-extruders/issues"
|
|
35
|
+
|
|
36
|
+
[project.scripts]
|
|
37
|
+
virtual-extruders = "virtual_extruders:main"
|
|
38
|
+
|
|
39
|
+
[dependency-groups]
|
|
40
|
+
dev = [
|
|
41
|
+
"build",
|
|
42
|
+
"coverage",
|
|
43
|
+
"mypy",
|
|
44
|
+
"pytest",
|
|
45
|
+
"ruff",
|
|
46
|
+
"twine"
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
[tool.setuptools]
|
|
50
|
+
include-package-data = true
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.dynamic]
|
|
53
|
+
version = {attr = "virtual_extruders.__version__"}
|
|
54
|
+
|
|
55
|
+
[tool.coverage.run]
|
|
56
|
+
command_line = "-m pytest"
|
|
57
|
+
source_pkgs = ["virtual_extruders", "tests"]
|
|
58
|
+
branch = true
|
|
59
|
+
parallel = true
|
|
60
|
+
omit = [
|
|
61
|
+
"**/tests/**/*",
|
|
62
|
+
"**/__about__.py"
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
[tool.coverage.paths]
|
|
66
|
+
virtual_extruders = ["virtual_extruders.py"]
|
|
67
|
+
tests = ["tests"]
|
|
68
|
+
|
|
69
|
+
[tool.coverage.report]
|
|
70
|
+
fail_under = 80
|
|
71
|
+
show_missing = true
|
|
72
|
+
exclude_lines = [
|
|
73
|
+
"no cov",
|
|
74
|
+
"if __name__ == .__main__.:",
|
|
75
|
+
"if TYPE_CHECKING:"
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
[tool.mypy]
|
|
79
|
+
disallow_untyped_defs = true
|
|
80
|
+
enable_error_code = [ "ignore-without-code" ]
|
|
81
|
+
files = [
|
|
82
|
+
"*.py",
|
|
83
|
+
"tests/**/*.py"
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[tool.ruff]
|
|
87
|
+
line-length = 80
|
|
88
|
+
|
|
89
|
+
[tool.ruff.format]
|
|
90
|
+
preview = true
|
|
91
|
+
quote-style = "single"
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
preview = true
|
|
95
|
+
ignore = [
|
|
96
|
+
"E741",
|
|
97
|
+
"EM101",
|
|
98
|
+
"EM102",
|
|
99
|
+
"PLW0108",
|
|
100
|
+
"TID252",
|
|
101
|
+
"TRY003"
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
[tool.ruff.lint.per-file-ignores]
|
|
105
|
+
"tests/**/*" = [
|
|
106
|
+
"ARG001",
|
|
107
|
+
"N803",
|
|
108
|
+
"N814",
|
|
109
|
+
"N817",
|
|
110
|
+
"S101"
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[tool.ruff.lint.pydocstyle]
|
|
114
|
+
convention = "numpy"
|
|
File without changes
|