mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 19:28:07 -06:00
Convert to Doxygen style comments
As per our code style. Contributes to issue CURA-5561.
This commit is contained in:
parent
f4fe5784a7
commit
43a8894c64
1 changed files with 8 additions and 15 deletions
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/env python
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import random
|
import random
|
||||||
from typing import Dict, List, Optional, Tuple
|
from typing import Dict, List, Optional, Tuple
|
||||||
|
|
||||||
|
@ -13,21 +14,16 @@ from typing import Dict, List, Optional, Tuple
|
||||||
DEFAULT_BUFFER_FILLING_RATE_IN_C_PER_MS = 50.0 / 1000.0 # The buffer filling rate in #commands/ms
|
DEFAULT_BUFFER_FILLING_RATE_IN_C_PER_MS = 50.0 / 1000.0 # The buffer filling rate in #commands/ms
|
||||||
DEFAULT_BUFFER_SIZE = 15 # The buffer size in #commands
|
DEFAULT_BUFFER_SIZE = 15 # The buffer size in #commands
|
||||||
|
|
||||||
|
## Gets the code and number from the given g-code line.
|
||||||
def get_code_and_num(gcode_line: str) -> Tuple[str, str]:
|
def get_code_and_num(gcode_line: str) -> Tuple[str, str]:
|
||||||
"""
|
|
||||||
Gets the code and number from the given GCode line.
|
|
||||||
"""
|
|
||||||
gcode_line = gcode_line.strip()
|
gcode_line = gcode_line.strip()
|
||||||
cmd_code = gcode_line[0].upper()
|
cmd_code = gcode_line[0].upper()
|
||||||
cmd_num = str(gcode_line[1:])
|
cmd_num = str(gcode_line[1:])
|
||||||
return cmd_code, cmd_num
|
return cmd_code, cmd_num
|
||||||
|
|
||||||
|
## Fetches arguments such as X1 Y2 Z3 from the given part list and returns a
|
||||||
|
# dict.
|
||||||
def get_value_dict(parts: List[str]) -> Dict[str, str]:
|
def get_value_dict(parts: List[str]) -> Dict[str, str]:
|
||||||
"""
|
|
||||||
Fetches arguments such as X1 Y2 Z3 from the given part list and returns a dict.
|
|
||||||
"""
|
|
||||||
value_dict = {}
|
value_dict = {}
|
||||||
for p in parts:
|
for p in parts:
|
||||||
p = p.strip()
|
p = p.strip()
|
||||||
|
@ -50,12 +46,9 @@ def calc_distance(pos1, pos2):
|
||||||
distance = math.sqrt(distance)
|
distance = math.sqrt(distance)
|
||||||
return distance
|
return distance
|
||||||
|
|
||||||
|
## Given the initial speed, the target speed, and the acceleration, calculate
|
||||||
|
# the distance that's neede for the acceleration to finish.
|
||||||
def calc_acceleration_distance(init_speed: float, target_speed: float, acceleration: float) -> float:
|
def calc_acceleration_distance(init_speed: float, target_speed: float, acceleration: float) -> float:
|
||||||
"""
|
|
||||||
Given the initial speed, the target speed, and the acceleration, calculate the distance that's needed for the
|
|
||||||
acceleration to finish.
|
|
||||||
"""
|
|
||||||
if acceleration == 0:
|
if acceleration == 0:
|
||||||
return 0.0
|
return 0.0
|
||||||
return (target_speed**2 - init_speed**2) / (2 * acceleration)
|
return (target_speed**2 - init_speed**2) / (2 * acceleration)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue