Skip to content

Commit e27ad62

Browse files
author
Jonathan Knirsch
committed
all line length updated
1 parent 69124b2 commit e27ad62

7 files changed

Lines changed: 33 additions & 19 deletions

File tree

pyGCodeDecode/abaqus_file_generator.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
1111
An example output looks like this:
1212
13-
time x y z extrusion bool -> 1 = extrusion moving to next step, 0 = no extrusion
13+
time x y z extrusion bool -> 1 = extrusion moving to next, 0 = no extrusion
1414
0.0, 1.0, 0.0, 2.0, 1
1515
0.44, 1.0, 22.0, 2.0, 0
1616
17-
time points generated are always at segment beginnings / endings, so interpolation linearly is the exact solution
17+
time points generated are always at segment beginnings / endings,
18+
so interpolation linearly is the exact solution
1819
1920
"""
2021

@@ -70,7 +71,8 @@ def generate_abaqus_event_series(
7071
with filepath.open("w") as outfile:
7172
for time, position in zip(times, positions, strict=True):
7273
outfile.write(
73-
f"{float(time)},{round(scaling * position[0], round_to)},{round(scaling * position[1], round_to)},"
74+
f"{float(time)},{round(scaling * position[0], round_to)},"
75+
f"{round(scaling * position[1], round_to)},"
7476
f"{round(scaling * position[2], round_to)},{position[3]}\n"
7577
)
7678
event_series_list.append(

pyGCodeDecode/examples/benchy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@
1111

1212

1313
def benchy_example() -> None:
14-
"""Extensive example for the usage of pyGCodeDecode simulating G-code for the famous 3DBenchy."""
14+
"""Extensive example for the usage of pyGCodeDecode simulating G-code for the 3DBenchy."""
1515
# setting the paths to the input and output directories
1616
data_dir = importlib.resources.files("pyGCodeDecode").joinpath("examples/data/")
1717
output_dir = pathlib.Path.cwd() / "output_benchy_example"
1818

1919
custom_print(
2020
"Running pyGCD's benchy example! 🛥️"
21-
"\nThis example illustrates an extensive use of the package: \nA gcode is simulated with default presets from a "
22-
"file provided alongside this example. After the simulation, an interactive 3D-plot is shown."
21+
"\nThis example illustrates an extensive use of the package: "
22+
"\nA gcode is simulated with default presets from a "
23+
"file provided alongside this example. After the simulation, "
24+
"an interactive 3D-plot is shown."
2325
"\nThe following files are saved to a new folder in your current directory: ",
2426
output_dir.__str__() + " 💾",
2527
"\n - a screenshot of the 3D-plot 📸"

pyGCodeDecode/examples/brace.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Minimal example simulating the G-code of a brace from Aura-slicer on an Anisoprint Composer A4."""
1+
"""Minimal example simulating the G-code of a brace from Aura-slicer on Anisoprint Composer A4."""
22

33
import importlib.resources
44

@@ -11,8 +11,10 @@ def brace_example() -> None:
1111
"""Minimal example for the usage of pyGCodeDecode simulating the G-code of a brace."""
1212
custom_print(
1313
"Running pyGCD's brace example! 📎"
14-
"\nThis example illustrates the simplest use of the package: A gcode is simulated with default presets "
15-
"\nprovided by the package. After the simulation, an interactive 3D-plot is shown. No output is saved."
14+
"\nThis example illustrates the simplest use of the package: "
15+
"A gcode is simulated with default presets "
16+
"\nprovided by the package. After the simulation, an interactive 3D-plot is shown. "
17+
"No output is saved."
1618
)
1719

1820
gcode_path = importlib.resources.files("pyGCodeDecode").joinpath("examples/data/brace.gcode")

pyGCodeDecode/helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def get_verbosity_level() -> int:
4343

4444

4545
def custom_print(*args: object, lvl: int = 2, **kwargs: object) -> None:
46-
"""Sanitize outputs for ABAQUS and print them if the log level is high enough. Takes all arguments for print.
46+
"""Sanitize outputs for ABAQUS and print them if the log level is high enough.
4747
4848
Args:
4949
*args: arguments to be printed
@@ -118,7 +118,7 @@ def update(self, progress: float) -> None:
118118
"""Display or update a console progress bar.
119119
120120
Args:
121-
progress: float between 0 and 1 for percentage, < 0 represents a 'halt', > 1 represents 100%
121+
progress: float between 0 and 1, < 0 represents a 'halt', > 1 represents 100%
122122
"""
123123
global _active_progress_bar
124124

