misc_functions

angle Function

class gcodeBuddy.misc_functions.angle(center_point, end_point)[source]

returns angle between line formed by two points and +x direction

Parameters
  • center_point (list[int, float], tuple(int, float)) – point to be considered as the origin

  • end_point (list[int, float], tuple(int, float)) – point to form line with the relative origin point

Returns

angle between line and +x axis, relative to origin point (degrees)

Return type

float

Examples

Basic Usage of angle()
# imports angle function
from gcodeBuddy import angle

# creating necessary parameter points
center_point = (2, 3)
end_point = (4, 5)

# returns 45.0
ret_angle = angle(center_point, end_point)
graph showing center point at (2, 3) and end point at end point (4, 5), with angle between line formed by two points and positive axis relative to center point

Visualization of angle() Example

centers_from_params Function

class gcodeBuddy.misc_functions.centers_from_params(point_a, point_b, radius)[source]

returns two possible center positions of an arc given two points on arc and a radius

Parameters
  • point_a (list[int, float], tuple(int, float)) – one of two distinct points on arc

  • point_b (list[int, float], tuple(int, float)) – one of two distinct points on arc

  • radius (int, float) – radius of arc

Returns

two possible center point values

Return type

list[list[int, float]]

Examples

Basic Usage of centers_from_params()
# imports centers_from_params function
from gcodeBuddy import centers_from_params

# creating parameter variables
point_a = (2, 5)
point_b = (10, 5)
radius = 5

# returns (6.0, 8.0), (6.0, 2.0)
center_1, center_2 = centers_from_params(point_a, point_b, radius)
graph showing point a at (2, 5) and point b at (10, 5), with the two circles formed by these two points and a radius of 5

Visualization of centers_from_params() example

unit_convert Function

class gcodeBuddy.misc_functions.unit_convert(value, current_units, needed_units)[source]

converts given value to specified units

Parameters
  • value (int, float) – numerical value to convert

  • current_units (str) – current units of value

  • needed_units (str) – units to convert value to

Returns

value in requisite units

Return type

int, float

Supported Units:

Position: “mm”, “cm”, “m”, “in”, “ft”

Speed: “mm/sec”, “mm/min”, “cm/sec”, “cm/min”, “m/sec”, “m/min”, “in/sec”, “in/min”, “ft/sec”, “ft/min”

Acceleration: Coming soon.

Examples

Basic Usage of unit_convert()
# imports unit_convert()
from gcodeBuddy import unit_convert

# returns 10.0
ret_val_1 = unit_convert(1, "cm", "mm")

# returns 12.0
ret_val_2 = unit_convert(1, "ft/sec", "in/sec")

# returns 29.6359
ret_val_3 = unit_convert(70, "in/min", "mm/sec")