The goal is to produce a so called helical gear
as shown on the picture below:
I have completed the profile generation (TopoDS_Wire
--> TopoDS_Face
using BRepBuilderAPI_MakeFace
) - the face on top of the gear depicted.
I think the task is to linearly sweep the face/wire along the gear axis going through the drill hole in the middle while rotating the face by a constant angle defining the helix angle until the desired gear height is reached...
I thought about using GeomFill_Pipe
or BRepOffsetAPI_MakePipeShell
but I have no idea how to use it...
Could you please have a look and share any ideas / code snippet which might help me or at least to kick me in the right direction to investigate?
Many thanks in adnvance to anyone willing to help me...
Unfortunately, noone replied till I have found a solution on my own. Here it is as it may help someone else facing the same issue one day...
The algorithm description:
Gear rim width is divided into several steps (nSteps
). For each step, the required rotation angle as well as the translation is calculated using the formula:
rotation_angle = atan( b_TranslationStep * CONST_FACTOR )
where
b_TranslationStep
is rim width which corresponds to the step calculated,
CONST_FACTOR = 2 * tan( beta ) / d_a
where
beta
is helical gear helix angle
d_a
is outside circle diameter
Using the rotation and translation transformations applied to the rim profile, the section wires defining the rim shape are created. Once done, the section wires are used by BRepOffsetAPI_ThruSections
to generate resulting helical gear raw rim shape.
The gear profile face is constructed in XY plane while the axis of the gear is aligned with Z axis. GearProfile is constructed previously and is a closed wire "containing" all the teeth.
Implementation:
/* TopoDS_Wire GearProfile is constructed previously - out of the question scope */
TopoDS_Shape HelicalGearRim( const TopoDS_Wire & GearProfile )
{
double ToothFaceWidth = 10e-3; /* 10mm */
double HelixAngle = 0.349; /* [rad] --> 20deg */
double OutsideDiameter = 42e-3; /* 42mm */
int nSteps = 10;
/* Make solid with the faces interpolated */
BRepOffsetAPI_ThruSections tShapeGen( Standard_True, Standard_False );
/* Instantiate rim profile transformations */
gp_Trsf RimProfileRotation;
gp_Trsf RimProfileTranslation;
/* Initially add the first section wire - the original rim profile */
tShapeGen.AddWire( RimProfile );
/* Calculate translation step equal to tooth face width divided by required number of steps */
const double TranslationStep = ToothFaceWidth / nSteps;
/* Constant part of rotation angle calculation is referred as factor */
const double Factor = 2.0 * std::tan( HelixAngle ) / OutsideDiameter;
/* Calculate rotation angle and translation for each step */
for( int i = 1; i <= nSteps; i++ )
{
/* Setup rotation for current step */
RimProfileRotation.SetRotation( gp::OZ(), std::atan( i * TranslationStep * Factor ) );
/* Setup translation for current step */
RimProfileTranslation.SetTranslation( gp_Vec( 0.0, 0.0, ( i * TranslationStep ) ) );
/* Apply the transformations */
BRepBuilderAPI_Transform RotationTransformer( RimProfile, RimProfileRotation );
BRepBuilderAPI_Transform TranslationTransformer( RotationTransformer.Shape(), RimProfileTranslation );
/* Add generated wire of current step section */
tShapeGen.AddWire( TopoDS::Wire( TranslationTransformer.Shape() ) );
}
/* Generate the shape out of the section wires created previously */
return( tShapeGen.Shape() );
}
The implementation above is not runnable standalone but is tested in my app and prooved working. It might help to anyone looking for the principle how the helical gear shape can be constructed... See the result on the screenshot:
Hope this helps someone. Cheers Martin