mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0028828: Modeling Algorithms - New functionalities of BRepFilletAPI_MakeChamfer algorithm
Two new functionalities have been added in BRepFilletAPI_MakeChamfer: - constant throat (the section of chamfer is isosceles triangle, its height is constant in all sections - this is the "throat" of the weld); - constant throat with penetration(the section of chamfer is right-angled triangle, the first of two surfaces (where is the top of the chamfer) is virtually moved inside the solid by offset operation, the apex of the section is on the intersection curve between moved surface and second surface, right angle is at the top of the chamfer, the length of the leg from apex to top is constant - this is the "throat" of the weld). - New abstract classes BlendFunc_GenChamfer and BlendFunc_GenChamfInv have been added; - Class BlendFunc_Chamfer is now descended from BlendFunc_GenChamfer, class BlendFunc_ChamfInv is now descended from BlendFunc_GenChamfInv. - New class BlendFunc_ConstThroat is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatInv is descended from BlendFunc_GenChamfInv. - New class BlendFunc_ConstThroatWithPenetration is descended from BlendFunc_GenChamfer, new class BlendFund_ConstThroatWithPenetrationInv is descended from BlendFunc_GenChamfInv. - Class ChFi3d_ChBuilder has now mode of chamfer that can be ClassicChamfer, ConstThroatChamfer and ConstThroatWithPenetrationChamfer. - Two new DRAW Test Harness commands "chamf_throat" ant "chamf_throat_with_penetration" have been added for the second mode of ChBuilder. - The interface of DRAW Test Harness command "chamf" changed for symmetric case.
This commit is contained in:
@@ -168,46 +168,57 @@
|
||||
}
|
||||
}
|
||||
else if(!CSpine.IsNull()){
|
||||
|
||||
ChFiDS_ChamfMode aMode = CSpine->Mode();
|
||||
|
||||
if (CSpine->IsChamfer() == ChFiDS_Sym) {
|
||||
Standard_Real dis;
|
||||
CSpine->GetDist(dis);
|
||||
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis, dis,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis, dis,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis ,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis,CSpine->Line(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Line(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis,dis,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
@@ -220,44 +231,51 @@
|
||||
Standard_Real dis1,dis2;
|
||||
CSpine->Dists(dis1,dis2);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Plane(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Line(),
|
||||
Wref,OrFace1);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cylinder ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cylinder(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Line(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cylinder && typ2 == GeomAbs_Plane ){
|
||||
if (ctyp == GeomAbs_Circle)
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
else
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cylinder(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cylinder(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Line(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Cone ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S1->Plane(),S2->Cone(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S1->Plane(),S2->Cone(),
|
||||
S2->FirstUParameter(),S2->LastUParameter(),
|
||||
Or1,Or2,dis1,dis2,CSpine->Circle(),
|
||||
Wref,OrFace1,Standard_True);
|
||||
}
|
||||
else if ( typ1 == GeomAbs_Cone && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,S2->Plane(),S1->Cone(),
|
||||
surfok = ChFiKPart_MakeChamfer(DStr,Data,aMode,
|
||||
S2->Plane(),S1->Cone(),
|
||||
S1->FirstUParameter(),S1->LastUParameter(),
|
||||
Or2,Or1,dis2,dis1,CSpine->Circle(),
|
||||
Or2,Or1,dis1,dis2,CSpine->Circle(),
|
||||
Wref,OrFace2,Standard_False);
|
||||
}
|
||||
else{
|
||||
@@ -266,8 +284,8 @@
|
||||
}
|
||||
else {
|
||||
Standard_Real dis, Angle;
|
||||
Standard_Boolean DisOnP;
|
||||
CSpine->GetDistAngle(dis, Angle, DisOnP);
|
||||
Standard_Boolean DisOnP = Standard_True;
|
||||
CSpine->GetDistAngle(dis, Angle);
|
||||
if ( typ1 == GeomAbs_Plane && typ2 == GeomAbs_Plane ){
|
||||
surfok = ChFiKPart_MakeChAsym(DStr,Data,S1->Plane(),S2->Plane(),
|
||||
Or1,Or2, dis, Angle, CSpine->Line(),
|
||||
|
@@ -58,14 +58,15 @@
|
||||
//=======================================================================
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const Standard_Real theDis1,
|
||||
const Standard_Real theDis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
@@ -73,6 +74,26 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
{
|
||||
|
||||
Standard_Real angcon = Con.SemiAngle();
|
||||
|
||||
Standard_Real Dis1 = theDis1, Dis2 = theDis2;
|
||||
Standard_Real Alpha = M_PI/2 - angcon;
|
||||
Standard_Real CosHalfAlpha = Cos(Alpha/2);
|
||||
if (theMode == ChFiDS_ConstThroatChamfer)
|
||||
Dis1 = Dis2 = theDis1 / CosHalfAlpha;
|
||||
else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
|
||||
{
|
||||
Standard_Real aDis1 = Min(theDis1, theDis2);
|
||||
Standard_Real aDis2 = Max(theDis1, theDis2);
|
||||
Standard_Real dis1dis1 = aDis1*aDis1, dis2dis2 = aDis2*aDis2;
|
||||
Standard_Real SinAlpha = Sin(Alpha);
|
||||
Standard_Real CosAlpha = Cos(Alpha);
|
||||
Standard_Real CotanAlpha = CosAlpha/SinAlpha;
|
||||
Dis1 = sqrt(dis2dis2 - dis1dis1) - aDis1*CotanAlpha;
|
||||
Standard_Real CosBeta = sqrt(1-dis1dis1/dis2dis2)*CosAlpha + aDis1/aDis2*SinAlpha;
|
||||
Standard_Real FullDist1 = aDis2/CosBeta;
|
||||
Dis2 = FullDist1 - aDis1/SinAlpha;
|
||||
}
|
||||
|
||||
Standard_Real sincon =Abs(Sin(angcon));
|
||||
Standard_Real angle;
|
||||
Standard_Boolean IsResol;
|
||||
|
@@ -19,6 +19,7 @@
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cone& Con,
|
||||
const Standard_Real fu,
|
||||
|
@@ -63,15 +63,16 @@
|
||||
// False else
|
||||
//=======================================================================
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
const Standard_Real lu,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const Standard_Real theDis1,
|
||||
const Standard_Real theDis2,
|
||||
const gp_Circ& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Ofpl,
|
||||
@@ -80,6 +81,17 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
|
||||
// compute the chamfer surface(cone)
|
||||
|
||||
Standard_Real Dis1 = theDis1, Dis2 = theDis2;
|
||||
if (theMode == ChFiDS_ConstThroatChamfer)
|
||||
Dis1 = Dis2 = theDis1 * sqrt(2.);
|
||||
else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
|
||||
{
|
||||
Standard_Real aDis2 = Min(theDis1, theDis2);
|
||||
Standard_Real aDis1 = Max(theDis1, theDis2);
|
||||
Dis2 = sqrt(aDis1*aDis1 - aDis2*aDis2);
|
||||
Dis1 = aDis1*aDis1/aDis2 - aDis2;
|
||||
}
|
||||
|
||||
// compute the normals to the plane surface & to the plane face
|
||||
gp_Ax3 PosPl = Pln.Position();
|
||||
gp_Dir Dpl = PosPl.XDirection().Crossed(PosPl.YDirection());
|
||||
@@ -310,7 +322,8 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real /*fu*/,
|
||||
@@ -330,6 +343,9 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
// _|_ Ofpl is orientation of the plane face allowing
|
||||
// |4 to determine the side of the material
|
||||
|
||||
if (theMode != ChFiDS_ClassicChamfer)
|
||||
return Standard_False;
|
||||
|
||||
gp_Pnt OrSpine = ElCLib::Value(First,Spine);
|
||||
gp_Pnt POnCyl, POnPln, OrCyl;
|
||||
|
||||
|
@@ -18,7 +18,8 @@
|
||||
#define _ChFiKPart_ComputeData_ChPlnCyl_HeaderFile
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
@@ -39,6 +40,7 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pln,
|
||||
const gp_Cylinder& Cyl,
|
||||
const Standard_Real fu,
|
||||
|
@@ -53,12 +53,13 @@
|
||||
//=======================================================================
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
const TopAbs_Orientation Or2,
|
||||
const Standard_Real Dis1,
|
||||
const Standard_Real Dis2,
|
||||
const Standard_Real theDis1,
|
||||
const Standard_Real theDis2,
|
||||
const gp_Lin& Spine,
|
||||
const Standard_Real First,
|
||||
const TopAbs_Orientation Of1)
|
||||
@@ -95,6 +96,24 @@ Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
if ( VecTransl2.Dot(D1) <=0. )
|
||||
VecTransl2.Reverse();
|
||||
|
||||
Standard_Real Dis1 = theDis1, Dis2 = theDis2;
|
||||
Standard_Real Alpha = VecTransl1.Angle(VecTransl2);
|
||||
Standard_Real CosHalfAlpha = Cos(Alpha/2);
|
||||
if (theMode == ChFiDS_ConstThroatChamfer)
|
||||
Dis1 = Dis2 = theDis1 / CosHalfAlpha;
|
||||
else if (theMode == ChFiDS_ConstThroatWithPenetrationChamfer)
|
||||
{
|
||||
Standard_Real aDis1 = Min(theDis1, theDis2);
|
||||
Standard_Real aDis2 = Max(theDis1, theDis2);
|
||||
Standard_Real dis1dis1 = aDis1*aDis1, dis2dis2 = aDis2*aDis2;
|
||||
Standard_Real SinAlpha = Sin(Alpha);
|
||||
Standard_Real CosAlpha = Cos(Alpha);
|
||||
Standard_Real CotanAlpha = CosAlpha/SinAlpha;
|
||||
Dis1 = sqrt(dis2dis2 - dis1dis1) - aDis1*CotanAlpha;
|
||||
Standard_Real CosBeta = sqrt(1-dis1dis1/dis2dis2)*CosAlpha + aDis1/aDis2*SinAlpha;
|
||||
Standard_Real FullDist1 = aDis2/CosBeta;
|
||||
Dis2 = FullDist1 - aDis1/SinAlpha;
|
||||
}
|
||||
|
||||
// Compute a point on the plane Pl1 and on the chamfer
|
||||
gp_Pnt P1( P.X()+Dis1*VecTransl1.X(),
|
||||
|
@@ -20,6 +20,7 @@
|
||||
|
||||
Standard_Boolean ChFiKPart_MakeChamfer(TopOpeBRepDS_DataStructure& DStr,
|
||||
const Handle(ChFiDS_SurfData)& Data,
|
||||
const ChFiDS_ChamfMode theMode,
|
||||
const gp_Pln& Pl1,
|
||||
const gp_Pln& Pl2,
|
||||
const TopAbs_Orientation Or1,
|
||||
|
Reference in New Issue
Block a user