1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-14 13:30:48 +03:00

Compare commits

..

3 Commits

Author SHA1 Message Date
nmanchen
f53c218335 Merge branch 'master' into CR32857_use_trim_surface 2022-12-02 05:38:49 +03:00
nmanchen
acaaf4f598 0032857: Error when finding the intersection between a new face made after a draft and the inner face of body
myGeom is now initialized by input surface for Draft_FaceInfo even if its type is Geom_RectangularTrimmedSurface.
input cylindric faces is not necessary to be trimmed (fixes bug712_1)
2022-11-24 07:14:11 +03:00
nmanchen
7b98ef4e57 0032857: Error when finding the intersection between a new face made after a draft and the inner face of body
myGeom is now initialized by input surface for Draft_FaceInfo even if its type is Geom_RectangularTrimmedSurface.
2022-11-14 08:45:25 +03:00
14 changed files with 124 additions and 162 deletions

View File

@@ -37,9 +37,7 @@ Draft_FaceInfo::Draft_FaceInfo (const Handle(Geom_Surface)& S,\
const Standard_Boolean HasNewGeometry):
myNewGeom(HasNewGeometry)
{
Handle(Geom_RectangularTrimmedSurface) T = Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
if (!T.IsNull()) myGeom = T->BasisSurface();
else myGeom = S;
myGeom = S;
}

View File

