arc¶
Arc Class¶
- class gcodeBuddy.arc.Arc(**kwargs)[source]¶
represents an arc toolpath travel
- Parameters
center (list[int, float]) – center point of arc travel
radius (int, float) – radius of arc travel
start_angle (int, float) – starting angle of arc travel from +x axis (degrees)
end_angle (int, float) – ending angle of arc travel from +x axis (degrees)
direction ("c", "cc") – direction of arc travel (clockwise or counter-clockwise)
- get_angle()[source]¶
- Returns
angle about center point traced out by arc travel (degrees)
- Return type
int, float
- get_direction()[source]¶
- Returns
direction of arc travel (clockwise or counter-clockwise)
- Return type
“c”, “cc”
- get_end_angle()[source]¶
- Returns
ending angle of arc travel from +x axis (degrees)
- Return type
int, float
- get_start_angle()[source]¶
- Returns
starting angle of arc travel from +x axis (degrees)
- Return type
int, float
- print()[source]¶
prints key arc values to the console. Useful for debugging/getting info about an Arc object
- set_center(new_center)[source]¶
changes center point of arc travel to new_center
- Parameters
new_center (list[int/float]) – new center point of arc travel
- set_direction(new_direction)[source]¶
changes direction of arc travel
- Parameters
new_direction ("c", "cc") – new direction of arc travel
- set_end_angle(new_end_angle)[source]¶
changes ending angle of arc travel
- Parameters
new_end_angle (int, float) – new ending angle of arc travel from +x axis (degrees)
Examples¶
# imports Arc object
from gcodeBuddy import Arc
# creating upper half of unit circle Arc object
upper_half_arc = Arc(center=[0, 0],
radius=1,
start_angle=0,
end_angle=180,
direction="cc")
# prints [0, 0]
print(upper_half_arc.get_center())
# plots arc in a new pop-up window
upper_half_arc.plot()
result of upper_half_arc.plot()¶
# imports Arc object
from gcodeBuddy import Arc
# imports Marlin Command object and function to convert Command Object to Arc object
from gcodeBuddy.marlin import Command, command_to_arc
# creating Command Object
arc_travel_command = Command("G3 X80.0 R10.0")
# converting Command object to Arc object (with an initial position)
arc = command_to_arc([100, 100], arc_travel_command)
# plotting arc object
arc.plot()
result of arc.plot()¶