@@ -594,6 +594,7 @@ def generate_gear_shape(self, obj):
594
594
line4 = [p4 , p5 ]
595
595
line5 = [p5 , p6 ]
596
596
tooth = Wire (points_to_wire ([line1 , line2 , line3 , line4 , line5 ]))
597
+
597
598
edges = tooth .Edges
598
599
edges = insert_fillet (edges , 0 , m * root_fillet )
599
600
edges = insert_fillet (edges , 2 , m * head_fillet )
@@ -734,6 +735,8 @@ def generate_gear_shape(self, obj):
734
735
r_o = obj .outer_diameter / 2 * m
735
736
c = obj .clearance
736
737
h = obj .head
738
+ head_fillet = obj .head_fillet
739
+ root_fillet = obj .root_fillet
737
740
phi_i_end = np .arccos (1 - m / r_i * (1 + c ))
738
741
phi_o_end = np .arccos (1 - m / r_o * (1 + h ))
739
742
phi_i = np .linspace (phi_i_end , 0 , numpoints )
@@ -748,47 +751,50 @@ def generate_gear_shape(self, obj):
748
751
mirror = reflection (0 )
749
752
points_1 = mirror (points )[::- 1 ]
750
753
line_1 = [points [- 1 ], points_1 [0 ]]
751
- line_2 = [points_1 [- 1 ], points [0 ] + np .array ([0. , m * np .pi ])]
752
- tooth = points_to_wire ([points , line_1 , points_1 , line_2 ])
753
- head_fillet = obj .head_fillet
754
- if head_fillet != 0 :
755
- edges = tooth .Edges
756
- fillet1 = fillet_between_edges (edges [0 ], edges [1 ], m * head_fillet )
757
- fillet2 = fillet_between_edges (fillet1 [- 1 ], edges [2 ], m * head_fillet )
758
- tooth = Wire (fillet1 [:- 1 ] + fillet2 + edges [3 :])
754
+ line_2 = [points_1 [- 1 ], np .array ([- (1 + c ) * m , m * np .pi / 2 ])]
755
+ line_0 = [np .array ([- (1 + c ) * m , - m * np .pi / 2 ]), points [0 ]]
756
+ tooth = points_to_wire ([line_0 , points , line_1 , points_1 , line_2 ])
757
+
758
+ edges = tooth .Edges
759
+ edges = insert_fillet (edges , 0 , m * root_fillet )
760
+ edges = insert_fillet (edges , 2 , m * head_fillet )
761
+ edges = insert_fillet (edges , 4 , m * head_fillet )
762
+ edges = insert_fillet (edges , 6 , m * root_fillet )
759
763
764
+ tooth_edges = [e for e in edges if e is not None ]
765
+ p_end = np .array (tooth_edges [- 2 ].lastVertex ().Point [:- 1 ])
766
+ p_start = np .array (tooth_edges [1 ].firstVertex ().Point [:- 1 ])
767
+ p_start += np .array ([0 , np .pi * m ])
768
+ edge = points_to_wire ([[p_end , p_start ]]).Edges
769
+ tooth = Wire (tooth_edges [1 :- 1 ] + edge )
760
770
teeth = [tooth ]
771
+
761
772
for i in range (obj .teeth - 1 ):
762
773
tooth = copy .deepcopy (tooth )
763
774
tooth .translate (App .Vector (0 , np .pi * m , 0 ))
764
775
teeth .append (tooth )
776
+
765
777
teeth [- 1 ] = Wire (teeth [- 1 ].Edges [:- 1 ])
766
778
767
- # extending the profile
768
779
if obj .add_endings :
769
- p_0 = np .array ([y [0 ], - np .pi / 2 * m ])
770
- p_1 = p_0 + np .array ([- t , 0. ])
771
- p_3 = np .array ([y [0 ], - np .pi / 2 * m + obj .teeth * m * np .pi ])
772
- p_2 = p_3 + np .array ([- t , 0. ])
773
- p_end = points_1 [- 1 ] + np .array ([0 , np .pi * m * (obj .teeth - 1 )])
774
- line_3 = np .array ([p_0 , points [0 ]])
775
- line_4 = np .array ([p_end , p_3 ])
776
- l_ext_1 = points_to_wire ([line_3 ])
777
- l_ext_2 = points_to_wire ([line_4 ])
778
- l_ext_3 = points_to_wire ([np .array ([p_0 , p_1 ])])
779
- l_ext_4 = points_to_wire ([np .array ([p_1 , p_2 ])])
780
- l_ext_5 = points_to_wire ([np .array ([p_2 , p_3 ])])
781
- pol = Wire ([l_ext_4 , l_ext_3 , l_ext_1 ] + teeth + [l_ext_2 , l_ext_5 ])
782
- else :
783
- p_0 = points [0 ]
784
- p_1 = p_0 + np .array ([- t , 0. ])
785
- p_3 = points_1 [- 1 ] + np .array ([0 , np .pi * m * (obj .teeth - 1 )])
786
- p_2 = p_3 + np .array ([- t , 0. ])
787
- l_ext_3 = points_to_wire ([np .array ([p_0 , p_1 ])])
788
- l_ext_4 = points_to_wire ([np .array ([p_1 , p_2 ])])
789
- l_ext_5 = points_to_wire ([np .array ([p_2 , p_3 ])])
790
- pol = Wire ([l_ext_4 , l_ext_3 ] + teeth + [l_ext_5 ])
791
-
780
+ teeth = [Wire (tooth_edges [0 ])] + teeth
781
+ last_edge = tooth_edges [- 1 ]
782
+ last_edge .translate (App .Vector (0 , np .pi * m * (obj .teeth - 1 ), 0 ))
783
+ teeth = teeth + [Wire (last_edge )]
784
+
785
+ p_start = np .array (teeth [0 ].Edges [0 ].firstVertex ().Point [:- 1 ])
786
+ p_end = np .array (teeth [- 1 ].Edges [- 1 ].lastVertex ().Point [:- 1 ])
787
+ p_start_1 = p_start - np .array ([obj .thickness .Value , 0. ])
788
+ p_end_1 = p_end - np .array ([obj .thickness .Value , 0. ])
789
+
790
+ line6 = [p_start , p_start_1 ]
791
+ line7 = [p_start_1 , p_end_1 ]
792
+ line8 = [p_end_1 , p_end ]
793
+
794
+ bottom = points_to_wire ([line6 , line7 , line8 ])
795
+
796
+ pol = Wire ([bottom ] + teeth )
797
+
792
798
if obj .height .Value == 0 :
793
799
return pol
794
800
elif obj .beta .Value == 0 :
0 commit comments