From 76d30e022ea6258eda355d9617c53b97aa39d8b6 Mon Sep 17 00:00:00 2001 From: looooo Date: Sun, 5 Jan 2020 23:58:01 +0100 Subject: [PATCH] fix pep8 errors --- examples/animation.py | 14 ++++++-------- freecad/gears/features.py | 33 ++++----------------------------- 2 files changed, 10 insertions(+), 37 deletions(-) diff --git a/examples/animation.py b/examples/animation.py index 6e39d99..e8ea23f 100644 --- a/examples/animation.py +++ b/examples/animation.py @@ -1,11 +1,12 @@ # script for bevel-gear animation from PySide import QtGui, QtCore -import FreeCADGui as Gui +import FreeCAD as app +import FreeCADGui as gui import numpy as np import imageio -doc = App.ActiveDocument +doc = app.ActiveDocument g2 = doc.Common g1 = doc.Common001 @@ -15,12 +16,9 @@ def make_pics(): n = 30 for i in range(n): phi = np.pi * 2 / 30 / n - g1.Placement.Rotation.Angle += phi * 2 - g2.Placement.Rotation.Angle -= phi - Gui.activeDocument().activeView().saveImage('/home/lo/Schreibtisch/animated_gear/gear_{}.png'.format(i) ,300,300,'Current') - -def make_animated_gif(): - + g1.Placement.Rotation.Angle += phi * 2 + g2.Placement.Rotation.Angle -= phi + gui.activeDocument().activeView().saveImage('/home/lo/Schreibtisch/animated_gear/gear_{}.png'.format(i) ,300,300,'Current') def update(*args): print("time") diff --git a/freecad/gears/features.py b/freecad/gears/features.py index 79c509a..3d91466 100644 --- a/freecad/gears/features.py +++ b/freecad/gears/features.py @@ -36,10 +36,10 @@ from Part import BSplineCurve, Shape, Wire, Face, makePolygon, \ show, makePolygon, makeHelix, makeShell, makeSolid -__all__ = ["involute_gear", - "cycloide_gear", - "bevel_gear", - "involute_gear_rack", +__all__ = ["InvoluteGear", + "CycloideGear", + "BevelGear", + "InvoluteGearRack", "ViewProviderGear"] @@ -548,31 +548,6 @@ class BevelGear(object): new_phi = np.sqrt(np.linalg.norm(point)) * phi return rotation3D(new_phi)(point) - def create_teeth(self, pts, pos, teeth): - w1 = [] - pts = [pt * pos for pt in pts] - rotated_pts = scaled_points - rot = rotation3D(- 2 * i * np.pi / teeth) - for i in range(teeth - 1): - rotated_pts = map(rot, rotated_pts) - pts.append(np.array([pts[-1][-1], rotated_pts[0][0]])) - pts += rotated_pts - s = Wire(Shape(w1).Edges) - wi = [] - for i in range(teeth): - rot = App.Matrix() - rot.rotateZ(2 * i * np.pi / teeth) - tooth_rot = s.transformGeometry(rot) - if i != 0: - pt_0 = wi[-1].Edges[-1].Vertexes[0].Point - pt_1 = tooth_rot.Edges[0].Vertexes[-1].Point - wi.append(Wire([Line(pt_0, pt_1).toShape()])) - wi.append(tooth_rot) - pt_0 = wi[-1].Edges[-1].Vertexes[0].Point - pt_1 = wi[0].Edges[0].Vertexes[-1].Point - wi.append(Wire([Line(pt_0, pt_1).toShape()])) - return(Wire(wi)) - def __getstate__(self): return None