不幸的是,在我自己找到解决方案之前,没有人回复。这是因为它可能会帮助其他人有一天面临同样的问题......
算法说明:
轮辋宽度分为几个步骤(nSteps
)。对于每个步骤,使用以下公式计算所需的旋转角度和平移:
rotation_angle = atan( b_TranslationStep * CONST_FACTOR )
其中
b_TranslationStep
是与计算的步长相对应的轮辋宽度,
CONST_FACTOR = 2 * tan( beta ) / d_a
其中
beta
是斜齿轮螺旋角
d_a
是外圆直径使用应用于轮辋轮廓的旋转和平移变换,创建定义轮辋形状的截面线。完成后,截面线用于BRepOffsetAPI_ThruSections
生成斜齿轮原始轮辋形状。
齿轮轮廓面在 XY 平面中构造,而齿轮的轴与 Z 轴对齐。GearProfile 是先前构建的,是“包含”所有齿的闭合线。
执行:
/* 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() );
}
上面的实现不能独立运行,但在我的应用程序中进行了测试并证明可以正常工作。它可能对任何寻找如何构造螺旋齿轮形状的原理的人有所帮助......请参阅屏幕截图上的结果:
希望这可以帮助某人。干杯马丁