Skip to content

Commit 207c230

Browse files
committed
Merge branch 'dev_change_unit_system_name' into 'main'
changing "SImm" to "SI (mm)" See merge request kit/fast/lb/collaboration/additive-manufacturing/pygcodedecode!39
2 parents 83db10b + c8ffd2f commit 207c230

File tree

7 files changed

+20
-20
lines changed

7 files changed

+20
-20
lines changed

pyGCodeDecode/examples/benchy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def benchy_example():
3737
# set the start position of the extruder
3838
printer_setup.set_initial_position(
3939
initial_position={"X": 0.0, "Y": 0.0, "Z": 0.0, "E": 0.0},
40-
input_unit_system="SImm",
40+
input_unit_system="SI (mm)",
4141
)
4242

4343
# running the simulation by creating a simulation object
4444
benchy_simulation = simulation(
4545
gcode_path=data_dir / "benchy.gcode",
4646
initial_machine_setup=printer_setup,
47-
output_unit_system="SImm",
47+
output_unit_system="SI (mm)",
4848
)
4949

5050
# save a short summary of the simulation
@@ -63,7 +63,7 @@ def benchy_example():
6363
simulation=benchy_simulation,
6464
filepath=output_dir / "benchy_prusa_mini_event_series.csv",
6565
tolerance=1.0e-12,
66-
output_unit_system="SImm",
66+
output_unit_system="SI (mm)",
6767
)
6868

6969
# create a 3D-plot and save a VTK as well as a screenshot

pyGCodeDecode/gcode_interpreter.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def __init__(
170170
gcode_path: pathlib.Path,
171171
machine_name: str = None,
172172
initial_machine_setup: "setup" = None,
173-
output_unit_system: str = "SImm",
173+
output_unit_system: str = "SI (mm)",
174174
):
175175
"""Initialize the Simulation of a given G-code with initial machine setup or default machine.
176176
@@ -182,7 +182,7 @@ def __init__(
182182
gcode_path: (Path) path to GCode
183183
machine name: (string, default = None) name of the default machine to use
184184
initial_machine_setup: (setup, default = None) setup instance
185-
output_unit_system: (string, default = "SImm") available unit systems: SI, SImm & inch
185+
output_unit_system: (string, default = "SI (mm)") available unit systems: SI, SI (mm) & inch
186186
187187
Example:
188188
```python
@@ -195,7 +195,7 @@ def __init__(
195195
self.firmware = None
196196

197197
# set output unit system
198-
self.available_unit_systems = {"SI": 1e-3, "SImm": 1.0, "inch": 1 / 25.4}
198+
self.available_unit_systems = {"SI": 1e-3, "SI (mm)": 1.0, "inch": 1 / 25.4}
199199
if output_unit_system in self.available_unit_systems:
200200
self.output_unit_system = output_unit_system
201201
else:
@@ -814,8 +814,8 @@ def __init__(
814814
"""
815815
# the input unit system is only implemented for 'set_initial_position'.
816816
# Regardless, the class has this attribute so it's more similar to the simulation class.
817-
self.available_unit_systems = {"SI": 1e3, "SImm": 1.0, "inch": 25.4}
818-
self.input_unit_system = "SImm"
817+
self.available_unit_systems = {"SI": 1e3, "SI (mm)": 1.0, "inch": 25.4}
818+
self.input_unit_system = "SI (mm)"
819819