@@ -150,10 +150,10 @@ def update(self, progress: float) -> None:
150150
if self.last_progress_update != progress_percent or status != "":
151151
block = int(round(barLength * progress, ndigits=0))
152152
if progress < 1.0:
153-
text = f"\r[{'#' * block + '-' * (barLength - block)}] {progress_percent} % of {self.name} {status}"
153+
text = f"\r[{'#' * block + '-' * (barLength - block)}] "
154+
f"{progress_percent} % of {self.name} {status}"
154155
else:
155156
text = f"\r{_levels.get(self.verbosity_level, '')} ✅ Done with {self.name}"
156-
# text = f"\r[{'#' * block + '-' * (barLength - block)}] ✅ Done with {self.name}"
157157
self.last_text = text
158158
sys.stdout.write(text)
159159
sys.stdout.flush()

pyGCodeDecode/state.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66

77

88
class state:
9-
"""State contains a Position and Printing Settings (p_settings) to apply for the corresponding move to this State."""
9+
"""State contains a Position and Printing Settings (p_settings).
10+
11+
Used to apply for the corresponding move to this State.
12+
"""
1013

1114
class p_settings:
1215
"""Store Printing Settings."""

pyGCodeDecode/state_generator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ def _dict_list_traveler(line_dict_list: list[dict], initial_machine_setup: dict)
224224
225225
Args:
226226
line_dict_list: (dict) dict list with commands
227-
initial_machine_setup: (dict) dict with initial machine setup [absolute_position, absolute_extrusion, units, initial_position...]
227+
initial_machine_setup: (dict) dict with initial machine setup
228+
[absolute_position, absolute_extrusion, units, initial_position...]
228229
229230
Returns:
230231
state_list: (list[state]) all states in a list
@@ -489,7 +490,8 @@ def _check_for_unsupported_commands(line_dict_list: dict) -> dict:
489490
[f"'{key}' ({value} time(s))" for key, value in unsupported_command_counts.items()]
490491
)
491492
custom_print(
492-
f"⚠️ {len(unsupported_command_counts.keys())} known but unsupported command(s) found: {commands_str}",
493+
f"⚠️ {len(unsupported_command_counts.keys())} known but "
494+
f"unsupported command(s) found: {commands_str}",
493495
lvl=1,
494496
)
495497
else:

pyGCodeDecode/tools.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def save_layer_metrics(
2121
Args:
2222
simulation: (simulation) simulation instance
2323
filepath: (Path , default = "./layer_metrics.csv") file name
24-
locale: (string, default = None) select locale settings, e.g. "en_US.utf8", None = use system locale
24+
locale: (string, default = None) select locale settings,
25+
e.g. "en_US.utf8", None = use system locale
2526
delimiter: (string, default = ";") select delimiter
2627
2728
Layers are detected using the given layer cue.
@@ -33,7 +34,8 @@ def save_layer_metrics(
3334
# check if a layer cue was specified
3435
if "layer_cue" not in simulation.initial_machine_setup_dict:
3536
custom_print(
36-
"⚠️ No layer_cue was specified in the simulation setup. Therefore, layer metrics can not be saved!",
37+
"⚠️ No layer_cue was specified in the simulation setup. "
38+
"Therefore, layer metrics can not be saved!",
3739
lvl=1,
3840
)
3941
return None
@@ -88,7 +90,8 @@ def save_layer_metrics(
8890
# create directory if necessary
8991
Path(filepath).parent.mkdir(parents=True, exist_ok=True)
9092

91-
header = f"layer{delimiter} layer time in s{delimiter} travel distance in mm{delimiter} avg speed in mm/s"
93+
header = f"layer{delimiter} layer time in s{delimiter} travel distance "
94+
f"in mm{delimiter} avg speed in mm/s"
9295
data = np.array([layers, durations, travel_distances, avg_speeds], dtype=object).T
9396
np.savetxt(
9497
fname=filepath,

0 commit comments

Comments
 (0)