@@ -481,7 +481,7 @@ Standard_Boolean Draft_Modification::Propagate ()
Handle(Geom_Surface)::DownCast(S->Transformed(L.Transformation()));
const Handle(Standard_Type)& typs = S->DynamicType();
if (typs == STANDARD_TYPE(Geom_CylindricalSurface) ||
if (/*typs == STANDARD_TYPE(Geom_CylindricalSurface) ||*/
typs == STANDARD_TYPE(Geom_ConicalSurface)) {
Standard_Real umin,umax,vmin,vmax;
BRepTools::UVBounds(F,umin,umax,vmin,vmax);
@@ -1062,7 +1062,11 @@ void Draft_Modification::Perform ()
//Find the first curve to glue
TColGeom_SequenceOfCurve Candidates;
if (S1->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
S1->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_CylindricalSurface) ||
S1->DynamicType() == STANDARD_TYPE(Geom_RectangularTrimmedSurface) &&
Handle(Geom_RectangularTrimmedSurface)::DownCast(S1)->BasisSurface()->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
{
for (i = 1; i <= i2s.NbLines(); i++)
{

View File

@@ -90,9 +90,6 @@ public:
Standard_EXPORT void TolFixTangents (Standard_Real& aTolCheck, Standard_Real& aTolAngCheck);
//! Set angular tolerance
Standard_EXPORT void SetAngularTolerance (Standard_Real theAngularTolerance);
//! converts RLine to Geom(2d)_Curve.
Standard_EXPORT static void TreatRLine (const Handle(IntPatch_RLine)& theRL, const Handle(GeomAdaptor_Surface)& theHS1, const Handle(GeomAdaptor_Surface)& theHS2, Handle(Geom_Curve)& theC3d, Handle(Geom2d_Curve)& theC2d1, Handle(Geom2d_Curve)& theC2d2, Standard_Real& theTolReached);

View File

@@ -146,12 +146,3 @@ inline GeomInt_IntSS::GeomInt_IntSS ()
{
return myIntersector.Point(Index).Value();
}
//=======================================================================
//function : SetAngularTolerance
//purpose :
//=======================================================================
inline void GeomInt_IntSS::SetAngularTolerance (Standard_Real theAngularTolerance)
{
myIntersector.SetAngularTolerance(theAngularTolerance);
}

View File

@@ -254,53 +254,24 @@ gp_Ax2 DirToAx2(const gp_Pnt& P,const gp_Dir& D)
//purpose : Empty constructor
//=======================================================================
IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(void)
: done(Standard_False),
nbint(0),
typeres(IntAna_Empty),
pt1(0,0,0),
pt2(0,0,0),
pt3(0,0,0),
pt4(0,0,0),
param1(0),
param2(0),
param3(0),
param4(0),
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
: done(Standard_False),
nbint(0),
typeres(IntAna_Empty),
pt1(0,0,0),
pt2(0,0,0),
pt3(0,0,0),
pt4(0,0,0),
param1(0),
param2(0),
param3(0),
param4(0),
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0)
{
InitTolerances();
}
//=======================================================================
//function : IntAna_QuadQuadGeo
//purpose : Constructor with angular tolerance
//=======================================================================
IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(Standard_Real theAngularTolerance, Standard_Boolean theUseAngularTolerance)
: done(Standard_False),
nbint(0),
typeres(IntAna_Empty),
pt1(0,0,0),
pt2(0,0,0),
pt3(0,0,0),
pt4(0,0,0),
param1(0),
param2(0),
param3(0),
param4(0),
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(theAngularTolerance),
myUseAngularTolerance(theUseAngularTolerance)
{
InitTolerances();
}
//=======================================================================
//function : InitTolerances
//purpose :
@@ -308,20 +279,12 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(Standard_Real theAngularTolerance, Standa
void IntAna_QuadQuadGeo::InitTolerances()
{
myEPSILON_DISTANCE = 1.0e-14;
if (myUseAngularTolerance)
{
myEPSILON_ANGLE_CONE = myAngularTolerance;
}
else
{
myEPSILON_ANGLE_CONE = Precision::Angular();
}
myEPSILON_ANGLE_CONE = Precision::Angular();
myEPSILON_MINI_CIRCLE_RADIUS = 0.01*Precision::Confusion();
myEPSILON_CYLINDER_DELTA_RADIUS = 1.0e-13;
myEPSILON_CYLINDER_DELTA_DISTANCE= Precision::Confusion();
myEPSILON_AXES_PARA = Precision::Angular();
}
//=======================================================================
//function : IntAna_QuadQuadGeo
//purpose : Pln Pln
@@ -344,9 +307,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& P1,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(P1,P2,TolAng,Tol);
@@ -691,9 +652,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo( const gp_Pln& P
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(P,Co,Tolang,Tol);
@@ -909,9 +868,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& P,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(P,S);
@@ -980,9 +937,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl1,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Cyl1,Cyl2,Tol);
@@ -1267,9 +1222,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Cyl,Con,Tol);
@@ -1325,9 +1278,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Cyl,Sph,Tol);
@@ -1393,9 +1344,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Con1,Con2,Tol);
@@ -1851,9 +1800,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Sph,Con,Tol);
@@ -1965,9 +1912,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Sph1,Sph2,Tol);
@@ -2081,9 +2026,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Pln& Pln,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Pln,Tor,Tol);
@@ -2195,9 +2138,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cylinder& Cyl,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Cyl,Tor,Tol);
@@ -2280,9 +2221,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Cone& Con,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Con,Tor,Tol);
@@ -2420,9 +2359,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Sphere& Sph,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Sph,Tor,Tol);
@@ -2519,9 +2456,7 @@ IntAna_QuadQuadGeo::IntAna_QuadQuadGeo(const gp_Torus& Tor1,
param1bis(0),
param2bis(0),
myCommonGen(Standard_False),
myPChar(0,0,0),
myAngularTolerance(0.0),
myUseAngularTolerance(Standard_False)
myPChar(0,0,0)
{
InitTolerances();
Perform(Tor1,Tor2,Tol);
@@ -2757,7 +2692,6 @@ const gp_Pnt& IntAna_QuadQuadGeo::PChar() const
{
return myPChar;
}
//=======================================================================
//function : RefineDir
//purpose :

View File

@@ -61,9 +61,6 @@ public:
//! Empty constructor.
Standard_EXPORT IntAna_QuadQuadGeo();
//! Constructor with angular tolerance
Standard_EXPORT IntAna_QuadQuadGeo(Standard_Real theAngularTolerance, Standard_Boolean theUseAngularTolerance);
//! Creates the intersection between two planes.
//! TolAng is the angular tolerance used to determine
//! if the planes are parallel.
@@ -264,8 +261,7 @@ protected:
Standard_Real myEPSILON_AXES_PARA;
Standard_Boolean myCommonGen;
gp_Pnt myPChar;
Standard_Real myAngularTolerance;
Standard_Boolean myUseAngularTolerance;
private:

View File

@@ -108,8 +108,8 @@ public:
//! An exception is raised if Index<=0 or Index>NbLine.
const Handle(IntPatch_Line)& Line (const Standard_Integer Index) const;
//! Sets the angular tolerance
void SetAngularTolerance (Standard_Real theAngularTolerance);
protected:
@@ -128,8 +128,7 @@ private:
IntPatch_SequenceOfPoint spnt;
IntPatch_SequenceOfLine slin;
IntPatch_TheSOnBounds solrst;
Standard_Real myAngularTolerance;
Standard_Boolean myUseAngularTolerance;
};

View File

@@ -71,9 +71,3 @@ inline const Handle(IntPatch_Line)& IntPatch_ImpImpIntersection::Line (const Sta
if (!IsDone ()) { throw StdFail_NotDone(); }
return slin(Index);
}
inline void IntPatch_ImpImpIntersection::SetAngularTolerance (Standard_Real theAngularTolerance)
{
myAngularTolerance = theAngularTolerance;
myUseAngularTolerance = Standard_True;
}

View File

@@ -125,9 +125,7 @@ static Standard_Boolean IntCoCo(const IntSurf_Quadric&,
Standard_Boolean&,
Standard_Boolean&,
IntPatch_SequenceOfLine&,
IntPatch_SequenceOfPoint&,
Standard_Boolean theUseAngularTolerance = Standard_False,
Standard_Real theAngularTolerance = 0.0);
IntPatch_SequenceOfPoint&);
//torus
static Standard_Boolean IntPTo(const IntSurf_Quadric&,

View File

@@ -29,8 +29,7 @@ IntPatch_ImpImpIntersection::IntPatch_ImpImpIntersection ():
myDone(IntStatus_Fail),
empt(Standard_True),
tgte(Standard_False),
oppo(Standard_False),
myUseAngularTolerance(Standard_False)
oppo(Standard_False)
{
}
//=======================================================================
@@ -232,7 +231,7 @@ void IntPatch_ImpImpIntersection::Perform(const Handle(Adaptor3d_Surface)& S1,
}
//
case 33: { // Cone/Cone
if (!IntCoCo(quad1, quad2, TolTang, empt, SameSurf, multpoint, slin, spnt, myUseAngularTolerance, myAngularTolerance)) {
if (!IntCoCo(quad1, quad2, TolTang, empt, SameSurf, multpoint, slin, spnt)) {
return;
}
bEmpty = empt;

View File

@@ -27,9 +27,7 @@ Standard_Boolean IntCoCo(const IntSurf_Quadric& Quad1,
Standard_Boolean& Same,
Standard_Boolean& Multpoint,
IntPatch_SequenceOfLine& slin,
IntPatch_SequenceOfPoint& spnt,
Standard_Boolean theUseAngularTolerance,
Standard_Real theAngularTolerance)
IntPatch_SequenceOfPoint& spnt)
{
Standard_Integer i, NbSol;
@@ -40,8 +38,7 @@ Standard_Boolean IntCoCo(const IntSurf_Quadric& Quad1,
gp_Cone Co1(Quad1.Cone());
gp_Cone Co2(Quad2.Cone());
//
IntAna_QuadQuadGeo inter(theAngularTolerance, theUseAngularTolerance);
inter.Perform(Co1,Co2,Tol);
IntAna_QuadQuadGeo inter(Co1,Co2,Tol);
if (!inter.IsDone()) {
return Standard_False;
}

View File

@@ -53,8 +53,7 @@ IntPatch_Intersection::IntPatch_Intersection ()
myU1Start(0.0),
myV1Start(0.0),
myU2Start(0.0),
myV2Start(0.0),
myUseAngularTolerance(Standard_False)
myV2Start(0.0)
{
}
@@ -77,8 +76,7 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_Surface)& S
myU1Start(0.0),
myV1Start(0.0),
myU2Start(0.0),
myV2Start(0.0),
myUseAngularTolerance(Standard_False)
myV2Start(0.0)
{
if(myTolArc<1e-8) myTolArc=1e-8;
if(myTolTang<1e-8) myTolTang=1e-8;
@@ -104,8 +102,7 @@ IntPatch_Intersection::IntPatch_Intersection(const Handle(Adaptor3d_Surface)& S
myU1Start(0.0),
myV1Start(0.0),
myU2Start(0.0),
myV2Start(0.0),
myUseAngularTolerance(Standard_False)
myV2Start(0.0)
{
Perform(S1,D1,TolArc,TolTang);
}
@@ -132,12 +129,6 @@ void IntPatch_Intersection::SetTolerances(const Standard_Real TolArc,
if(myUVMaxStep>0.5) myUVMaxStep=0.5;
}
void IntPatch_Intersection::SetAngularTolerance (Standard_Real theAngularTolerance)
{
myAngularTolerance = theAngularTolerance;
myUseAngularTolerance = Standard_True;
}
//======================================================================
// function: Perform
//======================================================================
@@ -1363,13 +1354,8 @@ void IntPatch_Intersection::GeomGeomPerfom(const Handle(Adaptor3d_Surface)& theS
const GeomAbs_SurfaceType theTyps2,
const Standard_Boolean theIsReqToKeepRLine)
{
IntPatch_ImpImpIntersection interii;
if (myUseAngularTolerance)
{
interii.SetAngularTolerance(myAngularTolerance);
}
interii.Perform(theS1, theD1, theS2, theD2, myTolArc, myTolTang, theIsReqToKeepRLine);
IntPatch_ImpImpIntersection interii(theS1,theD1,theS2,theD2,
myTolArc,myTolTang, theIsReqToKeepRLine);
if (!interii.IsDone())
{

View File

@@ -62,8 +62,6 @@ public:
//! points in their respective parametric spaces.
Standard_EXPORT void SetTolerances (const Standard_Real TolArc, const Standard_Real TolTang, const Standard_Real UVMaxStep, const Standard_Real Fleche);
Standard_EXPORT void SetAngularTolerance (Standard_Real theAngularTolerance);
//! Flag theIsReqToKeepRLine has been entered only for
//! compatibility with TopOpeBRep package. It shall be deleted
//! after deleting TopOpeBRep.
@@ -199,8 +197,7 @@ private:
Standard_Real myV1Start;
Standard_Real myU2Start;
Standard_Real myV2Start;
Standard_Real myAngularTolerance;
Standard_Boolean myUseAngularTolerance;
};

View File

@@ -0,0 +1,72 @@
puts "================"
puts "0032857: Problem when finding the intersection between a new face made after a draft and the inner face of body"
puts "================"
puts ""
# Script reproducing the problematic draft case in FreeCAD issue #2497
#Category: Modeling
#Title: OCCT Tutorial pocketed ring
pload MODELING VISUALIZATION
# Set basic dimensions. Problems appear when inner_rad < pocket_center.
dset height 10
dset inner_rad 39
dset outer_rad 50
dset pocket_center 40
dset pocket_rad 20
dset pocket_depth 5
# Construct base profile (the "my_ring")
puts "Constructing my_ring..."
circle c_inner 0 0 0 0 0 1 inner_rad
circle c_outer 0 0 0 0 0 1 outer_rad
mkedge e_inner c_inner
mkedge e_outer c_outer
wire w_inner e_inner
wire w_outer e_outer
plane p0
mkface my_ring_inner_base p0 w_inner
mkface my_ring_outer_base p0 w_outer
prism my_ring_inner my_ring_inner_base 0 0 height
prism my_ring_outer my_ring_outer_base 0 0 height
bcut my_ring my_ring_outer my_ring_inner
# Make the pocket
puts "Constructing pocket..."
circle pocket_base pocket_center 0 0 0 0 1 pocket_rad
mkedge pocket_base pocket_base
wire pocket_base pocket_base
mkface pocket_base p0 pocket_base
prism my_pocket pocket_base 0 0 pocket_depth
# Make the cut
puts "Making the cut"
bcut slotted_ring my_ring my_pocket
explode slotted_ring F
# Make the draft
puts "Drafting the face"
# Found face by trial and error: slotted_ring_3
# Perform the draft
depouille slotted_ring_with_draft slotted_ring 0 0 -1 slotted_ring_3 44 0 1 0 0 0 1
#checking result
checkshape slotted_ring_with_draft
checknbshapes slotted_ring_with_draft -shape 48 -vertex 12 -edge 18 -face 7 -wire 8
checkprops slotted_ring_with_draft -s 11466.5 -v 28662.9
puts "Showing result..."
# Display result
checkview -display slotted_ring_with_draft -2d -path ${imagedir}/${test_image}.png