mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0026305: BRepFeat_MakePrism returns inconsistent results && 026315: BRepFeat_MakeRevol fails to create revol from shape
This commit is contained in:
parent
b3b55601fb
commit
0dec1a483d
@ -54,6 +54,7 @@
|
||||
#include <LocOpe_CSIntersector.hxx>
|
||||
#include <LocOpe_PntFace.hxx>
|
||||
#include <LocOpe_BuildShape.hxx>
|
||||
#include <ElSLib.hxx>
|
||||
|
||||
#include <TColGeom_SequenceOfCurve.hxx>
|
||||
|
||||
@ -490,14 +491,9 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
|
||||
{
|
||||
Bnd_Box B;
|
||||
BRepBndLib::Add(Sbase,B);
|
||||
Standard_Real c[6], bnd;
|
||||
B.Get(c[0],c[2],c[4],c[1],c[3],c[5]);
|
||||
bnd = c[0];
|
||||
for(Standard_Integer i = 1 ; i < 6; i++) {
|
||||
if(c[i] > bnd) bnd = c[i];
|
||||
}
|
||||
bnd = 10*bnd;
|
||||
|
||||
Standard_Real x[2], y[2], z[2];
|
||||
B.Get(x[0],y[0],z[0],x[1],y[1],z[1]);
|
||||
Standard_Real diam = 10.*Sqrt(B.SquareExtent());
|
||||
|
||||
Handle(Geom_Surface) s = BRep_Tool::Surface(FUntil);
|
||||
Handle(Standard_Type) styp = s->DynamicType();
|
||||
@ -507,16 +503,80 @@ void BRepFeat::FaceUntil(const TopoDS_Shape& Sbase,
|
||||
}
|
||||
Handle(Geom_RectangularTrimmedSurface) str;
|
||||
if (styp == STANDARD_TYPE(Geom_Plane)) {
|
||||
gp_Pln aPln = Handle(Geom_Plane)::DownCast(s)->Pln();
|
||||
Standard_Real u, v, umin = RealLast(), umax = -umin,
|
||||
vmin = RealLast(), vmax = -vmin;
|
||||
for(Standard_Integer i = 0 ; i < 2; i++)
|
||||
{
|
||||
for(Standard_Integer j = 0; j < 2; j++)
|
||||
{
|
||||
for(Standard_Integer k = 0; k < 2; k++)
|
||||
{
|
||||
gp_Pnt aP(x[i], y[j], z[k]);
|
||||
ElSLib::Parameters(aPln, aP, u, v);
|
||||
if(u < umin)
|
||||
umin = u;
|
||||
if(u > umax)
|
||||
umax = u;
|
||||
if(v < vmin)
|
||||
vmin = v;
|
||||
if(v > vmax)
|
||||
vmax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
umin -= diam;
|
||||
umax += diam;
|
||||
vmin -= diam;
|
||||
vmax += diam;
|
||||
str = new Geom_RectangularTrimmedSurface
|
||||
(s, bnd, -bnd, bnd, -bnd, Standard_True, Standard_True);
|
||||
(s, umin, umax, vmin, vmax, Standard_True, Standard_True);
|
||||
}
|
||||
else if (styp == STANDARD_TYPE(Geom_CylindricalSurface)) {
|
||||
gp_Cylinder aCyl = Handle(Geom_CylindricalSurface)::DownCast(s)->Cylinder();
|
||||
Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
|
||||
for(Standard_Integer i = 0 ; i < 2; i++)
|
||||
{
|
||||
for(Standard_Integer j = 0; j < 2; j++)
|
||||
{
|
||||
for(Standard_Integer k = 0; k < 2; k++)
|
||||
{
|
||||
gp_Pnt aP(x[i], y[j], z[k]);
|
||||
ElSLib::Parameters(aCyl, aP, u, v);
|
||||
if(v < vmin)
|
||||
vmin = v;
|
||||
if(v > vmax)
|
||||
vmax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
vmin -= diam;
|
||||
vmax += diam;
|
||||
str = new Geom_RectangularTrimmedSurface
|
||||
(s, bnd, -bnd, Standard_False, Standard_True);
|
||||
(s, vmin, vmax, Standard_False, Standard_True);
|
||||
}
|
||||
else if (styp == STANDARD_TYPE(Geom_ConicalSurface)) {
|
||||
gp_Cone aCon = Handle(Geom_ConicalSurface)::DownCast(s)->Cone();
|
||||
Standard_Real u, v, vmin = RealLast(), vmax = -vmin;
|
||||
for(Standard_Integer i = 0 ; i < 2; i++)
|
||||
{
|
||||
for(Standard_Integer j = 0; j < 2; j++)
|
||||
{
|
||||
for(Standard_Integer k = 0; k < 2; k++)
|
||||
{
|
||||
gp_Pnt aP(x[i], y[j], z[k]);
|
||||
ElSLib::Parameters(aCon, aP, u, v);
|
||||
if(v < vmin)
|
||||
vmin = v;
|
||||
if(v > vmax)
|
||||
vmax = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
vmin -= diam;
|
||||
vmax += diam;
|
||||
str = new Geom_RectangularTrimmedSurface
|
||||
(s, bnd, -bnd, Standard_False, Standard_True);
|
||||
(s, vmin, vmax, Standard_False, Standard_True);
|
||||
}
|
||||
else {
|
||||
FUntil.Nullify();
|
||||
|
@ -570,6 +570,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
|
||||
ASI2.Perform(scur);
|
||||
TopAbs_Orientation OrU, OrF;
|
||||
TopoDS_Face FFrom, FUntil;
|
||||
Standard_Real ParF, ParU;
|
||||
if (ASI1.IsDone() && ASI1.NbPoints(1) >=1) {
|
||||
if (myFuse == 1) {
|
||||
OrU = ASI1.Point(1,1).Orientation();
|
||||
@ -579,6 +580,7 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
|
||||
}
|
||||
if(sens==-1) OrU = TopAbs::Reverse(OrU);
|
||||
FUntil = ASI1.Point(1,1).Face();
|
||||
ParU = ASI1.Point(1,1).Parameter();
|
||||
}
|
||||
else {
|
||||
NotDone();
|
||||
@ -589,12 +591,20 @@ void BRepFeat_MakePrism::Perform(const TopoDS_Shape& From,
|
||||
OrF = ASI2.Point(1,1).Orientation();
|
||||
if(sens==1) OrF = TopAbs::Reverse(OrF);
|
||||
FFrom = ASI2.Point(1,1).Face();
|
||||
ParF = ASI2.Point(1,1).Parameter();
|
||||
}
|
||||
else {
|
||||
NotDone();
|
||||
myStatusError = BRepFeat_NoIntersectF;
|
||||
return;
|
||||
}
|
||||
if(tran > 0 && (Abs(ParU) < Abs(ParF)))
|
||||
{
|
||||
TopAbs_Orientation Or;
|
||||
Or = OrU;
|
||||
OrU = OrF;
|
||||
OrF = Or;
|
||||
}
|
||||
TopoDS_Shape Comp;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound(TopoDS::Compound(Comp));
|
||||
|
@ -604,7 +604,8 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
|
||||
pr1 = ElCLib::InPeriod(pr1,PrU-2*M_PI,PrU);
|
||||
Standard_Real pr2 = ASI2.Point(1,ASI2.NbPoints(1)).Parameter();
|
||||
pr2 = ElCLib::InPeriod(pr2,PrU-2*M_PI,PrU);
|
||||
OrF = OrU;
|
||||
//OrF = OrU;
|
||||
OrF = TopAbs::Reverse(OrU);
|
||||
FFrom = ASI2.Point(1,1).Face();
|
||||
PrF = Max(pr1, pr2);
|
||||
}
|
||||
@ -642,7 +643,7 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(myFuse == 1) {
|
||||
if(myFuse == 1 && !myJustFeat) {
|
||||
//modified by NIZNHY-PKV Thu Mar 21 18:19:14 2002 f
|
||||
//BRepAlgo_Fuse f(mySbase, VraiRevol);
|
||||
//myShape = f.Shape();
|
||||
@ -653,7 +654,7 @@ void BRepFeat_MakeRevol::Perform(const TopoDS_Shape& From,
|
||||
//modified by NIZNHY-PKV Thu Mar 21 18:19:18 2002 t
|
||||
Done();
|
||||
}
|
||||
else if(myFuse == 0) {
|
||||
else if(myFuse == 0 && !myJustFeat) {
|
||||
//modified by NIZNHY-PKV Thu Mar 21 18:19:46 2002 f
|
||||
//BRepAlgo_Cut c(mySbase, VraiRevol);
|
||||
//myShape = c.Shape();
|
||||
|
Loading…
x
Reference in New Issue
Block a user