820820
self.initial_position = {
821821
"X": 0,

pyGCodeDecode/state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class state:
99
class p_settings:
1010
"""Store Printing Settings."""
1111

12-
def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SImm"):
12+
def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SI (mm)"):
1313
"""Initialize printing settings.
1414
1515
Args:
@@ -20,7 +20,7 @@ def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SImm"):
2020
vZ: (float) max z velocity
2121
vE: (float) max e velocity
2222
speed: (float) default target velocity
23-
units: (string, default = "SImm") unit settings
23+
units: (string, default = "SI (mm)") unit settings
2424
"""
2525
self.p_acc = p_acc # printing acceleration
2626
self.jerk = jerk # jerk settings

pyGCodeDecode/state_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
default_virtual_machine = {
8282
"absolute_position": True,
8383
"absolute_extrusion": True,
84-
"units": "SImm",
84+
"units": "SI (mm)",
8585
"initial_position": None,
8686
# general properties
8787
"nozzle_diam": 0.4,
@@ -281,7 +281,7 @@ def dict_list_traveler(line_dict_list: List[dict], initial_machine_setup: dict)
281281
if "G20" in line_dict:
282282
virtual_machine["units"] = "inch"
283283
if "G21" in line_dict:
284-
virtual_machine["units"] = "SImm"
284+
virtual_machine["units"] = "SI (mm)"
285285

286286
# position & velocity
287287
pos_keys = ["X", "Y", "Z"]

tests/test_end_to_end.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def test_end_to_end_extensive():
3232
# set the start position of the extruder
3333
printer_setup.set_initial_position(
3434
initial_position={"X": 0.0, "Y": 0.0, "Z": 0.0, "E": 0.0},
35-
input_unit_system="SImm",
35+
input_unit_system="SI (mm)",
3636
)
3737

3838
# running the simulation by creating a simulation object
3939
end_to_end_simulation = simulation(
4040
gcode_path=data_dir / "test_state_generator.gcode",
4141
initial_machine_setup=printer_setup,
42-
output_unit_system="SImm",
42+
output_unit_system="SI (mm)",
4343
)
4444

4545
# save a short summary of the simulation
@@ -57,7 +57,7 @@ def test_end_to_end_extensive():
5757
simulation=end_to_end_simulation,
5858
filepath=output_dir / "test_end_to_end_event_series.csv",
5959
tolerance=1.0e-12,
60-
output_unit_system="SImm",
60+
output_unit_system="SI (mm)",
6161
)
6262

6363
# create a 3D-plot and save a VTK as well as a screenshot

tests/test_planner_block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_planner_block():
2323
dist = 10
2424
pos_0 = position(0, 0, 0, 0)
2525
pos_1 = position(dist, 0, 0, 0)
26-
settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=10, units="SImm")
26+
settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=10, units="SI (mm)")
2727
state_0 = state(state_position=pos_0, state_p_settings=settings)
2828
state_1 = state(state_position=pos_1, state_p_settings=settings)
2929
state_1.prev_state = state_0
@@ -45,7 +45,7 @@ def test_planner_block():
4545
dist = 30
4646
pos_0 = position(0, 0, 0, 0)
4747
pos_1 = position(dist, 0, 0, 0)
48-
settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SImm")
48+
settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SI (mm)")
4949
state_0 = state(state_position=pos_0, state_p_settings=settings)
5050
state_1 = state(state_position=pos_1, state_p_settings=settings)
5151
state_1.prev_state = state_0
@@ -67,7 +67,7 @@ def test_planner_block():
6767
pos_1 = position(dist, 0, 0, 0)
6868
pos_2 = position(dist * 2, 0, 0, 0)
6969

70-
settings = state.p_settings(p_acc=100, jerk=10, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SImm")
70+
settings = state.p_settings(p_acc=100, jerk=10, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SI (mm)")
7171
state_0 = state(state_position=pos_0, state_p_settings=settings)
7272
state_1 = state(state_position=pos_1, state_p_settings=settings)
7373
state_2 = state(state_position=pos_2, state_p_settings=settings)

tests/test_state_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ def test_state_generator():
5757
assert states[12].state_position.get_vec(withExtrusion=True) == [7, 7, 7, 7] # abs move
5858
# assert states[13] # virtual null all axis
5959
assert states[14].state_position.get_vec(withExtrusion=True) == [14, 14, 14, 14] # abs move with offset
60-
assert states[14].state_p_settings.units == "SImm"
60+
assert states[14].state_p_settings.units == "SI (mm)"
6161
assert states[15].state_p_settings.units == "inch"
62-
assert states[16].state_p_settings.units == "SImm"
62+
assert states[16].state_p_settings.units == "SI (mm)"
6363
assert states[16].layer == 0
6464
assert states[17].comment == "LAYER cue"
6565
assert states[17].layer == 1

0 commit comments

Comments
 (0)