From 57d6038b26740f00738001ae9dbc517de6bac9aa Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Mon, 23 Jun 2025 18:22:47 +0100 Subject: [PATCH] Shape Healing - Reusing Surface Analysis for Wire fixing (#565) Providing prepared analysis from ShapeFix_Face to wire. --- .../ShapeAnalysis/ShapeAnalysis_Wire.cxx | 16 ++++++++++++++++ .../ShapeAnalysis/ShapeAnalysis_Wire.hxx | 7 +++++++ .../TKShHealing/ShapeFix/ShapeFix_Face.cxx | 8 ++++---- .../TKShHealing/ShapeFix/ShapeFix_Wire.hxx | 8 ++++++++ .../TKShHealing/ShapeFix/ShapeFix_Wire.lxx | 15 +++++++++++++++ 5 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.cxx index 1bdd5c82c7..161794cad9 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.cxx @@ -156,6 +156,22 @@ void ShapeAnalysis_Wire::SetFace(const TopoDS_Face& face) //================================================================================================= +void ShapeAnalysis_Wire::SetFace(const TopoDS_Face& theFace, + const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis) +{ + myFace = theFace; + mySurf = theSurfaceAnalysis; +} + +//================================================================================================= + +void ShapeAnalysis_Wire::SetSurface(const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis) +{ + mySurf = theSurfaceAnalysis; +} + +//================================================================================================= + void ShapeAnalysis_Wire::SetSurface(const Handle(Geom_Surface)& surface) { SetSurface(surface, TopLoc_Location()); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.hxx b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.hxx index e1c4c5053b..deb0fd9505 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.hxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_Wire.hxx @@ -126,6 +126,13 @@ public: //! Loads the face the wire lies on Standard_EXPORT void SetFace(const TopoDS_Face& face); + //! Loads the face the wire lies on and surface analysis object + Standard_EXPORT void SetFace(const TopoDS_Face& theFace, + const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis); + + //! Loads the surface analysis object + Standard_EXPORT void SetSurface(const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis); + //! Loads the surface the wire lies on Standard_EXPORT void SetSurface(const Handle(Geom_Surface)& surface); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Face.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Face.cxx index 34b1f85aac..129e0b6cab 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Face.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Face.cxx @@ -346,7 +346,7 @@ Standard_Boolean ShapeFix_Face::Perform() Standard_Real aSavPreci = Precision(); if (NeedFix(myFixWireMode)) { - theAdvFixWire->SetFace(myFace); + theAdvFixWire->SetFace(myFace, mySurf); Standard_Integer usFixLackingMode = theAdvFixWire->FixLackingMode(); // Standard_Integer usFixNotchedEdgesMode = theAdvFixWire->FixNotchedEdgesMode(); // CR0024983 @@ -508,7 +508,7 @@ Standard_Boolean ShapeFix_Face::Perform() // perform second part of fixes on wires if (NeedFix(myFixWireMode)) { - theAdvFixWire->SetFace(myFace); + theAdvFixWire->SetFace(myFace, mySurf); Standard_Integer usFixSmallMode = theAdvFixWire->FixSmallMode(); Standard_Integer usFixConnectedMode = theAdvFixWire->FixConnectedMode(); @@ -1014,7 +1014,7 @@ Standard_Boolean ShapeFix_Face::FixAddNaturalBound() bnd->Add(sbwd, k + 1); ws.Remove(i--); nb--; - myFixWire->SetFace(myFace); + myFixWire->SetFace(myFace, mySurf); myFixWire->Load(bnd); myFixWire->FixConnected(); myFixWire->FixDegenerated(); @@ -1901,7 +1901,7 @@ Standard_Boolean ShapeFix_Face::FixMissingSeam() // sort original wires Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire; - sfw->SetFace(myFace); + sfw->SetFace(myFace, mySurf); sfw->SetPrecision(Precision()); Handle(ShapeExtend_WireData) wd1 = new ShapeExtend_WireData(w1); Handle(ShapeExtend_WireData) wd2 = new ShapeExtend_WireData(w2); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.hxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.hxx index 99564d4204..acb27d1bf3 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.hxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.hxx @@ -24,6 +24,8 @@ #include #include #include +#include + class ShapeFix_Edge; class ShapeAnalysis_Wire; class TopoDS_Wire; @@ -124,6 +126,12 @@ public: //! Set working face for the wire void SetFace(const TopoDS_Face& face); + //! Set working face for the wire and surface analysis object + void SetFace(const TopoDS_Face& theFace, const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis); + + //! Set surface analysis for the wire + void SetSurface(const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis); + //! Set surface for the wire void SetSurface(const Handle(Geom_Surface)& surf); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.lxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.lxx index 80ac341336..186f637879 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.lxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_Wire.lxx @@ -39,6 +39,21 @@ inline void ShapeFix_Wire::SetSurface(const Handle(Geom_Surface)& surf) myAnalyzer->SetSurface(surf); } +//================================================================================================= + +inline void ShapeFix_Wire::SetFace(const TopoDS_Face& theFace, + const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis) +{ + myAnalyzer->SetFace(theFace, theSurfaceAnalysis); +} + +//================================================================================================= + +inline void ShapeFix_Wire::SetSurface(const Handle(ShapeAnalysis_Surface)& theSurfaceAnalysis) +{ + myAnalyzer->SetSurface(theSurfaceAnalysis); +} + //======================================================================= // function : SetSurface // purpose : -- 2.39.5