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
5 changed files with 83 additions and 51 deletions

View File

@@ -468,14 +468,7 @@ static void PERFORM_C0(const TopoDS_Edge& S1, const TopoDS_Edge& S2,
if (fabs(Dstmin - sqrt(Ext.SquareDistance(ii))) < Eps) if (fabs(Dstmin - sqrt(Ext.SquareDistance(ii))) < Eps)
{ {
Pt = Ext.Point(ii); Pt = Ext.Point(ii);
// Pt - point on the curve pCurvOther/Eother, but if (TRI_SOLUTION(SeqSol2, Pt))
// if iE == 0 -> Eother correspond to edge S2
// and to edge S1 in the opposite case.
// Therefore we should search Pt through previous solution points on Other curve (edge):
// if iE == 0 - on edge S2, namely through SeqSol2,
// else - on edge S1, namely through SeqSol1.
const bool triSolutionResult = (iE == 0) ? TRI_SOLUTION(SeqSol2, Pt) : TRI_SOLUTION(SeqSol1, Pt);
if (triSolutionResult)
{ {
// Check if the parameter does not correspond to a vertex // Check if the parameter does not correspond to a vertex
const Standard_Real t = Ext.Parameter(ii); const Standard_Real t = Ext.Parameter(ii);
@@ -876,21 +869,11 @@ void BRepExtrema_DistanceSS::Perform (const TopoDS_Edge& theS1,
if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty()) if (!seqSol1.IsEmpty() && !seqSol2.IsEmpty())
{ {
BRepExtrema_SeqOfSolution::iterator anIt1 = seqSol1.begin(); theSeqSolShape1.Append(seqSol1);
BRepExtrema_SeqOfSolution::iterator anIt2 = seqSol2.begin(); theSeqSolShape2.Append(seqSol2);
for (; anIt1 != seqSol1.end() && anIt2 != seqSol2.end(); anIt1++, anIt2++)
{
gp_Pnt Pt1 = anIt1->Point();
gp_Pnt Pt2 = anIt2->Point();
if (TRI_SOLUTION(theSeqSolShape1, Pt1) || TRI_SOLUTION(theSeqSolShape2, Pt2))
{
theSeqSolShape1.Append(*anIt1);
theSeqSolShape2.Append(*anIt2);
myModif = Standard_True; myModif = Standard_True;
} }
} }
}
}
//======================================================================= //=======================================================================
//function : Perform //function : Perform

View File

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

View File

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

View File

@@ -1,25 +0,0 @@
puts "========"
puts "OCC32934"
puts "========"
puts ""
###############################################################################################
# BRepExtrema_DistShapeShape BRepExtrema_DistShapeShape returns two solutions instead of one.
###############################################################################################
pload ALL
restore [locate_data_file bug32934.brep] edges
explode edges E
distmini di edges_1 edges_2
if { ([isdraw di2]) } {
puts "Error : result of distmini is wrong"
} else {
checknbshapes di -vertex 1 -edge 0
}
distmini dii edges_2 edges_1
if { ([isdraw dii2]) } {
puts "Error : result of distmini is wrong"
} else {
checknbshapes dii -vertex 1 -edge 0
}

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