sivicncdriver.arc_calculator module

The arc_calculator module

It creates small segments from an arc given with G-codes parameters : origin, end, path to center and sense of rotation.

Example:
>>> from arc_calculator import arc_to_segments
>>> a = arc_to_segments((0,0),(5,0),(10,0))
>>> for x,y in a:
...     print((x,y))
...
(0.0, 6.12323e-16)
(0.09966, -0.993334)
(0.39469, -1.94708)
(0.87331, -2.8232)
(1.51646, -3.58677)
(2.29848, -4.20735)
(3.1882, -4.66019)
(4.15015, -4.92725)
(5.14598, -4.99787)
(6.136, -4.86924)
(7.08072, -4.54649)
(7.94249, -4.04249)
(8.68696, -3.37733)
(9.28444, -2.57752)
(9.71111, -1.67495)
(10, 0)
sivicncdriver.arc_calculator.arc_to_segments(start, vect_to_center, end, clockwise=False, length=1)[source]

Creates small segments from an arc.

Uses Decimal for better precision. It yields the vertices.

Parameters:
  • start (A float tuple) – The starting position
  • vect_to_center (A float tuple) – A vector to go to the center of the arc from the starting position
  • end (A float tuple) – The ending position
  • clockwise (bool) – Should it go clockwise ?
  • length (float) – length of the segments
Returns:

None, it yields vertices.