From c8ffd2fa7b471c24d0b213e9dc2d0a9ea28297c6 Mon Sep 17 00:00:00 2001 From: Lukas Hof Date: Tue, 14 Jan 2025 14:19:33 +0100 Subject: [PATCH] changing "SImm" to "SI (mm)" --- pyGCodeDecode/examples/benchy.py | 6 +++--- pyGCodeDecode/gcode_interpreter.py | 10 +++++----- pyGCodeDecode/state.py | 4 ++-- pyGCodeDecode/state_generator.py | 4 ++-- tests/test_end_to_end.py | 6 +++--- tests/test_planner_block.py | 6 +++--- tests/test_state_generator.py | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pyGCodeDecode/examples/benchy.py b/pyGCodeDecode/examples/benchy.py index 40da57a..1d5310d 100644 --- a/pyGCodeDecode/examples/benchy.py +++ b/pyGCodeDecode/examples/benchy.py @@ -37,14 +37,14 @@ def benchy_example(): # set the start position of the extruder printer_setup.set_initial_position( initial_position={"X": 0.0, "Y": 0.0, "Z": 0.0, "E": 0.0}, - input_unit_system="SImm", + input_unit_system="SI (mm)", ) # running the simulation by creating a simulation object benchy_simulation = simulation( gcode_path=data_dir / "benchy.gcode", initial_machine_setup=printer_setup, - output_unit_system="SImm", + output_unit_system="SI (mm)", ) # save a short summary of the simulation @@ -63,7 +63,7 @@ def benchy_example(): simulation=benchy_simulation, filepath=output_dir / "benchy_prusa_mini_event_series.csv", tolerance=1.0e-12, - output_unit_system="SImm", + output_unit_system="SI (mm)", ) # create a 3D-plot and save a VTK as well as a screenshot diff --git a/pyGCodeDecode/gcode_interpreter.py b/pyGCodeDecode/gcode_interpreter.py index 7f91066..9554529 100644 --- a/pyGCodeDecode/gcode_interpreter.py +++ b/pyGCodeDecode/gcode_interpreter.py @@ -170,7 +170,7 @@ def __init__( gcode_path: pathlib.Path, machine_name: str = None, initial_machine_setup: "setup" = None, - output_unit_system: str = "SImm", + output_unit_system: str = "SI (mm)", ): """Initialize the Simulation of a given G-code with initial machine setup or default machine. @@ -182,7 +182,7 @@ def __init__( gcode_path: (Path) path to GCode machine name: (string, default = None) name of the default machine to use initial_machine_setup: (setup, default = None) setup instance - output_unit_system: (string, default = "SImm") available unit systems: SI, SImm & inch + output_unit_system: (string, default = "SI (mm)") available unit systems: SI, SI (mm) & inch Example: ```python @@ -195,7 +195,7 @@ def __init__( self.firmware = None # set output unit system - self.available_unit_systems = {"SI": 1e-3, "SImm": 1.0, "inch": 1 / 25.4} + self.available_unit_systems = {"SI": 1e-3, "SI (mm)": 1.0, "inch": 1 / 25.4} if output_unit_system in self.available_unit_systems: self.output_unit_system = output_unit_system else: @@ -814,8 +814,8 @@ def __init__( """ # the input unit system is only implemented for 'set_initial_position'. # Regardless, the class has this attribute so it's more similar to the simulation class. - self.available_unit_systems = {"SI": 1e3, "SImm": 1.0, "inch": 25.4} - self.input_unit_system = "SImm" + self.available_unit_systems = {"SI": 1e3, "SI (mm)": 1.0, "inch": 25.4} + self.input_unit_system = "SI (mm)" self.initial_position = { "X": 0, diff --git a/pyGCodeDecode/state.py b/pyGCodeDecode/state.py index d844e43..a181e0a 100644 --- a/pyGCodeDecode/state.py +++ b/pyGCodeDecode/state.py @@ -9,7 +9,7 @@ class state: class p_settings: """Store Printing Settings.""" - def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SImm"): + def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SI (mm)"): """Initialize printing settings. Args: @@ -20,7 +20,7 @@ def __init__(self, p_acc, jerk, vX, vY, vZ, vE, speed, units="SImm"): vZ: (float) max z velocity vE: (float) max e velocity speed: (float) default target velocity - units: (string, default = "SImm") unit settings + units: (string, default = "SI (mm)") unit settings """ self.p_acc = p_acc # printing acceleration self.jerk = jerk # jerk settings diff --git a/pyGCodeDecode/state_generator.py b/pyGCodeDecode/state_generator.py index fc370c8..7acc298 100644 --- a/pyGCodeDecode/state_generator.py +++ b/pyGCodeDecode/state_generator.py @@ -81,7 +81,7 @@ default_virtual_machine = { "absolute_position": True, "absolute_extrusion": True, - "units": "SImm", + "units": "SI (mm)", "initial_position": None, # general properties "nozzle_diam": 0.4, @@ -281,7 +281,7 @@ def dict_list_traveler(line_dict_list: List[dict], initial_machine_setup: dict) if "G20" in line_dict: virtual_machine["units"] = "inch" if "G21" in line_dict: - virtual_machine["units"] = "SImm" + virtual_machine["units"] = "SI (mm)" # position & velocity pos_keys = ["X", "Y", "Z"] diff --git a/tests/test_end_to_end.py b/tests/test_end_to_end.py index d348c27..49a2568 100644 --- a/tests/test_end_to_end.py +++ b/tests/test_end_to_end.py @@ -32,14 +32,14 @@ def test_end_to_end_extensive(): # set the start position of the extruder printer_setup.set_initial_position( initial_position={"X": 0.0, "Y": 0.0, "Z": 0.0, "E": 0.0}, - input_unit_system="SImm", + input_unit_system="SI (mm)", ) # running the simulation by creating a simulation object end_to_end_simulation = simulation( gcode_path=data_dir / "test_state_generator.gcode", initial_machine_setup=printer_setup, - output_unit_system="SImm", + output_unit_system="SI (mm)", ) # save a short summary of the simulation @@ -57,7 +57,7 @@ def test_end_to_end_extensive(): simulation=end_to_end_simulation, filepath=output_dir / "test_end_to_end_event_series.csv", tolerance=1.0e-12, - output_unit_system="SImm", + output_unit_system="SI (mm)", ) # create a 3D-plot and save a VTK as well as a screenshot diff --git a/tests/test_planner_block.py b/tests/test_planner_block.py index 55431bf..d7d98ee 100644 --- a/tests/test_planner_block.py +++ b/tests/test_planner_block.py @@ -23,7 +23,7 @@ def test_planner_block(): dist = 10 pos_0 = position(0, 0, 0, 0) pos_1 = position(dist, 0, 0, 0) - settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=10, units="SImm") + settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=10, units="SI (mm)") state_0 = state(state_position=pos_0, state_p_settings=settings) state_1 = state(state_position=pos_1, state_p_settings=settings) state_1.prev_state = state_0 @@ -45,7 +45,7 @@ def test_planner_block(): dist = 30 pos_0 = position(0, 0, 0, 0) pos_1 = position(dist, 0, 0, 0) - settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SImm") + settings = state.p_settings(p_acc=100, jerk=0, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SI (mm)") state_0 = state(state_position=pos_0, state_p_settings=settings) state_1 = state(state_position=pos_1, state_p_settings=settings) state_1.prev_state = state_0 @@ -67,7 +67,7 @@ def test_planner_block(): pos_1 = position(dist, 0, 0, 0) pos_2 = position(dist * 2, 0, 0, 0) - settings = state.p_settings(p_acc=100, jerk=10, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SImm") + settings = state.p_settings(p_acc=100, jerk=10, vX=100, vY=100, vZ=100, vE=100, speed=100, units="SI (mm)") state_0 = state(state_position=pos_0, state_p_settings=settings) state_1 = state(state_position=pos_1, state_p_settings=settings) state_2 = state(state_position=pos_2, state_p_settings=settings) diff --git a/tests/test_state_generator.py b/tests/test_state_generator.py index 34ea1c8..8463be5 100644 --- a/tests/test_state_generator.py +++ b/tests/test_state_generator.py @@ -57,9 +57,9 @@ def test_state_generator(): assert states[12].state_position.get_vec(withExtrusion=True) == [7, 7, 7, 7] # abs move # assert states[13] # virtual null all axis assert states[14].state_position.get_vec(withExtrusion=True) == [14, 14, 14, 14] # abs move with offset - assert states[14].state_p_settings.units == "SImm" + assert states[14].state_p_settings.units == "SI (mm)" assert states[15].state_p_settings.units == "inch" - assert states[16].state_p_settings.units == "SImm" + assert states[16].state_p_settings.units == "SI (mm)" assert states[16].layer == 0 assert states[17].comment == "LAYER cue" assert states[17].layer == 1