Skip to content

Commit

Permalink
more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo committed Jan 4, 2024
1 parent 5d09b9b commit 2136e1b
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions freecad/gears/basegear.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def __setstate__(self, state):
self.icon_fn = state["icon_fn"]


class BaseGear(object):
class BaseGear():
def __init__(self, obj):
obj.addProperty(
"App::PropertyString", "version", "version", "freecad.gears-version", 1
Expand All @@ -101,9 +101,11 @@ def __init__(self, obj):
self.make_attachable(obj)

def make_attachable(self, obj):
# Needed to make this object "attachable",
# aka able to attach parameterically to other objects
# cf. https://wiki.freecadweb.org/Scripted_objects_with_attachment
"""
Needed to make this object "attachable",
aka able to attach parameterically to other objects
cf. https://wiki.freecadweb.org/Scripted_objects_with_attachment
"""
if int(app.Version()[1]) >= 19:
obj.addExtension("Part::AttachExtensionPython")
else:
Expand Down Expand Up @@ -152,11 +154,19 @@ def __getstate__(self):
pass


def part_arc_from_points_and_center(p_1, p_2, m):
p_1, p_12, p_2 = arc_from_points_and_center(p_1, p_2, m)
return part.Arc(
app.Vector(*p_1, 0.0), app.Vector(*p_12, 0.0), app.Vector(*p_2, 0.0)
)
def part_arc_from_points_and_center(point_1, point_2, center):
"""_summary_
Args:
point_1 (list, np.array with 2 values): 2d point start of arc
point_1 (list, np.array with 2 values): 2d point end of arc
center (list, np.array with 2 values): the 2d center of the arc
Returns:
freecad.part.Arc: a arc with
"""
p_1, p_12, p_2 = arc_from_points_and_center(point_1, point_2, center)
return part.Arc(fcvec(p_1), fcvec(p_12), fcvec(p_2))


def helical_extrusion(face, height, angle, double_helix=False):
Expand Down

0 comments on commit 2136e1b

Please sign in to comment.