mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-03-15 20:51:27 +05:00
Check and improve shapes with seam and/or degenerated edges. Done by SKL.
This commit is contained in:
parent
e8052b1b1e
commit
267d9aad80
50
src/GEOMAlgo/BlockFix.cdl
Normal file
50
src/GEOMAlgo/BlockFix.cdl
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
-- File: BlockFix.cdl
|
||||||
|
-- Created: Tue Dec 7 11:59:05 2004
|
||||||
|
-- Author: Pavel Durandin
|
||||||
|
-- <det@doomox>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package BlockFix
|
||||||
|
|
||||||
|
uses
|
||||||
|
|
||||||
|
TColStd,
|
||||||
|
gp,
|
||||||
|
Geom,
|
||||||
|
Geom2d,
|
||||||
|
GeomAbs,
|
||||||
|
TopLoc,
|
||||||
|
TopoDS,
|
||||||
|
BRepTools,
|
||||||
|
TopTools,
|
||||||
|
ShapeBuild
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
class SphereSpaceModifier;
|
||||||
|
|
||||||
|
class UnionFaces;
|
||||||
|
|
||||||
|
class UnionEdges;
|
||||||
|
|
||||||
|
class BlockFixAPI;
|
||||||
|
---Purpose: API class to perform the fixing of the
|
||||||
|
-- block
|
||||||
|
|
||||||
|
class PeriodicSurfaceModifier;
|
||||||
|
|
||||||
|
class CheckTool;
|
||||||
|
|
||||||
|
RotateSphereSpace (S: Shape from TopoDS; Tol: Real)
|
||||||
|
returns Shape from TopoDS;
|
||||||
|
|
||||||
|
FixRanges (S: Shape from TopoDS; Tol: Real)
|
||||||
|
returns Shape from TopoDS;
|
||||||
|
---Purpose: checking and fixing cases where parametric
|
||||||
|
-- boundaries of face based on periodic surface are not
|
||||||
|
-- contained in the range of this surface.
|
||||||
|
|
||||||
|
end BlockFix;
|
195
src/GEOMAlgo/BlockFix.cxx
Normal file
195
src/GEOMAlgo/BlockFix.cxx
Normal file
@ -0,0 +1,195 @@
|
|||||||
|
// File: BlockFix.cxx
|
||||||
|
// Created: Tue Dec 7 11:59:05 2004
|
||||||
|
// Author: Pavel DURANDIN
|
||||||
|
// Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
|
||||||
|
#include <BlockFix.hxx>
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||||
|
#include <ShapeCustom.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <ShapeBuild_ReShape.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
#include <Geom_CylindricalSurface.hxx>
|
||||||
|
#include <Geom_ConicalSurface.hxx>
|
||||||
|
#include <ShapeFix_Wire.hxx>
|
||||||
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <BRepTools_Modifier.hxx>
|
||||||
|
#include <Geom_SphericalSurface.hxx>
|
||||||
|
#include <Geom_ToroidalSurface.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <Geom2d_Curve.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <ShapeAnalysis_Edge.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
#include <ShapeFix.hxx>
|
||||||
|
#include <ShapeFix_Face.hxx>
|
||||||
|
#include <ShapeAnalysis.hxx>
|
||||||
|
|
||||||
|
#include <TColgp_SequenceOfPnt2d.hxx>
|
||||||
|
#include <ShapeAnalysis_Curve.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <ShapeBuild_Edge.hxx>
|
||||||
|
|
||||||
|
#include <BlockFix_SphereSpaceModifier.hxx>
|
||||||
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <BlockFix_PeriodicSurfaceModifier.hxx>
|
||||||
|
|
||||||
|
#include <TopoDS_Solid.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FixResult
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
static void FixResult(const TopoDS_Shape& result,
|
||||||
|
Handle(ShapeBuild_ReShape)& Context,
|
||||||
|
const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
for (TopExp_Explorer ex_f(result,TopAbs_FACE); ex_f.More(); ex_f.Next()) {
|
||||||
|
TopoDS_Shape aShape = Context->Apply(ex_f.Current().Oriented(TopAbs_FORWARD));
|
||||||
|
// face coud not be dropped or splitted on this step
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(aShape);
|
||||||
|
TopLoc_Location L;
|
||||||
|
Handle(Geom_Surface) Surf = BRep_Tool::Surface(aFace,L);
|
||||||
|
|
||||||
|
if(Surf->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||||
|
|
||||||
|
Standard_Integer nbWires = 0;
|
||||||
|
for (TopExp_Explorer ex_w(aFace,TopAbs_WIRE); ex_w.More(); ex_w.Next()) {
|
||||||
|
nbWires++;
|
||||||
|
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(ex_w.Current()),
|
||||||
|
aFace,
|
||||||
|
Precision::Confusion());
|
||||||
|
sfw->FixReorder();
|
||||||
|
if(sfw->StatusReorder ( ShapeExtend_FAIL ))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sfw->SetPrecision(2.*Tol);
|
||||||
|
sfw->FixShifted();
|
||||||
|
|
||||||
|
Standard_Boolean isDone = sfw->LastFixStatus ( ShapeExtend_DONE );
|
||||||
|
isDone |= sfw->FixDegenerated();
|
||||||
|
|
||||||
|
// remove degenerated edges from not degenerated points
|
||||||
|
ShapeAnalysis_Edge sae;
|
||||||
|
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
|
||||||
|
Standard_Integer i;
|
||||||
|
for( i = 1; i<=sewd->NbEdges();i++) {
|
||||||
|
TopoDS_Edge E = sewd->Edge(i);
|
||||||
|
if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aFace)) {
|
||||||
|
sewd->Remove(i);
|
||||||
|
isDone = Standard_True;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isDone |= sfw->FixLacking();
|
||||||
|
|
||||||
|
// remove neighbour seam edges
|
||||||
|
if(isDone) {
|
||||||
|
for( i = 1; i<sewd->NbEdges();i++) {
|
||||||
|
if(sewd->IsSeam(i) && sewd->IsSeam(i+1)) {
|
||||||
|
isDone = Standard_True;
|
||||||
|
sewd->Remove(i);
|
||||||
|
sewd->Remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(sewd->IsSeam(1) && sewd->IsSeam(sewd->NbEdges())) {
|
||||||
|
sewd->Remove(1);
|
||||||
|
sewd->Remove(sewd->NbEdges());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(isDone) {
|
||||||
|
TopoDS_Wire ResWire = sfw->Wire();
|
||||||
|
Context->Replace(ex_w.Current(), ResWire);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// Implement fix orientation in case of several wires
|
||||||
|
if(nbWires > 1) {
|
||||||
|
TopoDS_Face aFixedFace = TopoDS::Face(Context->Apply(aFace));
|
||||||
|
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFixedFace);
|
||||||
|
if(sff->FixOrientation())
|
||||||
|
Context->Replace(aFixedFace,sff->Face());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ConvertToAnalytical
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape BlockFix::RotateSphereSpace (const TopoDS_Shape& S,
|
||||||
|
const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Create a modification description
|
||||||
|
Handle(BlockFix_SphereSpaceModifier) SR = new BlockFix_SphereSpaceModifier;
|
||||||
|
SR->SetTolerance(Tol);
|
||||||
|
|
||||||
|
TopTools_DataMapOfShapeShape context;
|
||||||
|
BRepTools_Modifier MD;
|
||||||
|
TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
|
||||||
|
|
||||||
|
Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
|
||||||
|
FixResult(result,RS,Tol);
|
||||||
|
result = RS->Apply(result);
|
||||||
|
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Edge E = TopoDS::Edge(exp.Current());
|
||||||
|
sfe.FixVertexTolerance (E);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapeFix::SameParameter(result,Standard_False);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : FixRanges
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape BlockFix::FixRanges (const TopoDS_Shape& S,
|
||||||
|
const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
// Create a modification description
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier) SR = new BlockFix_PeriodicSurfaceModifier;
|
||||||
|
SR->SetTolerance(Tol);
|
||||||
|
|
||||||
|
TopTools_DataMapOfShapeShape context;
|
||||||
|
BRepTools_Modifier MD;
|
||||||
|
TopoDS_Shape result = ShapeCustom::ApplyModifier ( S, SR, context,MD );
|
||||||
|
|
||||||
|
Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
|
||||||
|
FixResult(result,RS,Tol);
|
||||||
|
result = RS->Apply(result);
|
||||||
|
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
for(TopExp_Explorer exp(result,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Edge E = TopoDS::Edge(exp.Current());
|
||||||
|
sfe.FixVertexTolerance (E);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShapeFix::SameParameter(result,Standard_False);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
105
src/GEOMAlgo/BlockFix.hxx
Normal file
105
src/GEOMAlgo/BlockFix.hxx
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_HeaderFile
|
||||||
|
#define _BlockFix_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
class TopoDS_Shape;
|
||||||
|
class BlockFix_SphereSpaceModifier;
|
||||||
|
class BlockFix_UnionFaces;
|
||||||
|
class BlockFix_UnionEdges;
|
||||||
|
class BlockFix_BlockFixAPI;
|
||||||
|
class BlockFix_PeriodicSurfaceModifier;
|
||||||
|
class BlockFix_CheckTool;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class BlockFix {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT static TopoDS_Shape RotateSphereSpace(const TopoDS_Shape& S,const Standard_Real Tol) ;
|
||||||
|
Standard_EXPORT static TopoDS_Shape FixRanges(const TopoDS_Shape& S,const Standard_Real Tol) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
friend class BlockFix_SphereSpaceModifier;
|
||||||
|
friend class BlockFix_UnionFaces;
|
||||||
|
friend class BlockFix_UnionEdges;
|
||||||
|
friend class BlockFix_BlockFixAPI;
|
||||||
|
friend class BlockFix_PeriodicSurfaceModifier;
|
||||||
|
friend class BlockFix_CheckTool;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
26
src/GEOMAlgo/BlockFix.ixx
Normal file
26
src/GEOMAlgo/BlockFix.ixx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix.jxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
src/GEOMAlgo/BlockFix.jxx
Normal file
6
src/GEOMAlgo/BlockFix.jxx
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_HeaderFile
|
||||||
|
#include <BlockFix.hxx>
|
||||||
|
#endif
|
48
src/GEOMAlgo/BlockFix_BlockFixAPI.cdl
Normal file
48
src/GEOMAlgo/BlockFix_BlockFixAPI.cdl
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
-- File: BlockFix_BlockFixAPI.cdl
|
||||||
|
-- Created: Tue Dec 7 17:56:09 2004
|
||||||
|
-- Author: Pavel Durandin
|
||||||
|
-- <det@doomox>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
class BlockFixAPI from BlockFix inherits TShared from MMgt
|
||||||
|
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
uses
|
||||||
|
|
||||||
|
Shape from TopoDS,
|
||||||
|
ReShape from ShapeBuild
|
||||||
|
|
||||||
|
is
|
||||||
|
Create returns BlockFixAPI from BlockFix;
|
||||||
|
---Purpose: Empty constructor
|
||||||
|
|
||||||
|
SetShape(me: mutable; Shape: Shape from TopoDS);
|
||||||
|
---Purpose: Sets the shape to be operated on
|
||||||
|
---C++: inline
|
||||||
|
|
||||||
|
Perform(me: mutable);
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
Shape(me) returns Shape from TopoDS;
|
||||||
|
---Purpose: Returns resulting shape.
|
||||||
|
---C++: inline
|
||||||
|
|
||||||
|
Context(me:mutable) returns ReShape from ShapeBuild;
|
||||||
|
---Purpose: Returns modifiable context for storing the
|
||||||
|
-- mofifications
|
||||||
|
---C++: inline
|
||||||
|
---C++: return &
|
||||||
|
|
||||||
|
Tolerance (me:mutable) returns Real;
|
||||||
|
---Purpose: Returns modifiable tolerance of recognition
|
||||||
|
---C++: inline
|
||||||
|
---C++: return &
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myContext : ReShape from ShapeBuild;
|
||||||
|
myShape : Shape from TopoDS;
|
||||||
|
myTolerance : Real from Standard;
|
||||||
|
|
||||||
|
end BlockFixAPI from BlockFix;
|
48
src/GEOMAlgo/BlockFix_BlockFixAPI.cxx
Normal file
48
src/GEOMAlgo/BlockFix_BlockFixAPI.cxx
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// File: BlockFix_BlockFixAPI.cxx
|
||||||
|
// Created: Tue Dec 7 11:59:05 2004
|
||||||
|
// Author: Pavel DURANDIN
|
||||||
|
// Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
|
||||||
|
#include <BlockFix_BlockFixAPI.ixx>
|
||||||
|
#include <BlockFix.hxx>
|
||||||
|
#include <BlockFix_UnionFaces.hxx>
|
||||||
|
#include <BlockFix_UnionEdges.hxx>
|
||||||
|
#include <Precision.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ShapeConvert_CanonicAPI
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_BlockFixAPI::BlockFix_BlockFixAPI()
|
||||||
|
{
|
||||||
|
myTolerance = Precision::Confusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_BlockFixAPI::Perform()
|
||||||
|
{
|
||||||
|
|
||||||
|
// processing spheres with degenerativities
|
||||||
|
TopoDS_Shape aShape = Shape();
|
||||||
|
myShape = BlockFix::RotateSphereSpace(aShape,myTolerance);
|
||||||
|
|
||||||
|
// faces unification
|
||||||
|
BlockFix_UnionFaces aFaceUnifier;
|
||||||
|
aFaceUnifier.GetTolerance() = myTolerance;
|
||||||
|
TopoDS_Shape aResult;
|
||||||
|
aResult = aFaceUnifier.Perform(myShape);
|
||||||
|
|
||||||
|
|
||||||
|
BlockFix_UnionEdges anEdgeUnifier;
|
||||||
|
myShape = anEdgeUnifier.Perform(aResult,myTolerance);
|
||||||
|
|
||||||
|
TopoDS_Shape aRes = BlockFix::FixRanges(myShape,myTolerance);
|
||||||
|
myShape = aRes;
|
||||||
|
|
||||||
|
}
|
118
src/GEOMAlgo/BlockFix_BlockFixAPI.hxx
Normal file
118
src/GEOMAlgo/BlockFix_BlockFixAPI.hxx
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
#define _BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
#include <Handle_BlockFix_BlockFixAPI.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
|
||||||
|
#include <Handle_ShapeBuild_ReShape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _MMgt_TShared_HeaderFile
|
||||||
|
#include <MMgt_TShared.hxx>
|
||||||
|
#endif
|
||||||
|
class ShapeBuild_ReShape;
|
||||||
|
class TopoDS_Shape;
|
||||||
|
|
||||||
|
|
||||||
|
class BlockFix_BlockFixAPI : public MMgt_TShared {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_BlockFixAPI();
|
||||||
|
void SetShape(const TopoDS_Shape& Shape) ;
|
||||||
|
Standard_EXPORT void Perform() ;
|
||||||
|
TopoDS_Shape Shape() const;
|
||||||
|
Handle_ShapeBuild_ReShape& Context() ;
|
||||||
|
Standard_Real& Tolerance() ;
|
||||||
|
Standard_EXPORT ~BlockFix_BlockFixAPI();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Type management
|
||||||
|
//
|
||||||
|
Standard_EXPORT friend Handle_Standard_Type& BlockFix_BlockFixAPI_Type_();
|
||||||
|
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||||
|
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
Handle_ShapeBuild_ReShape myContext;
|
||||||
|
TopoDS_Shape myShape;
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#include <BlockFix_BlockFixAPI.lxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
76
src/GEOMAlgo/BlockFix_BlockFixAPI.ixx
Normal file
76
src/GEOMAlgo/BlockFix_BlockFixAPI.ixx
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_BlockFixAPI.jxx>
|
||||||
|
|
||||||
|
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||||
|
#include <Standard_TypeMismatch.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BlockFix_BlockFixAPI::~BlockFix_BlockFixAPI() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Standard_EXPORT Handle_Standard_Type& BlockFix_BlockFixAPI_Type_()
|
||||||
|
{
|
||||||
|
|
||||||
|
static Handle_Standard_Type aType1 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
static Handle_Standard_Type aType2 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
|
||||||
|
|
||||||
|
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,NULL};
|
||||||
|
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_BlockFixAPI",
|
||||||
|
sizeof(BlockFix_BlockFixAPI),
|
||||||
|
1,
|
||||||
|
(Standard_Address)_Ancestors,
|
||||||
|
(Standard_Address)NULL);
|
||||||
|
|
||||||
|
return _aType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// DownCast method
|
||||||
|
// allow safe downcasting
|
||||||
|
//
|
||||||
|
const Handle(BlockFix_BlockFixAPI) Handle(BlockFix_BlockFixAPI)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||||
|
{
|
||||||
|
Handle(BlockFix_BlockFixAPI) _anOtherObject;
|
||||||
|
|
||||||
|
if (!AnObject.IsNull()) {
|
||||||
|
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_BlockFixAPI))) {
|
||||||
|
_anOtherObject = Handle(BlockFix_BlockFixAPI)((Handle(BlockFix_BlockFixAPI)&)AnObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _anOtherObject ;
|
||||||
|
}
|
||||||
|
const Handle(Standard_Type)& BlockFix_BlockFixAPI::DynamicType() const
|
||||||
|
{
|
||||||
|
return STANDARD_TYPE(BlockFix_BlockFixAPI) ;
|
||||||
|
}
|
||||||
|
Standard_Boolean BlockFix_BlockFixAPI::IsKind(const Handle(Standard_Type)& AType) const
|
||||||
|
{
|
||||||
|
return (STANDARD_TYPE(BlockFix_BlockFixAPI) == AType || MMgt_TShared::IsKind(AType));
|
||||||
|
}
|
||||||
|
Handle_BlockFix_BlockFixAPI::~Handle_BlockFix_BlockFixAPI() {}
|
||||||
|
|
9
src/GEOMAlgo/BlockFix_BlockFixAPI.jxx
Normal file
9
src/GEOMAlgo/BlockFix_BlockFixAPI.jxx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _ShapeBuild_ReShape_HeaderFile
|
||||||
|
#include <ShapeBuild_ReShape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
#include <BlockFix_BlockFixAPI.hxx>
|
||||||
|
#endif
|
42
src/GEOMAlgo/BlockFix_BlockFixAPI.lxx
Normal file
42
src/GEOMAlgo/BlockFix_BlockFixAPI.lxx
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <BlockFix_BlockFixAPI.hxx>
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Shape
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
inline void BlockFix_BlockFixAPI::SetShape(const TopoDS_Shape& Shape)
|
||||||
|
{
|
||||||
|
myShape = Shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Shape
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
inline TopoDS_Shape BlockFix_BlockFixAPI::Shape() const
|
||||||
|
{
|
||||||
|
return myShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Context
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
inline Handle(ShapeBuild_ReShape)& BlockFix_BlockFixAPI::Context()
|
||||||
|
{
|
||||||
|
return myContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Tolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
inline Standard_Real& BlockFix_BlockFixAPI::Tolerance()
|
||||||
|
{
|
||||||
|
return myTolerance;
|
||||||
|
}
|
||||||
|
|
46
src/GEOMAlgo/BlockFix_CheckTool.cdl
Normal file
46
src/GEOMAlgo/BlockFix_CheckTool.cdl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
-- File: BlockFix_CheckTool.cdl
|
||||||
|
-- Created: Fri Dec 17 10:36:58 2004
|
||||||
|
-- Author: Sergey KUUL
|
||||||
|
-- <skl@strelox.nnov.matra-dtv.fr>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
class CheckTool from BlockFix
|
||||||
|
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
uses
|
||||||
|
|
||||||
|
Shape from TopoDS,
|
||||||
|
SequenceOfShape from TopTools
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
Create returns CheckTool from BlockFix;
|
||||||
|
---Purpose: Empty constructor
|
||||||
|
|
||||||
|
SetShape(me: in out; aShape: Shape from TopoDS);
|
||||||
|
|
||||||
|
Perform(me: in out);
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
NbPossibleBlocks(me) returns Integer;
|
||||||
|
|
||||||
|
PossibleBlock(me; num: Integer) returns Shape from TopoDS;
|
||||||
|
|
||||||
|
DumpCheckResult(me; S : in out OStream);
|
||||||
|
---Purpose: Dumps results of checking
|
||||||
|
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myShape : Shape from TopoDS;
|
||||||
|
myHasCheck : Boolean;
|
||||||
|
myNbSolids : Integer;
|
||||||
|
myNbBlocks : Integer;
|
||||||
|
myPossibleBlocks : SequenceOfShape from TopTools;
|
||||||
|
myNbUF : Integer;
|
||||||
|
myNbUE : Integer;
|
||||||
|
myNbUFUE : Integer;
|
||||||
|
myBadRanges : Integer;
|
||||||
|
|
||||||
|
end CheckTool;
|
224
src/GEOMAlgo/BlockFix_CheckTool.cxx
Normal file
224
src/GEOMAlgo/BlockFix_CheckTool.cxx
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
// File: BlockFix_CheckTool.cxx
|
||||||
|
// Created: 17.12.04 11:15:25
|
||||||
|
// Author: Sergey KUUL
|
||||||
|
// Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
#include <BlockFix_CheckTool.ixx>
|
||||||
|
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <BlockFix_UnionEdges.hxx>
|
||||||
|
#include <BlockFix_UnionFaces.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Solid.hxx>
|
||||||
|
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BlockFix_CheckTool()
|
||||||
|
//purpose : Constructor
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_CheckTool::BlockFix_CheckTool( )
|
||||||
|
{
|
||||||
|
myHasCheck = Standard_False;
|
||||||
|
myPossibleBlocks.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetShape
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_CheckTool::SetShape(const TopoDS_Shape& aShape)
|
||||||
|
{
|
||||||
|
myHasCheck = Standard_False;
|
||||||
|
myShape = aShape;
|
||||||
|
myPossibleBlocks.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_CheckTool::Perform()
|
||||||
|
{
|
||||||
|
myNbSolids=0;
|
||||||
|
myNbBlocks=0;
|
||||||
|
myNbUF=0;
|
||||||
|
myNbUE=0;
|
||||||
|
myNbUFUE=0;
|
||||||
|
TopExp_Explorer exps;
|
||||||
|
for(exps.Init(myShape, TopAbs_SOLID); exps.More(); exps.Next()) {
|
||||||
|
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
|
||||||
|
myNbSolids++;
|
||||||
|
Standard_Boolean IsBlock=Standard_True;
|
||||||
|
Standard_Boolean MayBeUF=Standard_False;
|
||||||
|
Standard_Boolean MayBeUE=Standard_False;
|
||||||
|
Standard_Integer nf=0;
|
||||||
|
TopExp_Explorer expf;
|
||||||
|
for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) nf++;
|
||||||
|
|
||||||
|
if(nf<6) {
|
||||||
|
IsBlock=Standard_False;
|
||||||
|
}
|
||||||
|
else if(nf>6) {
|
||||||
|
IsBlock=Standard_False;
|
||||||
|
// check faces unification
|
||||||
|
TopTools_SequenceOfShape faces;
|
||||||
|
for( expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(expf.Current());
|
||||||
|
faces.Append(aFace);
|
||||||
|
}
|
||||||
|
Standard_Boolean HasFacesForUnification = Standard_False;
|
||||||
|
for(Standard_Integer i=1; i<faces.Length() && !HasFacesForUnification; i++) {
|
||||||
|
TopoDS_Face F1 = TopoDS::Face(faces.Value(i));
|
||||||
|
TopTools_MapOfShape Edges;
|
||||||
|
for(TopExp_Explorer expe(F1,TopAbs_EDGE); expe.More(); expe.Next())
|
||||||
|
Edges.Add(expe.Current().Oriented(TopAbs_FORWARD));
|
||||||
|
TopLoc_Location L1;
|
||||||
|
Handle(Geom_Surface) S1 = BRep_Tool::Surface(F1,L1);
|
||||||
|
for(Standard_Integer j=i+1; j<=faces.Length() && !HasFacesForUnification; j++) {
|
||||||
|
TopoDS_Face F2 = TopoDS::Face(faces.Value(j));
|
||||||
|
TopLoc_Location L2;
|
||||||
|
Handle(Geom_Surface) S2 = BRep_Tool::Surface(F2,L2);
|
||||||
|
if( S1==S2 && L1==L2 ) {
|
||||||
|
// faces have equal based surface
|
||||||
|
// now check common edge
|
||||||
|
for(TopExp_Explorer expe2(F2,TopAbs_EDGE); expe2.More(); expe2.Next()) {
|
||||||
|
if(Edges.Contains(expe2.Current().Oriented(TopAbs_FORWARD))) {
|
||||||
|
HasFacesForUnification = Standard_True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(HasFacesForUnification) {
|
||||||
|
MayBeUF=Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer ne=0;
|
||||||
|
TopExp_Explorer expe;
|
||||||
|
for(expe.Init(aSolid, TopAbs_EDGE); expe.More(); expe.Next()) ne++;
|
||||||
|
ne = ne/2;
|
||||||
|
if(ne<12)
|
||||||
|
IsBlock=Standard_False;
|
||||||
|
if(ne>12) {
|
||||||
|
IsBlock=Standard_False;
|
||||||
|
// check edges unification
|
||||||
|
// creating map of edge faces
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
||||||
|
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
|
||||||
|
for(expf.Init(aSolid, TopAbs_FACE); expf.More(); expf.Next()) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(expf.Current());
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
|
||||||
|
for(expe.Init(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
|
||||||
|
if(!aMapEdgeFaces.Contains(edge)) continue;
|
||||||
|
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
|
||||||
|
TopTools_ListIteratorOfListOfShape anIter(aList);
|
||||||
|
for( ; anIter.More(); anIter.Next()) {
|
||||||
|
TopoDS_Face face = TopoDS::Face(anIter.Value());
|
||||||
|
if(face.IsSame(aFace)) continue;
|
||||||
|
if(aMapFacesEdges.Contains(face)) {
|
||||||
|
aMapFacesEdges.ChangeFromKey(face).Append(edge);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape ListEdges;
|
||||||
|
ListEdges.Append(edge);
|
||||||
|
aMapFacesEdges.Add(face,ListEdges);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Standard_Integer i = 1;
|
||||||
|
for (; i <= aMapFacesEdges.Extent(); i++) {
|
||||||
|
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
|
||||||
|
if (ListEdges.Extent() > 1) break;
|
||||||
|
}
|
||||||
|
if (i <= aMapFacesEdges.Extent()) {
|
||||||
|
MayBeUE = Standard_True;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(IsBlock)
|
||||||
|
myNbBlocks++;
|
||||||
|
else {
|
||||||
|
if(MayBeUF) {
|
||||||
|
myPossibleBlocks.Append(aSolid);
|
||||||
|
if(MayBeUE)
|
||||||
|
myNbUFUE++;
|
||||||
|
else
|
||||||
|
myNbUF++;
|
||||||
|
}
|
||||||
|
else if(MayBeUE) {
|
||||||
|
myNbUE++;
|
||||||
|
myPossibleBlocks.Append(aSolid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
myHasCheck = Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NbPossibleBlocks
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Integer BlockFix_CheckTool::NbPossibleBlocks() const
|
||||||
|
{
|
||||||
|
return myPossibleBlocks.Length();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : PossibleBlock
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape BlockFix_CheckTool::PossibleBlock(const Standard_Integer num) const
|
||||||
|
{
|
||||||
|
TopoDS_Shape res;
|
||||||
|
if( num>0 && num<=myPossibleBlocks.Length() )
|
||||||
|
res = myPossibleBlocks.Value(num);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DumpCheckResult
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_CheckTool::DumpCheckResult(Standard_OStream& S) const
|
||||||
|
{
|
||||||
|
if(!myHasCheck)
|
||||||
|
S<<"Check not performed!"<<endl;
|
||||||
|
else {
|
||||||
|
S<<"dump results of check:"<<endl;
|
||||||
|
S<<" total number of solids = "<<myNbSolids<<endl;
|
||||||
|
S<<" including: number of good blocks = "<<myNbBlocks<<endl;
|
||||||
|
S<<" number of possible blocks = "<<NbPossibleBlocks()<<endl;
|
||||||
|
Standard_Integer nbtmp = myNbSolids - myNbBlocks - NbPossibleBlocks();
|
||||||
|
S<<" number of impossible blocks = "<<nbtmp<<endl;
|
||||||
|
S<<" including: need unionfaces = "<<myNbUF<<endl;
|
||||||
|
S<<" need unionedges = "<<myNbUE<<endl;
|
||||||
|
S<<" need both unionfaces and unionedges = "<<myNbUFUE<<endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
118
src/GEOMAlgo/BlockFix_CheckTool.hxx
Normal file
118
src/GEOMAlgo/BlockFix_CheckTool.hxx
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_CheckTool_HeaderFile
|
||||||
|
#define _BlockFix_CheckTool_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Boolean_HeaderFile
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Integer_HeaderFile
|
||||||
|
#include <Standard_Integer.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopTools_SequenceOfShape_HeaderFile
|
||||||
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_OStream_HeaderFile
|
||||||
|
#include <Standard_OStream.hxx>
|
||||||
|
#endif
|
||||||
|
class TopoDS_Shape;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class BlockFix_CheckTool {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_CheckTool();
|
||||||
|
Standard_EXPORT void SetShape(const TopoDS_Shape& aShape) ;
|
||||||
|
Standard_EXPORT void Perform() ;
|
||||||
|
Standard_EXPORT Standard_Integer NbPossibleBlocks() const;
|
||||||
|
Standard_EXPORT TopoDS_Shape PossibleBlock(const Standard_Integer num) const;
|
||||||
|
Standard_EXPORT void DumpCheckResult(Standard_OStream& S) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
TopoDS_Shape myShape;
|
||||||
|
Standard_Boolean myHasCheck;
|
||||||
|
Standard_Integer myNbSolids;
|
||||||
|
Standard_Integer myNbBlocks;
|
||||||
|
TopTools_SequenceOfShape myPossibleBlocks;
|
||||||
|
Standard_Integer myNbUF;
|
||||||
|
Standard_Integer myNbUE;
|
||||||
|
Standard_Integer myNbUFUE;
|
||||||
|
Standard_Integer myBadRanges;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
26
src/GEOMAlgo/BlockFix_CheckTool.ixx
Normal file
26
src/GEOMAlgo/BlockFix_CheckTool.ixx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_CheckTool.jxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
src/GEOMAlgo/BlockFix_CheckTool.jxx
Normal file
6
src/GEOMAlgo/BlockFix_CheckTool.jxx
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_CheckTool_HeaderFile
|
||||||
|
#include <BlockFix_CheckTool.hxx>
|
||||||
|
#endif
|
115
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl
Normal file
115
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cdl
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
-- File: BlockFix_PeriodicSurfaceModifier.cdl
|
||||||
|
-- Created: Wed Dec 15 10:03:50 2004
|
||||||
|
-- Author: Sergey KUUL
|
||||||
|
-- <skl@strelox.nnov.matra-dtv.fr>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
class PeriodicSurfaceModifier from BlockFix inherits Modification from BRepTools
|
||||||
|
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
uses
|
||||||
|
Vertex from TopoDS,
|
||||||
|
Edge from TopoDS,
|
||||||
|
Face from TopoDS,
|
||||||
|
Location from TopLoc,
|
||||||
|
Shape from GeomAbs,
|
||||||
|
Pnt from gp,
|
||||||
|
Curve from Geom,
|
||||||
|
Curve from Geom2d,
|
||||||
|
Surface from Geom,
|
||||||
|
IndexedMapOfTransient from TColStd,
|
||||||
|
DataMapOfShapeInteger from TopTools
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
Create returns mutable PeriodicSurfaceModifier from BlockFix;
|
||||||
|
|
||||||
|
SetTolerance(me: mutable; Toler: Real);
|
||||||
|
---Purpose: Sets the tolerance for recognition of geometry
|
||||||
|
|
||||||
|
NewSurface(me: mutable; F : Face from TopoDS;
|
||||||
|
S : out Surface from Geom;
|
||||||
|
L : out Location from TopLoc;
|
||||||
|
Tol: out Real from Standard;
|
||||||
|
RevWires : out Boolean from Standard;
|
||||||
|
RevFace : out Boolean from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the face <F> has been
|
||||||
|
-- modified. In this case, <S> is the new geometric
|
||||||
|
-- support of the face, <L> the new location, <Tol>
|
||||||
|
-- the new tolerance. Otherwise, returns
|
||||||
|
-- Standard_False, and <S>, <L>, <Tol> are not
|
||||||
|
-- significant.
|
||||||
|
|
||||||
|
NewCurve(me: mutable; E : Edge from TopoDS;
|
||||||
|
C : out Curve from Geom;
|
||||||
|
L : out Location from TopLoc;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the edge <E> has been
|
||||||
|
-- modified. In this case, <C> is the new geometric
|
||||||
|
-- support of the edge, <L> the new location, <Tol>
|
||||||
|
-- the new tolerance. Otherwise, returns
|
||||||
|
-- Standard_False, and <C>, <L>, <Tol> are not
|
||||||
|
-- significant.
|
||||||
|
|
||||||
|
NewPoint(me: mutable; V : Vertex from TopoDS;
|
||||||
|
P : out Pnt from gp;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the vertex <V> has been
|
||||||
|
-- modified. In this case, <P> is the new geometric
|
||||||
|
-- support of the vertex, <Tol> the new tolerance.
|
||||||
|
-- Otherwise, returns Standard_False, and <P>, <Tol>
|
||||||
|
-- are not significant.
|
||||||
|
|
||||||
|
NewCurve2d(me: mutable; E : Edge from TopoDS;
|
||||||
|
F : Face from TopoDS;
|
||||||
|
NewE : Edge from TopoDS;
|
||||||
|
NewF : Face from TopoDS;
|
||||||
|
C : out Curve from Geom2d;
|
||||||
|
Tol : out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the edge <E> has a new
|
||||||
|
-- curve on surface on the face <F>.In this case, <C>
|
||||||
|
-- is the new geometric support of the edge, <L> the
|
||||||
|
-- new location, <Tol> the new tolerance.
|
||||||
|
--
|
||||||
|
-- Otherwise, returns Standard_False, and <C>, <L>,
|
||||||
|
-- <Tol> are not significant.
|
||||||
|
--
|
||||||
|
-- <NewE> is the new edge created from <E>. <NewF>
|
||||||
|
-- is the new face created from <F>. They may be usefull.
|
||||||
|
|
||||||
|
NewParameter(me: mutable; V : Vertex from TopoDS;
|
||||||
|
E : Edge from TopoDS;
|
||||||
|
P : out Real from Standard;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the Vertex <V> has a new
|
||||||
|
-- parameter on the edge <E>. In this case, <P> is
|
||||||
|
-- the parameter, <Tol> the new tolerance.
|
||||||
|
-- Otherwise, returns Standard_False, and <P>, <Tol>
|
||||||
|
-- are not significant.
|
||||||
|
|
||||||
|
Continuity(me: mutable; E : Edge from TopoDS;
|
||||||
|
F1,F2 : Face from TopoDS;
|
||||||
|
NewE : Edge from TopoDS;
|
||||||
|
NewF1,NewF2: Face from TopoDS)
|
||||||
|
returns Shape from GeomAbs;
|
||||||
|
---Purpose: Returns the continuity of <NewE> between <NewF1>
|
||||||
|
-- and <NewF2>.
|
||||||
|
--
|
||||||
|
-- <NewE> is the new edge created from <E>. <NewF1>
|
||||||
|
-- (resp. <NewF2>) is the new face created from <F1>
|
||||||
|
-- (resp. <F2>).
|
||||||
|
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myTolerance : Real;
|
||||||
|
myMapOfFaces : DataMapOfShapeInteger from TopTools;
|
||||||
|
myMapOfSurfaces: IndexedMapOfTransient from TColStd;
|
||||||
|
|
||||||
|
end PeriodicSurfaceModifier;
|
230
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx
Normal file
230
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.cxx
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
// File: BlockFix_PeriodicSurfaceModifier.cxx
|
||||||
|
// Created: 15.12.04 10:08:50
|
||||||
|
// Author: Sergey KUUL
|
||||||
|
// Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
#include <BlockFix_PeriodicSurfaceModifier.ixx>
|
||||||
|
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
#include <Geom_CylindricalSurface.hxx>
|
||||||
|
#include <Geom_SphericalSurface.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BlockFix_PeriodicSurfaceModifier()
|
||||||
|
//purpose : Constructor
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_PeriodicSurfaceModifier::BlockFix_PeriodicSurfaceModifier ( )
|
||||||
|
{
|
||||||
|
myMapOfFaces.Clear();
|
||||||
|
myMapOfSurfaces.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetTolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_PeriodicSurfaceModifier::SetTolerance(const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
myTolerance = Tol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ModifySurface
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
|
||||||
|
const Handle(Geom_Surface)& aSurface,
|
||||||
|
Handle(Geom_Surface)& aNewSurface)
|
||||||
|
{
|
||||||
|
Handle(Geom_Surface) S = aSurface;
|
||||||
|
|
||||||
|
if(S->IsKind(STANDARD_TYPE(Geom_CylindricalSurface))) {
|
||||||
|
Handle(Geom_CylindricalSurface) aCyl =
|
||||||
|
Handle(Geom_CylindricalSurface)::DownCast(S);
|
||||||
|
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||||
|
BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
|
||||||
|
if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
|
||||||
|
gp_Ax3 ax3 = aCyl->Position();
|
||||||
|
gp_Ax1 NDir = ax3.Axis();
|
||||||
|
gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
|
||||||
|
Handle(Geom_CylindricalSurface) aNewCyl =
|
||||||
|
new Geom_CylindricalSurface(newax3,aCyl->Radius());
|
||||||
|
aNewSurface = aNewCyl;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||||
|
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
|
||||||
|
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||||
|
BRepTools::UVBounds(aFace, Umin, Umax, Vmin, Vmax);
|
||||||
|
if( Umin<-Precision::PConfusion() || Umax>2*PI+Precision::PConfusion() ) {
|
||||||
|
gp_Ax3 ax3 = aSphere->Position();
|
||||||
|
gp_Ax1 NDir = ax3.Axis();
|
||||||
|
gp_Ax3 newax3 = ax3.Rotated(NDir,Umin-Precision::PConfusion());
|
||||||
|
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(newax3,aSphere->Radius());
|
||||||
|
aNewSurface = aNewSphere;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewSurface
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewSurface(const TopoDS_Face& F,
|
||||||
|
Handle(Geom_Surface)& S,
|
||||||
|
TopLoc_Location& L,Standard_Real& Tol,
|
||||||
|
Standard_Boolean& RevWires,
|
||||||
|
Standard_Boolean& RevFace)
|
||||||
|
{
|
||||||
|
TopLoc_Location LS;
|
||||||
|
Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
|
||||||
|
|
||||||
|
if(ModifySurface(F, SIni, S)) {
|
||||||
|
|
||||||
|
RevWires = Standard_False;
|
||||||
|
RevFace = Standard_False;
|
||||||
|
|
||||||
|
L = LS;
|
||||||
|
Tol = BRep_Tool::Tolerance(F);
|
||||||
|
|
||||||
|
Standard_Integer anIndex = myMapOfSurfaces.Add(S);
|
||||||
|
myMapOfFaces.Bind(F,anIndex);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewCurve
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve(const TopoDS_Edge& /*E*/,
|
||||||
|
Handle(Geom_Curve)& /*C*/,
|
||||||
|
TopLoc_Location& /*L*/,
|
||||||
|
Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewPoint
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
|
||||||
|
gp_Pnt& /*P*/,
|
||||||
|
Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewCurve2d
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewCurve2d(const TopoDS_Edge& E,
|
||||||
|
const TopoDS_Face& F,
|
||||||
|
const TopoDS_Edge& /*NewE*/,
|
||||||
|
const TopoDS_Face& /*NewF*/,
|
||||||
|
Handle(Geom2d_Curve)& C,
|
||||||
|
Standard_Real& Tol)
|
||||||
|
{
|
||||||
|
//check if undelying surface of the face was modified
|
||||||
|
if(myMapOfFaces.IsBound(F)) {
|
||||||
|
Standard_Integer anIndex = myMapOfFaces.Find(F);
|
||||||
|
|
||||||
|
Handle(Geom_Surface) aNewSurf = Handle(Geom_Surface)::DownCast(myMapOfSurfaces.FindKey(anIndex));
|
||||||
|
|
||||||
|
Standard_Real f,l;
|
||||||
|
TopLoc_Location LC, LS;
|
||||||
|
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
|
||||||
|
Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
|
||||||
|
|
||||||
|
//taking into accound the orientation of the seam
|
||||||
|
C = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||||
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
|
|
||||||
|
BRep_Builder B;
|
||||||
|
TopoDS_Edge TempE;
|
||||||
|
B.MakeEdge(TempE);
|
||||||
|
B.Add(TempE, TopExp::FirstVertex(E));
|
||||||
|
B.Add(TempE, TopExp::LastVertex(E));
|
||||||
|
|
||||||
|
if(!C3d.IsNull())
|
||||||
|
B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
|
||||||
|
B.Range(TempE, f, l);
|
||||||
|
|
||||||
|
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
|
||||||
|
Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSurf->Transformed(LS.Transformation()));
|
||||||
|
TopLoc_Location LTemp;
|
||||||
|
LTemp.Identity();
|
||||||
|
|
||||||
|
Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
|
||||||
|
Standard_Real aWorkTol = 2*myTolerance+Tol;
|
||||||
|
sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
|
||||||
|
sfe->FixSameParameter(TempE);
|
||||||
|
|
||||||
|
//keep the orientation of original edge
|
||||||
|
TempE.Orientation(E.Orientation());
|
||||||
|
C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
|
||||||
|
|
||||||
|
//surface was modified
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewParameter
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,
|
||||||
|
const TopoDS_Edge& /*E*/,
|
||||||
|
Standard_Real& /*P*/,
|
||||||
|
Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Continuity
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
GeomAbs_Shape BlockFix_PeriodicSurfaceModifier::Continuity(const TopoDS_Edge& E,
|
||||||
|
const TopoDS_Face& F1,
|
||||||
|
const TopoDS_Face& F2,
|
||||||
|
const TopoDS_Edge& /*NewE*/,
|
||||||
|
const TopoDS_Face& /*NewF1*/,
|
||||||
|
const TopoDS_Face& /*NewF2*/)
|
||||||
|
{
|
||||||
|
return BRep_Tool::Continuity(E,F1,F2);
|
||||||
|
}
|
||||||
|
|
140
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx
Normal file
140
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.hxx
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
#define _BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
#include <Handle_BlockFix_PeriodicSurfaceModifier.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
|
||||||
|
#include <TopTools_DataMapOfShapeInteger.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
|
||||||
|
#include <TColStd_IndexedMapOfTransient.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BRepTools_Modification_HeaderFile
|
||||||
|
#include <BRepTools_Modification.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Boolean_HeaderFile
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom_Surface_HeaderFile
|
||||||
|
#include <Handle_Geom_Surface.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom_Curve_HeaderFile
|
||||||
|
#include <Handle_Geom_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom2d_Curve_HeaderFile
|
||||||
|
#include <Handle_Geom2d_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _GeomAbs_Shape_HeaderFile
|
||||||
|
#include <GeomAbs_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
class TopoDS_Face;
|
||||||
|
class Geom_Surface;
|
||||||
|
class TopLoc_Location;
|
||||||
|
class TopoDS_Edge;
|
||||||
|
class Geom_Curve;
|
||||||
|
class TopoDS_Vertex;
|
||||||
|
class gp_Pnt;
|
||||||
|
class Geom2d_Curve;
|
||||||
|
|
||||||
|
|
||||||
|
class BlockFix_PeriodicSurfaceModifier : public BRepTools_Modification {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_PeriodicSurfaceModifier();
|
||||||
|
Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
|
||||||
|
Standard_EXPORT ~BlockFix_PeriodicSurfaceModifier();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Type management
|
||||||
|
//
|
||||||
|
Standard_EXPORT friend Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_();
|
||||||
|
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||||
|
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
TopTools_DataMapOfShapeInteger myMapOfFaces;
|
||||||
|
TColStd_IndexedMapOfTransient myMapOfSurfaces;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
78
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx
Normal file
78
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.ixx
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_PeriodicSurfaceModifier.jxx>
|
||||||
|
|
||||||
|
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||||
|
#include <Standard_TypeMismatch.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BlockFix_PeriodicSurfaceModifier::~BlockFix_PeriodicSurfaceModifier() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Standard_EXPORT Handle_Standard_Type& BlockFix_PeriodicSurfaceModifier_Type_()
|
||||||
|
{
|
||||||
|
|
||||||
|
static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
|
||||||
|
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
|
||||||
|
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
|
||||||
|
|
||||||
|
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
|
||||||
|
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_PeriodicSurfaceModifier",
|
||||||
|
sizeof(BlockFix_PeriodicSurfaceModifier),
|
||||||
|
1,
|
||||||
|
(Standard_Address)_Ancestors,
|
||||||
|
(Standard_Address)NULL);
|
||||||
|
|
||||||
|
return _aType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// DownCast method
|
||||||
|
// allow safe downcasting
|
||||||
|
//
|
||||||
|
const Handle(BlockFix_PeriodicSurfaceModifier) Handle(BlockFix_PeriodicSurfaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||||
|
{
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier) _anOtherObject;
|
||||||
|
|
||||||
|
if (!AnObject.IsNull()) {
|
||||||
|
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier))) {
|
||||||
|
_anOtherObject = Handle(BlockFix_PeriodicSurfaceModifier)((Handle(BlockFix_PeriodicSurfaceModifier)&)AnObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _anOtherObject ;
|
||||||
|
}
|
||||||
|
const Handle(Standard_Type)& BlockFix_PeriodicSurfaceModifier::DynamicType() const
|
||||||
|
{
|
||||||
|
return STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) ;
|
||||||
|
}
|
||||||
|
Standard_Boolean BlockFix_PeriodicSurfaceModifier::IsKind(const Handle(Standard_Type)& AType) const
|
||||||
|
{
|
||||||
|
return (STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier) == AType || BRepTools_Modification::IsKind(AType));
|
||||||
|
}
|
||||||
|
Handle_BlockFix_PeriodicSurfaceModifier::~Handle_BlockFix_PeriodicSurfaceModifier() {}
|
||||||
|
|
27
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx
Normal file
27
src/GEOMAlgo/BlockFix_PeriodicSurfaceModifier.jxx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef _TopoDS_Face_HeaderFile
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom_Surface_HeaderFile
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopLoc_Location_HeaderFile
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Edge_HeaderFile
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom_Curve_HeaderFile
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Vertex_HeaderFile
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _gp_Pnt_HeaderFile
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom2d_Curve_HeaderFile
|
||||||
|
#include <Geom2d_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
#include <BlockFix_PeriodicSurfaceModifier.hxx>
|
||||||
|
#endif
|
120
src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl
Normal file
120
src/GEOMAlgo/BlockFix_SphereSpaceModifier.cdl
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
-- File: BlockFix_SphereSpaceModifier.cdl
|
||||||
|
-- Created: Tue Dec 7 12:01:49 2004
|
||||||
|
-- Author: Pavel Durandin
|
||||||
|
-- <det@doomox>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
|
||||||
|
class SphereSpaceModifier from BlockFix inherits Modification from BRepTools
|
||||||
|
|
||||||
|
---Purpose: Rotation of the parametric space of the sphere in order
|
||||||
|
-- to avoid the seam and degenerared edge within it
|
||||||
|
|
||||||
|
uses
|
||||||
|
Vertex from TopoDS,
|
||||||
|
Edge from TopoDS,
|
||||||
|
Face from TopoDS,
|
||||||
|
Location from TopLoc,
|
||||||
|
Shape from GeomAbs,
|
||||||
|
Pnt from gp,
|
||||||
|
Curve from Geom,
|
||||||
|
Curve from Geom2d,
|
||||||
|
Surface from Geom,
|
||||||
|
IndexedMapOfTransient from TColStd,
|
||||||
|
DataMapOfShapeInteger from TopTools
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
Create returns mutable SphereSpaceModifier from BlockFix;
|
||||||
|
|
||||||
|
SetTolerance(me: mutable; Toler: Real);
|
||||||
|
---Purpose: Sets the tolerance for recognition of geometry
|
||||||
|
|
||||||
|
NewSurface(me: mutable; F : Face from TopoDS;
|
||||||
|
S : out Surface from Geom;
|
||||||
|
L : out Location from TopLoc;
|
||||||
|
Tol: out Real from Standard;
|
||||||
|
RevWires : out Boolean from Standard;
|
||||||
|
RevFace : out Boolean from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the face <F> has been
|
||||||
|
-- modified. In this case, <S> is the new geometric
|
||||||
|
-- support of the face, <L> the new location, <Tol>
|
||||||
|
-- the new tolerance. Otherwise, returns
|
||||||
|
-- Standard_False, and <S>, <L>, <Tol> are not
|
||||||
|
-- significant.
|
||||||
|
|
||||||
|
NewCurve(me: mutable; E : Edge from TopoDS;
|
||||||
|
C : out Curve from Geom;
|
||||||
|
L : out Location from TopLoc;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the edge <E> has been
|
||||||
|
-- modified. In this case, <C> is the new geometric
|
||||||
|
-- support of the edge, <L> the new location, <Tol>
|
||||||
|
-- the new tolerance. Otherwise, returns
|
||||||
|
-- Standard_False, and <C>, <L>, <Tol> are not
|
||||||
|
-- significant.
|
||||||
|
|
||||||
|
NewPoint(me: mutable; V : Vertex from TopoDS;
|
||||||
|
P : out Pnt from gp;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the vertex <V> has been
|
||||||
|
-- modified. In this case, <P> is the new geometric
|
||||||
|
-- support of the vertex, <Tol> the new tolerance.
|
||||||
|
-- Otherwise, returns Standard_False, and <P>, <Tol>
|
||||||
|
-- are not significant.
|
||||||
|
|
||||||
|
NewCurve2d(me: mutable; E : Edge from TopoDS;
|
||||||
|
F : Face from TopoDS;
|
||||||
|
NewE : Edge from TopoDS;
|
||||||
|
NewF : Face from TopoDS;
|
||||||
|
C : out Curve from Geom2d;
|
||||||
|
Tol : out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the edge <E> has a new
|
||||||
|
-- curve on surface on the face <F>.In this case, <C>
|
||||||
|
-- is the new geometric support of the edge, <L> the
|
||||||
|
-- new location, <Tol> the new tolerance.
|
||||||
|
--
|
||||||
|
-- Otherwise, returns Standard_False, and <C>, <L>,
|
||||||
|
-- <Tol> are not significant.
|
||||||
|
--
|
||||||
|
-- <NewE> is the new edge created from <E>. <NewF>
|
||||||
|
-- is the new face created from <F>. They may be usefull.
|
||||||
|
|
||||||
|
NewParameter(me: mutable; V : Vertex from TopoDS;
|
||||||
|
E : Edge from TopoDS;
|
||||||
|
P : out Real from Standard;
|
||||||
|
Tol: out Real from Standard)
|
||||||
|
returns Boolean from Standard;
|
||||||
|
---Purpose: Returns Standard_True if the Vertex <V> has a new
|
||||||
|
-- parameter on the edge <E>. In this case, <P> is
|
||||||
|
-- the parameter, <Tol> the new tolerance.
|
||||||
|
-- Otherwise, returns Standard_False, and <P>, <Tol>
|
||||||
|
-- are not significant.
|
||||||
|
|
||||||
|
Continuity(me: mutable; E : Edge from TopoDS;
|
||||||
|
F1,F2 : Face from TopoDS;
|
||||||
|
NewE : Edge from TopoDS;
|
||||||
|
NewF1,NewF2: Face from TopoDS)
|
||||||
|
returns Shape from GeomAbs;
|
||||||
|
---Purpose: Returns the continuity of <NewE> between <NewF1>
|
||||||
|
-- and <NewF2>.
|
||||||
|
--
|
||||||
|
-- <NewE> is the new edge created from <E>. <NewF1>
|
||||||
|
-- (resp. <NewF2>) is the new face created from <F1>
|
||||||
|
-- (resp. <F2>).
|
||||||
|
|
||||||
|
ForRotation(me: mutable; F: Face from TopoDS) returns Boolean;
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myTolerance : Real;
|
||||||
|
myMapOfFaces : DataMapOfShapeInteger from TopTools;
|
||||||
|
myMapOfSpheres: IndexedMapOfTransient from TColStd;
|
||||||
|
--myMapOfGeom: MapOfShapeTransient from TColStd;
|
||||||
|
|
||||||
|
end SphereSpaceModifier;
|
||||||
|
|
224
src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx
Normal file
224
src/GEOMAlgo/BlockFix_SphereSpaceModifier.cxx
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
// File: BlockFix.cxx
|
||||||
|
// Created: Tue Dec 7 11:59:05 2004
|
||||||
|
// Author: Pavel DURANDIN
|
||||||
|
// Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
#include <BlockFix_SphereSpaceModifier.ixx>
|
||||||
|
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <Geom_SphericalSurface.hxx>
|
||||||
|
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||||
|
#include <ShapeAnalysis.hxx>
|
||||||
|
#include <gp_Sphere.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#include <Geom2d_Curve.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BlockFix_SphereSpaceModifier
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_SphereSpaceModifier::BlockFix_SphereSpaceModifier()
|
||||||
|
{
|
||||||
|
myMapOfFaces.Clear();
|
||||||
|
myMapOfSpheres.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SetTolerance
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_SphereSpaceModifier::SetTolerance(const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
myTolerance = Tol;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewSurface
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
|
||||||
|
static Standard_Boolean ModifySurface(const TopoDS_Face& aFace,
|
||||||
|
const Handle(Geom_Surface)& aSurface,
|
||||||
|
Handle(Geom_Surface)& aNewSurface)
|
||||||
|
{
|
||||||
|
Handle(Geom_Surface) S = aSurface;
|
||||||
|
if(S->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
||||||
|
Handle(Geom_RectangularTrimmedSurface) RTS =
|
||||||
|
Handle(Geom_RectangularTrimmedSurface)::DownCast(S);
|
||||||
|
S = RTS->BasisSurface();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(S->IsKind(STANDARD_TYPE(Geom_SphericalSurface))) {
|
||||||
|
Standard_Real Umin, Umax, Vmin, Vmax;
|
||||||
|
ShapeAnalysis::GetFaceUVBounds(aFace,Umin, Umax, Vmin, Vmax);
|
||||||
|
Standard_Real PI2 = PI/2.;
|
||||||
|
if(Vmax > PI2 - Precision::PConfusion() || Vmin < -PI2+::Precision::PConfusion()) {
|
||||||
|
if(Abs(Vmax-Vmin) < PI2) {
|
||||||
|
Handle(Geom_SphericalSurface) aSphere = Handle(Geom_SphericalSurface)::DownCast(S);
|
||||||
|
gp_Sphere sp = aSphere->Sphere();
|
||||||
|
gp_Ax3 ax3 = sp.Position();
|
||||||
|
gp_Ax3 axnew3(ax3.Axis().Location(), ax3.Direction()^ax3.XDirection(),ax3.XDirection());
|
||||||
|
sp.SetPosition(axnew3);
|
||||||
|
Handle(Geom_SphericalSurface) aNewSphere = new Geom_SphericalSurface(sp);
|
||||||
|
aNewSurface = aNewSphere;
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::NewSurface(const TopoDS_Face& F,
|
||||||
|
Handle(Geom_Surface)& S,
|
||||||
|
TopLoc_Location& L,Standard_Real& Tol,
|
||||||
|
Standard_Boolean& RevWires,
|
||||||
|
Standard_Boolean& RevFace)
|
||||||
|
{
|
||||||
|
TopLoc_Location LS;
|
||||||
|
Handle(Geom_Surface) SIni = BRep_Tool::Surface(F, LS);
|
||||||
|
|
||||||
|
//check if pole of the sphere in the parametric space
|
||||||
|
if(ModifySurface(F, SIni, S)) {
|
||||||
|
|
||||||
|
RevWires = Standard_False;
|
||||||
|
RevFace = Standard_False;
|
||||||
|
|
||||||
|
L = LS;
|
||||||
|
Tol = BRep_Tool::Tolerance(F);
|
||||||
|
|
||||||
|
Standard_Integer anIndex = myMapOfSpheres.Add(S);
|
||||||
|
myMapOfFaces.Bind(F,anIndex);
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewCurve
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve(const TopoDS_Edge& /*E*/,Handle(Geom_Curve)& /*C*/,
|
||||||
|
TopLoc_Location& /*L*/,Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewPoint
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::NewPoint(const TopoDS_Vertex& /*V*/,
|
||||||
|
gp_Pnt& /*P*/,
|
||||||
|
Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewCurve2d
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,
|
||||||
|
const TopoDS_Edge& /*NewE*/,const TopoDS_Face& /*NewF*/,
|
||||||
|
Handle(Geom2d_Curve)& C,Standard_Real& Tol)
|
||||||
|
{
|
||||||
|
//check if undelying surface of the face was modified
|
||||||
|
if(myMapOfFaces.IsBound(F)) {
|
||||||
|
Standard_Integer anIndex = myMapOfFaces.Find(F);
|
||||||
|
|
||||||
|
Handle(Geom_Surface) aNewSphere = Handle(Geom_Surface)::DownCast(myMapOfSpheres.FindKey(anIndex));
|
||||||
|
|
||||||
|
Standard_Real f,l;
|
||||||
|
TopLoc_Location LC, LS;
|
||||||
|
Handle(Geom_Curve) C3d = BRep_Tool::Curve ( E, LC, f, l );
|
||||||
|
Handle(Geom_Surface) S = BRep_Tool::Surface(F, LS);
|
||||||
|
|
||||||
|
//taking into accound the orientation of the seam
|
||||||
|
C = BRep_Tool::CurveOnSurface(E,F,f,l);
|
||||||
|
Tol = BRep_Tool::Tolerance(E);
|
||||||
|
|
||||||
|
BRep_Builder B;
|
||||||
|
TopoDS_Edge TempE;
|
||||||
|
B.MakeEdge(TempE);
|
||||||
|
B.Add(TempE, TopExp::FirstVertex(E));
|
||||||
|
B.Add(TempE, TopExp::LastVertex(E));
|
||||||
|
|
||||||
|
if(!C3d.IsNull())
|
||||||
|
B.UpdateEdge(TempE, Handle(Geom_Curve)::DownCast(C3d->Transformed(LC.Transformation())), Precision::Confusion());
|
||||||
|
B.Range(TempE, f, l);
|
||||||
|
|
||||||
|
Handle(ShapeFix_Edge) sfe = new ShapeFix_Edge;
|
||||||
|
Handle(Geom_Surface) STemp = Handle(Geom_Surface)::DownCast(aNewSphere->Transformed(LS.Transformation()));
|
||||||
|
TopLoc_Location LTemp;
|
||||||
|
LTemp.Identity();
|
||||||
|
|
||||||
|
Standard_Boolean isClosed = BRep_Tool::IsClosed (E, F);
|
||||||
|
Standard_Real aWorkTol = 2*myTolerance+Tol;
|
||||||
|
sfe->FixAddPCurve(TempE, STemp, LTemp, isClosed, Max(Precision::Confusion(), aWorkTol));
|
||||||
|
sfe->FixSameParameter(TempE);
|
||||||
|
|
||||||
|
//keep the orientation of original edge
|
||||||
|
TempE.Orientation(E.Orientation());
|
||||||
|
C = BRep_Tool::CurveOnSurface(TempE, STemp, LTemp, f, l);
|
||||||
|
|
||||||
|
// shifting seam of sphere
|
||||||
|
if(isClosed && !C.IsNull()) {
|
||||||
|
Standard_Real f2,l2;
|
||||||
|
Handle(Geom2d_Curve) c22 =
|
||||||
|
BRep_Tool::CurveOnSurface(TopoDS::Edge(TempE.Reversed()),STemp, LTemp,f2,l2);
|
||||||
|
Standard_Real dPreci = Precision::PConfusion()*Precision::PConfusion();
|
||||||
|
if((C->Value(f).SquareDistance(c22->Value(f2)) < dPreci)
|
||||||
|
||(C->Value(l).SquareDistance(c22->Value(l2)) < dPreci)) {
|
||||||
|
gp_Vec2d shift(S->UPeriod(),0.);
|
||||||
|
C->Translate(shift);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//sphere was modified
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : NewParameter
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::NewParameter(const TopoDS_Vertex& /*V*/,const TopoDS_Edge& /*E*/,
|
||||||
|
Standard_Real& /*P*/,Standard_Real& /*Tol*/)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Continuity
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
GeomAbs_Shape BlockFix_SphereSpaceModifier::Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,
|
||||||
|
const TopoDS_Face& F2,const TopoDS_Edge& /*NewE*/,
|
||||||
|
const TopoDS_Face& /*NewF1*/,const TopoDS_Face& /*NewF2*/)
|
||||||
|
{
|
||||||
|
return BRep_Tool::Continuity(E,F1,F2);
|
||||||
|
}
|
||||||
|
|
141
src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx
Normal file
141
src/GEOMAlgo/BlockFix_SphereSpaceModifier.hxx
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
#define _BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
#include <Handle_BlockFix_SphereSpaceModifier.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopTools_DataMapOfShapeInteger_HeaderFile
|
||||||
|
#include <TopTools_DataMapOfShapeInteger.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TColStd_IndexedMapOfTransient_HeaderFile
|
||||||
|
#include <TColStd_IndexedMapOfTransient.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BRepTools_Modification_HeaderFile
|
||||||
|
#include <BRepTools_Modification.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Boolean_HeaderFile
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom_Surface_HeaderFile
|
||||||
|
#include <Handle_Geom_Surface.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom_Curve_HeaderFile
|
||||||
|
#include <Handle_Geom_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_Geom2d_Curve_HeaderFile
|
||||||
|
#include <Handle_Geom2d_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _GeomAbs_Shape_HeaderFile
|
||||||
|
#include <GeomAbs_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
class TopoDS_Face;
|
||||||
|
class Geom_Surface;
|
||||||
|
class TopLoc_Location;
|
||||||
|
class TopoDS_Edge;
|
||||||
|
class Geom_Curve;
|
||||||
|
class TopoDS_Vertex;
|
||||||
|
class gp_Pnt;
|
||||||
|
class Geom2d_Curve;
|
||||||
|
|
||||||
|
|
||||||
|
class BlockFix_SphereSpaceModifier : public BRepTools_Modification {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_SphereSpaceModifier();
|
||||||
|
Standard_EXPORT void SetTolerance(const Standard_Real Toler) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewSurface(const TopoDS_Face& F,Handle(Geom_Surface)& S,TopLoc_Location& L,Standard_Real& Tol,Standard_Boolean& RevWires,Standard_Boolean& RevFace) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewCurve(const TopoDS_Edge& E,Handle(Geom_Curve)& C,TopLoc_Location& L,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewPoint(const TopoDS_Vertex& V,gp_Pnt& P,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewCurve2d(const TopoDS_Edge& E,const TopoDS_Face& F,const TopoDS_Edge& NewE,const TopoDS_Face& NewF,Handle(Geom2d_Curve)& C,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT Standard_Boolean NewParameter(const TopoDS_Vertex& V,const TopoDS_Edge& E,Standard_Real& P,Standard_Real& Tol) ;
|
||||||
|
Standard_EXPORT GeomAbs_Shape Continuity(const TopoDS_Edge& E,const TopoDS_Face& F1,const TopoDS_Face& F2,const TopoDS_Edge& NewE,const TopoDS_Face& NewF1,const TopoDS_Face& NewF2) ;
|
||||||
|
Standard_EXPORT Standard_Boolean ForRotation(const TopoDS_Face& F) ;
|
||||||
|
Standard_EXPORT ~BlockFix_SphereSpaceModifier();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Type management
|
||||||
|
//
|
||||||
|
Standard_EXPORT friend Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_();
|
||||||
|
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const;
|
||||||
|
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
TopTools_DataMapOfShapeInteger myMapOfFaces;
|
||||||
|
TColStd_IndexedMapOfTransient myMapOfSpheres;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
78
src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx
Normal file
78
src/GEOMAlgo/BlockFix_SphereSpaceModifier.ixx
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_SphereSpaceModifier.jxx>
|
||||||
|
|
||||||
|
#ifndef _Standard_TypeMismatch_HeaderFile
|
||||||
|
#include <Standard_TypeMismatch.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BlockFix_SphereSpaceModifier::~BlockFix_SphereSpaceModifier() {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Standard_EXPORT Handle_Standard_Type& BlockFix_SphereSpaceModifier_Type_()
|
||||||
|
{
|
||||||
|
|
||||||
|
static Handle_Standard_Type aType1 = STANDARD_TYPE(BRepTools_Modification);
|
||||||
|
if ( aType1.IsNull()) aType1 = STANDARD_TYPE(BRepTools_Modification);
|
||||||
|
static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
|
||||||
|
static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
|
||||||
|
|
||||||
|
|
||||||
|
static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
|
||||||
|
static Handle_Standard_Type _aType = new Standard_Type("BlockFix_SphereSpaceModifier",
|
||||||
|
sizeof(BlockFix_SphereSpaceModifier),
|
||||||
|
1,
|
||||||
|
(Standard_Address)_Ancestors,
|
||||||
|
(Standard_Address)NULL);
|
||||||
|
|
||||||
|
return _aType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// DownCast method
|
||||||
|
// allow safe downcasting
|
||||||
|
//
|
||||||
|
const Handle(BlockFix_SphereSpaceModifier) Handle(BlockFix_SphereSpaceModifier)::DownCast(const Handle(Standard_Transient)& AnObject)
|
||||||
|
{
|
||||||
|
Handle(BlockFix_SphereSpaceModifier) _anOtherObject;
|
||||||
|
|
||||||
|
if (!AnObject.IsNull()) {
|
||||||
|
if (AnObject->IsKind(STANDARD_TYPE(BlockFix_SphereSpaceModifier))) {
|
||||||
|
_anOtherObject = Handle(BlockFix_SphereSpaceModifier)((Handle(BlockFix_SphereSpaceModifier)&)AnObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _anOtherObject ;
|
||||||
|
}
|
||||||
|
const Handle(Standard_Type)& BlockFix_SphereSpaceModifier::DynamicType() const
|
||||||
|
{
|
||||||
|
return STANDARD_TYPE(BlockFix_SphereSpaceModifier) ;
|
||||||
|
}
|
||||||
|
Standard_Boolean BlockFix_SphereSpaceModifier::IsKind(const Handle(Standard_Type)& AType) const
|
||||||
|
{
|
||||||
|
return (STANDARD_TYPE(BlockFix_SphereSpaceModifier) == AType || BRepTools_Modification::IsKind(AType));
|
||||||
|
}
|
||||||
|
Handle_BlockFix_SphereSpaceModifier::~Handle_BlockFix_SphereSpaceModifier() {}
|
||||||
|
|
27
src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx
Normal file
27
src/GEOMAlgo/BlockFix_SphereSpaceModifier.jxx
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef _TopoDS_Face_HeaderFile
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom_Surface_HeaderFile
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopLoc_Location_HeaderFile
|
||||||
|
#include <TopLoc_Location.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Edge_HeaderFile
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom_Curve_HeaderFile
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Vertex_HeaderFile
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _gp_Pnt_HeaderFile
|
||||||
|
#include <gp_Pnt.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Geom2d_Curve_HeaderFile
|
||||||
|
#include <Geom2d_Curve.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
#include <BlockFix_SphereSpaceModifier.hxx>
|
||||||
|
#endif
|
28
src/GEOMAlgo/BlockFix_UnionEdges.cdl
Normal file
28
src/GEOMAlgo/BlockFix_UnionEdges.cdl
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
-- File: BlockFix_UnionEdges.cdl
|
||||||
|
-- Created: Tue Dec 7 15:24:51 2004
|
||||||
|
-- Author: Sergey KUUL
|
||||||
|
-- <skl@novgorox.nnov.matra-dtv.fr>
|
||||||
|
|
||||||
|
class UnionEdges from BlockFix
|
||||||
|
|
||||||
|
---Purpose:
|
||||||
|
|
||||||
|
uses
|
||||||
|
|
||||||
|
Shape from TopoDS,
|
||||||
|
ReShape from ShapeBuild
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
Create returns UnionEdges from BlockFix;
|
||||||
|
|
||||||
|
Perform(me: in out; Shape: Shape from TopoDS;
|
||||||
|
Tol : Real)
|
||||||
|
returns Shape from TopoDS;
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myTolerance : Real;
|
||||||
|
myContext : ReShape from ShapeBuild;
|
||||||
|
|
||||||
|
end UnionEdges;
|
325
src/GEOMAlgo/BlockFix_UnionEdges.cxx
Normal file
325
src/GEOMAlgo/BlockFix_UnionEdges.cxx
Normal file
@ -0,0 +1,325 @@
|
|||||||
|
// File: BlockFix_UnionEdges.cxx
|
||||||
|
// Created: 07.12.04 15:27:30
|
||||||
|
// Author: Sergey KUUL
|
||||||
|
|
||||||
|
|
||||||
|
#include <BlockFix_UnionEdges.ixx>
|
||||||
|
|
||||||
|
#include <Approx_Curve3d.hxx>
|
||||||
|
#include <BRepAdaptor_HCompCurve.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <GC_MakeCircle.hxx>
|
||||||
|
#include <Geom_BSplineCurve.hxx>
|
||||||
|
#include <Geom_Circle.hxx>
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#include <Geom_Line.hxx>
|
||||||
|
#include <Geom_TrimmedCurve.hxx>
|
||||||
|
#include <ShapeAnalysis_Edge.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
#include <ShapeFix_Face.hxx>
|
||||||
|
#include <TColgp_SequenceOfPnt.hxx>
|
||||||
|
#include <TColStd_MapOfInteger.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopTools_IndexedMapOfShape.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Solid.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BlockFix_UnionEdges()
|
||||||
|
//purpose : Constructor
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_UnionEdges::BlockFix_UnionEdges ( )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : MergeEdges
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
static Standard_Boolean MergeEdges(const TopTools_SequenceOfShape& SeqEdges,
|
||||||
|
const TopoDS_Face& aFace,
|
||||||
|
const Standard_Real Tol,
|
||||||
|
TopoDS_Edge& anEdge)
|
||||||
|
{
|
||||||
|
// make chain for union
|
||||||
|
BRep_Builder B;
|
||||||
|
ShapeAnalysis_Edge sae;
|
||||||
|
TopoDS_Edge FirstE = TopoDS::Edge(SeqEdges.Value(1));
|
||||||
|
TopoDS_Edge LastE = FirstE;
|
||||||
|
TopoDS_Vertex VF = sae.FirstVertex(FirstE);
|
||||||
|
TopoDS_Vertex VL = sae.LastVertex(LastE);
|
||||||
|
TopTools_SequenceOfShape aChain;
|
||||||
|
aChain.Append(FirstE);
|
||||||
|
TColStd_MapOfInteger IndUsedEdges;
|
||||||
|
IndUsedEdges.Add(1);
|
||||||
|
Standard_Integer j;
|
||||||
|
for (j = 2; j <= SeqEdges.Length(); j++) {
|
||||||
|
for(Standard_Integer k=2; k<=SeqEdges.Length(); k++) {
|
||||||
|
if(IndUsedEdges.Contains(k)) continue;
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(SeqEdges.Value(k));
|
||||||
|
TopoDS_Vertex VF2 = sae.FirstVertex(edge);
|
||||||
|
TopoDS_Vertex VL2 = sae.LastVertex(edge);
|
||||||
|
if(sae.FirstVertex(edge).IsSame(VL)) {
|
||||||
|
aChain.Append(edge);
|
||||||
|
LastE = edge;
|
||||||
|
VL = sae.LastVertex(LastE);
|
||||||
|
IndUsedEdges.Add(k);
|
||||||
|
}
|
||||||
|
else if(sae.LastVertex(edge).IsSame(VF)) {
|
||||||
|
aChain.Prepend(edge);
|
||||||
|
FirstE = edge;
|
||||||
|
VF = sae.FirstVertex(FirstE);
|
||||||
|
IndUsedEdges.Add(k);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(aChain.Length()<SeqEdges.Length()) {
|
||||||
|
cout<<"can not create correct chain..."<<endl;
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
// union edges in chain
|
||||||
|
// first step: union lines and circles
|
||||||
|
TopLoc_Location Loc;
|
||||||
|
Standard_Real fp1,lp1,fp2,lp2;
|
||||||
|
for (j = 1; j < aChain.Length(); j++) {
|
||||||
|
TopoDS_Edge edge1 = TopoDS::Edge(aChain.Value(j));
|
||||||
|
Handle(Geom_Curve) c3d1 = BRep_Tool::Curve(edge1,Loc,fp1,lp1);
|
||||||
|
if(c3d1.IsNull()) break;
|
||||||
|
while(c3d1->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||||
|
Handle(Geom_TrimmedCurve) tc =
|
||||||
|
Handle(Geom_TrimmedCurve)::DownCast(c3d1);
|
||||||
|
c3d1 = tc->BasisCurve();
|
||||||
|
}
|
||||||
|
TopoDS_Edge edge2 = TopoDS::Edge(aChain.Value(j+1));
|
||||||
|
Handle(Geom_Curve) c3d2 = BRep_Tool::Curve(edge2,Loc,fp2,lp2);
|
||||||
|
if(c3d2.IsNull()) break;
|
||||||
|
while(c3d2->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))) {
|
||||||
|
Handle(Geom_TrimmedCurve) tc =
|
||||||
|
Handle(Geom_TrimmedCurve)::DownCast(c3d2);
|
||||||
|
c3d2 = tc->BasisCurve();
|
||||||
|
}
|
||||||
|
if( c3d1->IsKind(STANDARD_TYPE(Geom_Line)) && c3d2->IsKind(STANDARD_TYPE(Geom_Line)) ) {
|
||||||
|
Handle(Geom_Line) L1 = Handle(Geom_Line)::DownCast(c3d1);
|
||||||
|
Handle(Geom_Line) L2 = Handle(Geom_Line)::DownCast(c3d2);
|
||||||
|
gp_Dir Dir1 = L1->Position().Direction();
|
||||||
|
gp_Dir Dir2 = L2->Position().Direction();
|
||||||
|
if(!Dir1.IsEqual(Dir2,Precision::Angular())) continue;
|
||||||
|
// can union lines => create new edge
|
||||||
|
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
|
||||||
|
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
|
||||||
|
TopoDS_Vertex V2 = sae.LastVertex(edge2);
|
||||||
|
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
|
||||||
|
gp_Vec Vec(PV1,PV2);
|
||||||
|
Handle(Geom_Line) L = new Geom_Line(gp_Ax1(PV1,Vec));
|
||||||
|
Standard_Real dist = PV1.Distance(PV2);
|
||||||
|
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(L,0.0,dist);
|
||||||
|
TopoDS_Edge E;
|
||||||
|
B.MakeEdge (E,tc,Precision::Confusion());
|
||||||
|
B.Add (E,V1); B.Add (E,V2);
|
||||||
|
B.UpdateVertex(V1, 0., E, 0.);
|
||||||
|
B.UpdateVertex(V2, dist, E, 0.);
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
sfe.FixAddPCurve(E,aFace,Standard_False);
|
||||||
|
sfe.FixSameParameter(E);
|
||||||
|
aChain.Remove(j);
|
||||||
|
aChain.SetValue(j,E);
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
if( c3d1->IsKind(STANDARD_TYPE(Geom_Circle)) && c3d2->IsKind(STANDARD_TYPE(Geom_Circle)) ) {
|
||||||
|
Handle(Geom_Circle) C1 = Handle(Geom_Circle)::DownCast(c3d1);
|
||||||
|
Handle(Geom_Circle) C2 = Handle(Geom_Circle)::DownCast(c3d2);
|
||||||
|
gp_Pnt P01 = C1->Location();
|
||||||
|
gp_Pnt P02 = C2->Location();
|
||||||
|
if(P01.Distance(P02)>Precision::Confusion()) continue;
|
||||||
|
// can union circles => create new edge
|
||||||
|
TopoDS_Vertex V1 = sae.FirstVertex(edge1);
|
||||||
|
gp_Pnt PV1 = BRep_Tool::Pnt(V1);
|
||||||
|
TopoDS_Vertex V2 = sae.LastVertex(edge2);
|
||||||
|
gp_Pnt PV2 = BRep_Tool::Pnt(V2);
|
||||||
|
TopoDS_Vertex VM = sae.LastVertex(edge1);
|
||||||
|
gp_Pnt PVM = BRep_Tool::Pnt(VM);
|
||||||
|
GC_MakeCircle MC(PV1,PVM,PV2);
|
||||||
|
Handle(Geom_Circle) C = MC.Value();
|
||||||
|
gp_Pnt P0 = C->Location();
|
||||||
|
gp_Dir D1(gp_Vec(P0,PV1));
|
||||||
|
gp_Dir D2(gp_Vec(P0,PV2));
|
||||||
|
Standard_Real fpar = C->XAxis().Direction().Angle(D1);
|
||||||
|
Standard_Real lpar = C->XAxis().Direction().Angle(D2);
|
||||||
|
Handle(Geom_TrimmedCurve) tc = new Geom_TrimmedCurve(C,fpar,lpar);
|
||||||
|
TopoDS_Edge E;
|
||||||
|
B.MakeEdge (E,tc,Precision::Confusion());
|
||||||
|
B.Add (E,V1); B.Add (E,V2);
|
||||||
|
B.UpdateVertex(V1, fpar, E, 0.);
|
||||||
|
B.UpdateVertex(V2, lpar, E, 0.);
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
sfe.FixAddPCurve(E,aFace,Standard_False);
|
||||||
|
sfe.FixSameParameter(E);
|
||||||
|
aChain.Remove(j);
|
||||||
|
aChain.SetValue(j,E);
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(j<aChain.Length()) {
|
||||||
|
cout<<"null curve3d in edge..."<<endl;
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
if(aChain.Length()>1) {
|
||||||
|
// second step: union edges with various curves
|
||||||
|
cout<<"can not make analitical union => make approximation"<<endl;
|
||||||
|
TopoDS_Wire W;
|
||||||
|
B.MakeWire(W);
|
||||||
|
for(j=1; j<=aChain.Length(); j++) {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(aChain.Value(j));
|
||||||
|
B.Add(W,edge);
|
||||||
|
}
|
||||||
|
Handle(BRepAdaptor_HCompCurve) Adapt = new BRepAdaptor_HCompCurve(W);
|
||||||
|
Approx_Curve3d Conv(Adapt,Tol,GeomAbs_C1,9,1000);
|
||||||
|
Handle(Geom_BSplineCurve) bc = Conv.Curve();
|
||||||
|
TopoDS_Edge E;
|
||||||
|
B.MakeEdge (E,bc,Precision::Confusion());
|
||||||
|
B.Add (E,VF);
|
||||||
|
B.Add (E,VL);
|
||||||
|
//TopLoc_Location L;
|
||||||
|
//Handle(Geom_Surface) aSurf = BRep_Tool::Surface(aFace,L);
|
||||||
|
//ShapeFix_Edge sfe;
|
||||||
|
//if(!L.IsIdentity()) {
|
||||||
|
// TopoDS_Edge aPCEdge = TopoDS::Edge(E.Moved(L.Inverted()));
|
||||||
|
// sfe.FixAddPCurve(aPCEdge,aFace,Standard_False);
|
||||||
|
// Handle(Geom2d_Curve) c2d;
|
||||||
|
// Standard_Real fp,lp;
|
||||||
|
// sae.PCurve(aPCEdge,aFace,c2d,fp,lp);
|
||||||
|
// B.UpdateEdge(E,c2d,aFace,0.);
|
||||||
|
// B.Range(E,aFace,fp,lp);
|
||||||
|
// c2d.Nullify();
|
||||||
|
// B.UpdateEdge(aPCEdge,c2d,aFace,0.);
|
||||||
|
// E = aPCEdge;
|
||||||
|
//}
|
||||||
|
//else {
|
||||||
|
// sfe.FixAddPCurve(E,aFace,Standard_False);
|
||||||
|
//}
|
||||||
|
//sfe.FixSameParameter(E);
|
||||||
|
aChain.SetValue(1,E);
|
||||||
|
}
|
||||||
|
|
||||||
|
anEdge = TopoDS::Edge(aChain.Value(1));
|
||||||
|
return Standard_True;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape BlockFix_UnionEdges::Perform(const TopoDS_Shape& Shape,
|
||||||
|
const Standard_Real Tol)
|
||||||
|
{
|
||||||
|
myContext = new ShapeBuild_ReShape;
|
||||||
|
myTolerance = Tol;
|
||||||
|
TopoDS_Shape aResult = myContext->Apply(Shape);
|
||||||
|
|
||||||
|
TopTools_IndexedMapOfShape ChangedFaces;
|
||||||
|
|
||||||
|
// processing each solid
|
||||||
|
TopExp_Explorer exps;
|
||||||
|
for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
|
||||||
|
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
|
||||||
|
|
||||||
|
// creating map of edge faces
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
||||||
|
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
|
||||||
|
|
||||||
|
// processing each face
|
||||||
|
TopExp_Explorer exp;
|
||||||
|
for(exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(myContext->Apply(exp.Current().Oriented(TopAbs_FORWARD)));
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aMapFacesEdges;
|
||||||
|
|
||||||
|
for(TopExp_Explorer expe(aFace,TopAbs_EDGE); expe.More(); expe.Next()) {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(expe.Current());
|
||||||
|
if(!aMapEdgeFaces.Contains(edge)) continue;
|
||||||
|
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
|
||||||
|
TopTools_ListIteratorOfListOfShape anIter(aList);
|
||||||
|
for( ; anIter.More(); anIter.Next()) {
|
||||||
|
TopoDS_Face face = TopoDS::Face(anIter.Value());
|
||||||
|
TopoDS_Face face1 = TopoDS::Face(myContext->Apply(anIter.Value()));
|
||||||
|
if(face1.IsSame(aFace)) continue;
|
||||||
|
if(aMapFacesEdges.Contains(face)) {
|
||||||
|
aMapFacesEdges.ChangeFromKey(face).Append(edge);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
TopTools_ListOfShape ListEdges;
|
||||||
|
ListEdges.Append(edge);
|
||||||
|
aMapFacesEdges.Add(face,ListEdges);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Standard_Integer i=1; i<=aMapFacesEdges.Extent(); i++) {
|
||||||
|
const TopTools_ListOfShape& ListEdges = aMapFacesEdges.FindFromIndex(i);
|
||||||
|
TopTools_SequenceOfShape SeqEdges;
|
||||||
|
TopTools_ListIteratorOfListOfShape anIter(ListEdges);
|
||||||
|
for( ; anIter.More(); anIter.Next()) {
|
||||||
|
SeqEdges.Append(anIter.Value());
|
||||||
|
}
|
||||||
|
if(SeqEdges.Length()==1) continue;
|
||||||
|
TopoDS_Edge E;
|
||||||
|
if( MergeEdges(SeqEdges,aFace,Tol,E) ) {
|
||||||
|
// now we have only one edge - aChain.Value(1)
|
||||||
|
// we have to replace old ListEdges with this new edge
|
||||||
|
myContext->Replace(SeqEdges(1),E);
|
||||||
|
for(Standard_Integer j=2; j<=SeqEdges.Length(); j++) {
|
||||||
|
myContext->Remove(SeqEdges(j));
|
||||||
|
}
|
||||||
|
TopoDS_Face tmpF = TopoDS::Face(exp.Current());
|
||||||
|
if( !ChangedFaces.Contains(tmpF) )
|
||||||
|
ChangedFaces.Add(tmpF);
|
||||||
|
tmpF = TopoDS::Face(aMapFacesEdges.FindKey(i));
|
||||||
|
if( !ChangedFaces.Contains(tmpF) )
|
||||||
|
ChangedFaces.Add(tmpF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end processing each face
|
||||||
|
|
||||||
|
} // end processing each solid
|
||||||
|
|
||||||
|
for(Standard_Integer i=1; i<=ChangedFaces.Extent(); i++) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(myContext->Apply(ChangedFaces.FindKey(i)));
|
||||||
|
Handle(ShapeFix_Face) sff = new ShapeFix_Face(aFace);
|
||||||
|
sff->SetContext(myContext);
|
||||||
|
sff->SetPrecision(myTolerance);
|
||||||
|
sff->SetMinTolerance(myTolerance);
|
||||||
|
sff->SetMaxTolerance(Max(1.,myTolerance*1000.));
|
||||||
|
sff->Perform();
|
||||||
|
//Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
|
||||||
|
//sfw->SetContext(myContext);
|
||||||
|
//sfw->SetPrecision(myTolerance);
|
||||||
|
//sfw->SetMinTolerance(myTolerance);
|
||||||
|
//sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
|
||||||
|
//sfw->SetFace(aFace);
|
||||||
|
//for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) {
|
||||||
|
// TopoDS_Wire wire = TopoDS::Wire ( iter.Value() );
|
||||||
|
// sfw->Load(wire);
|
||||||
|
// sfw->FixReorder();
|
||||||
|
// sfw->FixShifted();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
aResult = myContext->Apply(Shape);
|
||||||
|
return aResult;
|
||||||
|
}
|
99
src/GEOMAlgo/BlockFix_UnionEdges.hxx
Normal file
99
src/GEOMAlgo/BlockFix_UnionEdges.hxx
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_UnionEdges_HeaderFile
|
||||||
|
#define _BlockFix_UnionEdges_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Handle_ShapeBuild_ReShape_HeaderFile
|
||||||
|
#include <Handle_ShapeBuild_ReShape.hxx>
|
||||||
|
#endif
|
||||||
|
class ShapeBuild_ReShape;
|
||||||
|
class TopoDS_Shape;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class BlockFix_UnionEdges {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_UnionEdges();
|
||||||
|
Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape,const Standard_Real Tol) ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
Handle_ShapeBuild_ReShape myContext;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
26
src/GEOMAlgo/BlockFix_UnionEdges.ixx
Normal file
26
src/GEOMAlgo/BlockFix_UnionEdges.ixx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_UnionEdges.jxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
src/GEOMAlgo/BlockFix_UnionEdges.jxx
Normal file
9
src/GEOMAlgo/BlockFix_UnionEdges.jxx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _ShapeBuild_ReShape_HeaderFile
|
||||||
|
#include <ShapeBuild_ReShape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_UnionEdges_HeaderFile
|
||||||
|
#include <BlockFix_UnionEdges.hxx>
|
||||||
|
#endif
|
46
src/GEOMAlgo/BlockFix_UnionFaces.cdl
Normal file
46
src/GEOMAlgo/BlockFix_UnionFaces.cdl
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
-- File: BlockFix_UnionFaces.cdl
|
||||||
|
-- Created: Tue Dec 7 17:15:42 2004
|
||||||
|
-- Author: Pavel Durandin
|
||||||
|
-- <det@doomox>
|
||||||
|
---Copyright: Open CASCADE SA 2004
|
||||||
|
|
||||||
|
|
||||||
|
class UnionFaces from BlockFix
|
||||||
|
|
||||||
|
uses
|
||||||
|
|
||||||
|
Face from TopoDS,
|
||||||
|
Shape from TopoDS
|
||||||
|
|
||||||
|
is
|
||||||
|
|
||||||
|
Create returns UnionFaces from BlockFix;
|
||||||
|
---Purpose: Empty constructor
|
||||||
|
|
||||||
|
GetTolerance(me: in out) returns Real;
|
||||||
|
---Purpose: Returns modifiable tolerance
|
||||||
|
---C++: return&
|
||||||
|
|
||||||
|
Perform (me: in out; Shape: Shape from TopoDS) returns Shape from TopoDS;
|
||||||
|
---Purpose: Performs the unification of the fsces
|
||||||
|
-- whith the same geometry
|
||||||
|
|
||||||
|
IsSameDomain(me; aFace : Face from TopoDS;
|
||||||
|
aChekedFace: Face from TopoDS)
|
||||||
|
returns Boolean is virtual;
|
||||||
|
---Purpose: Returns true is surfaces have same geometrically domain
|
||||||
|
-- with given tolerance
|
||||||
|
|
||||||
|
MovePCurves(me; aTarget: in out Face from TopoDS;
|
||||||
|
aSource: Face from TopoDS)
|
||||||
|
is virtual;
|
||||||
|
---Purpose: Creates pcurves on aTarget face for each edge from
|
||||||
|
-- aSource one.
|
||||||
|
|
||||||
|
fields
|
||||||
|
|
||||||
|
myTolerance: Real;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
512
src/GEOMAlgo/BlockFix_UnionFaces.cxx
Normal file
512
src/GEOMAlgo/BlockFix_UnionFaces.cxx
Normal file
@ -0,0 +1,512 @@
|
|||||||
|
// File: BlockFix_UnionFaces.cxx
|
||||||
|
// Created: Tue Dec 7 17:15:42 2004
|
||||||
|
// Author: Pavel DURANDIN
|
||||||
|
// Open CASCADE SA 2004
|
||||||
|
|
||||||
|
#include <BlockFix_UnionFaces.ixx>
|
||||||
|
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
|
||||||
|
#include <TopExp.hxx>
|
||||||
|
#include <TopTools_MapOfShape.hxx>
|
||||||
|
#include <ShapeBuild_ReShape.hxx>
|
||||||
|
#include <TopoDS.hxx>
|
||||||
|
#include <TopoDS_Edge.hxx>
|
||||||
|
#include <TopoDS_Wire.hxx>
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#include <TopoDS_Solid.hxx>
|
||||||
|
#include <TopExp_Explorer.hxx>
|
||||||
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#include <Geom_Surface.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <TopTools_ListOfShape.hxx>
|
||||||
|
#include <TopTools_ListIteratorOfListOfShape.hxx>
|
||||||
|
#include <BRep_Builder.hxx>
|
||||||
|
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
#include <ShapeFix_Face.hxx>
|
||||||
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <ShapeExtend_WireData.hxx>
|
||||||
|
#include <ShapeAnalysis_WireOrder.hxx>
|
||||||
|
#include <ShapeAnalysis_Edge.hxx>
|
||||||
|
#include <Geom2d_Line.hxx>
|
||||||
|
#include <gp_XY.hxx>
|
||||||
|
#include <gp_Pnt2d.hxx>
|
||||||
|
#include <ShapeBuild_Edge.hxx>
|
||||||
|
#include <Geom_Curve.hxx>
|
||||||
|
#include <TopoDS_Vertex.hxx>
|
||||||
|
|
||||||
|
#include <ShapeFix_Wire.hxx>
|
||||||
|
#include <ShapeFix_Edge.hxx>
|
||||||
|
|
||||||
|
#include <Geom_RectangularTrimmedSurface.hxx>
|
||||||
|
#include <BRepTools.hxx>
|
||||||
|
|
||||||
|
#include <TColGeom_HArray2OfSurface.hxx>
|
||||||
|
#include <ShapeExtend_CompositeSurface.hxx>
|
||||||
|
#include <ShapeFix_ComposeShell.hxx>
|
||||||
|
#include <TopTools_SequenceOfShape.hxx>
|
||||||
|
#include <ShapeFix_SequenceOfWireSegment.hxx>
|
||||||
|
#include <ShapeFix_WireSegment.hxx>
|
||||||
|
#include <TopoDS_Shell.hxx>
|
||||||
|
#include <TopoDS_Iterator.hxx>
|
||||||
|
|
||||||
|
#include <Geom_CylindricalSurface.hxx>
|
||||||
|
#include <Geom_SphericalSurface.hxx>
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : BlockFix_UnionFaces
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
BlockFix_UnionFaces::BlockFix_UnionFaces()
|
||||||
|
: myTolerance(Precision::Confusion())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : GetTolearnce
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Real& BlockFix_UnionFaces::GetTolerance()
|
||||||
|
{
|
||||||
|
return myTolerance;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : AddOrdinaryEdges
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
// adds edges from the shape to the sequence
|
||||||
|
// seams and equal edges are dropped
|
||||||
|
// Returns true if one of original edges dropped
|
||||||
|
static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges,
|
||||||
|
const TopoDS_Shape aShape,
|
||||||
|
Standard_Integer& anIndex)
|
||||||
|
{
|
||||||
|
//map of edges
|
||||||
|
TopTools_MapOfShape aNewEdges;
|
||||||
|
//add edges without seams
|
||||||
|
for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Shape edge = exp.Current();
|
||||||
|
if(aNewEdges.Contains(edge))
|
||||||
|
aNewEdges.Remove(edge);
|
||||||
|
else
|
||||||
|
aNewEdges.Add(edge);
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Boolean isDropped = Standard_False;
|
||||||
|
//merge edges and drop seams
|
||||||
|
for(Standard_Integer i = 1; i <= edges.Length(); i++) {
|
||||||
|
TopoDS_Shape current = edges(i);
|
||||||
|
if(aNewEdges.Contains(current)) {
|
||||||
|
|
||||||
|
aNewEdges.Remove(current);
|
||||||
|
edges.Remove(i);
|
||||||
|
i--;
|
||||||
|
|
||||||
|
if(!isDropped) {
|
||||||
|
isDropped = Standard_True;
|
||||||
|
anIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//add edges to the sequemce
|
||||||
|
for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next())
|
||||||
|
edges.Append(anIter.Key());
|
||||||
|
|
||||||
|
return isDropped;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : ClearRts
|
||||||
|
//purpose : auxilary
|
||||||
|
//=======================================================================
|
||||||
|
static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface)
|
||||||
|
{
|
||||||
|
if(aSurface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface))) {
|
||||||
|
Handle(Geom_RectangularTrimmedSurface) rts =
|
||||||
|
Handle(Geom_RectangularTrimmedSurface)::DownCast(aSurface);
|
||||||
|
return rts->BasisSurface();
|
||||||
|
}
|
||||||
|
return aSurface;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : Perform
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape)
|
||||||
|
{
|
||||||
|
Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape;
|
||||||
|
TopoDS_Shape aResShape = myContext->Apply(Shape);
|
||||||
|
|
||||||
|
// processing each solid
|
||||||
|
TopExp_Explorer exps;
|
||||||
|
for(exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) {
|
||||||
|
TopoDS_Solid aSolid = TopoDS::Solid(exps.Current());
|
||||||
|
|
||||||
|
// creating map of edge faces
|
||||||
|
TopTools_IndexedDataMapOfShapeListOfShape aMapEdgeFaces;
|
||||||
|
TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
|
||||||
|
|
||||||
|
// map of processed shapes
|
||||||
|
TopTools_MapOfShape aProcessed;
|
||||||
|
|
||||||
|
Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape;
|
||||||
|
|
||||||
|
Standard_Integer NbModif=0;
|
||||||
|
Standard_Boolean hasFailed = Standard_False;
|
||||||
|
Standard_Real tol = Min(Max(Precision::Confusion(), myTolerance/10.),0.1);
|
||||||
|
// processing each face
|
||||||
|
TopExp_Explorer exp;
|
||||||
|
//for( exp.Init(Shape, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
|
for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
|
||||||
|
|
||||||
|
if(aProcessed.Contains(aFace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Standard_Integer dummy;
|
||||||
|
TopTools_SequenceOfShape edges;
|
||||||
|
AddOrdinaryEdges(edges,aFace,dummy);
|
||||||
|
|
||||||
|
TopTools_SequenceOfShape faces;
|
||||||
|
faces.Append(aFace);
|
||||||
|
|
||||||
|
//surface and location to construct result
|
||||||
|
TopLoc_Location aBaseLocation;
|
||||||
|
Handle(Geom_Surface) aBaseSurface = BRep_Tool::Surface(aFace,aBaseLocation);
|
||||||
|
aBaseSurface = ClearRts(aBaseSurface);
|
||||||
|
|
||||||
|
// find adjacent faces to union
|
||||||
|
Standard_Integer i;
|
||||||
|
for( i = 1; i <= edges.Length(); i++) {
|
||||||
|
TopoDS_Edge edge = TopoDS::Edge(edges(i));
|
||||||
|
if(BRep_Tool::Degenerated(edge))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge);
|
||||||
|
TopTools_ListIteratorOfListOfShape anIter(aList);
|
||||||
|
for( ; anIter.More(); anIter.Next()) {
|
||||||
|
TopoDS_Face anCheckedFace = TopoDS::Face(anIter.Value().Oriented(TopAbs_FORWARD));
|
||||||
|
if(anCheckedFace.IsSame(aFace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(aProcessed.Contains(anCheckedFace))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(IsSameDomain(aFace,anCheckedFace)) {
|
||||||
|
|
||||||
|
if(aList.Extent() != 2) {
|
||||||
|
// non mainfold case is not processed
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// replacing pcurves
|
||||||
|
TopoDS_Face aMockUpFace;
|
||||||
|
BRep_Builder B;
|
||||||
|
B.MakeFace(aMockUpFace,aBaseSurface,aBaseLocation,0.);
|
||||||
|
MovePCurves(aMockUpFace,anCheckedFace);
|
||||||
|
|
||||||
|
if(AddOrdinaryEdges(edges,aMockUpFace,dummy)) {
|
||||||
|
// sequence edges is modified
|
||||||
|
i = dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
faces.Append(anCheckedFace);
|
||||||
|
aProcessed.Add(anCheckedFace);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// all faces collected in the sequence. Perform union of faces
|
||||||
|
if(faces.Length() > 1) {
|
||||||
|
NbModif++;
|
||||||
|
TopoDS_Face aResult;
|
||||||
|
BRep_Builder B;
|
||||||
|
B.MakeFace(aResult,aBaseSurface,aBaseLocation,0);
|
||||||
|
Standard_Integer nbWires = 0;
|
||||||
|
|
||||||
|
// connecting wires
|
||||||
|
while(edges.Length()>0) {
|
||||||
|
|
||||||
|
Standard_Boolean isEdge3d = Standard_False;
|
||||||
|
nbWires++;
|
||||||
|
TopTools_MapOfShape aVertices;
|
||||||
|
TopoDS_Wire aWire;
|
||||||
|
B.MakeWire(aWire);
|
||||||
|
|
||||||
|
TopoDS_Edge anEdge = TopoDS::Edge(edges(1));
|
||||||
|
edges.Remove(1);
|
||||||
|
|
||||||
|
isEdge3d |= !BRep_Tool::Degenerated(anEdge);
|
||||||
|
B.Add(aWire,anEdge);
|
||||||
|
TopoDS_Vertex V1,V2;
|
||||||
|
TopExp::Vertices(anEdge,V1,V2);
|
||||||
|
aVertices.Add(V1);
|
||||||
|
aVertices.Add(V2);
|
||||||
|
|
||||||
|
Standard_Boolean isNewFound = Standard_False;
|
||||||
|
do {
|
||||||
|
isNewFound = Standard_False;
|
||||||
|
for(Standard_Integer j = 1; j <= edges.Length(); j++) {
|
||||||
|
anEdge = TopoDS::Edge(edges(j));
|
||||||
|
TopExp::Vertices(anEdge,V1,V2);
|
||||||
|
if(aVertices.Contains(V1) || aVertices.Contains(V2)) {
|
||||||
|
isEdge3d |= !BRep_Tool::Degenerated(anEdge);
|
||||||
|
aVertices.Add(V1);
|
||||||
|
aVertices.Add(V2);
|
||||||
|
B.Add(aWire,anEdge);
|
||||||
|
edges.Remove(j);
|
||||||
|
j--;
|
||||||
|
isNewFound = Standard_True;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (isNewFound);
|
||||||
|
|
||||||
|
// sorting eny type of edges
|
||||||
|
aWire = TopoDS::Wire(aContext->Apply(aWire));
|
||||||
|
|
||||||
|
TopoDS_Face tmpF = TopoDS::Face(aContext->Apply(faces(1).Oriented(TopAbs_FORWARD)));
|
||||||
|
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(aWire,tmpF,Precision::Confusion());
|
||||||
|
sfw->FixReorder();
|
||||||
|
Standard_Boolean isDegRemoved = Standard_False;
|
||||||
|
if(!sfw->StatusReorder ( ShapeExtend_FAIL )) {
|
||||||
|
// clear degenerated edges if at least one with 3d curve exist
|
||||||
|
if(isEdge3d) {
|
||||||
|
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
|
||||||
|
for(Standard_Integer j = 1; j<=sewd->NbEdges();j++) {
|
||||||
|
TopoDS_Edge E = sewd->Edge(j);
|
||||||
|
if(BRep_Tool::Degenerated(E)) {
|
||||||
|
sewd->Remove(j);
|
||||||
|
isDegRemoved = Standard_True;
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sfw->FixShifted();
|
||||||
|
if(isDegRemoved)
|
||||||
|
sfw->FixDegenerated();
|
||||||
|
}
|
||||||
|
TopoDS_Wire aWireFixed = sfw->Wire();
|
||||||
|
aContext->Replace(aWire,aWireFixed);
|
||||||
|
// add resulting wire
|
||||||
|
if(isEdge3d) {
|
||||||
|
B.Add(aResult,aWireFixed);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// sorting edges
|
||||||
|
Handle(ShapeExtend_WireData) sbwd = sfw->WireData();
|
||||||
|
Standard_Integer nbEdges = sbwd->NbEdges();
|
||||||
|
// sort degenerated edges and create one edge instead of several ones
|
||||||
|
ShapeAnalysis_WireOrder sawo(Standard_False, 0);
|
||||||
|
ShapeAnalysis_Edge sae;
|
||||||
|
Standard_Integer aLastEdge = nbEdges;
|
||||||
|
for(Standard_Integer j = 1; j <= nbEdges; j++) {
|
||||||
|
Standard_Real f,l;
|
||||||
|
//smh protection on NULL pcurve
|
||||||
|
Handle(Geom2d_Curve) c2d;
|
||||||
|
if(!sae.PCurve(sbwd->Edge(j),tmpF,c2d,f,l)) {
|
||||||
|
aLastEdge--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sawo.Add(c2d->Value(f).XY(),c2d->Value(l).XY());
|
||||||
|
}
|
||||||
|
sawo.Perform();
|
||||||
|
|
||||||
|
// constructind one degenerative edge
|
||||||
|
gp_XY aStart, anEnd, tmp;
|
||||||
|
Standard_Integer nbFirst = sawo.Ordered(1);
|
||||||
|
TopoDS_Edge anOrigE = TopoDS::Edge(sbwd->Edge(nbFirst).Oriented(TopAbs_FORWARD));
|
||||||
|
ShapeBuild_Edge sbe;
|
||||||
|
TopoDS_Vertex aDummyV;
|
||||||
|
TopoDS_Edge E = sbe.CopyReplaceVertices(anOrigE,aDummyV,aDummyV);
|
||||||
|
sawo.XY(nbFirst,aStart,tmp);
|
||||||
|
sawo.XY(sawo.Ordered(aLastEdge),tmp,anEnd);
|
||||||
|
|
||||||
|
gp_XY aVec = anEnd-aStart;
|
||||||
|
Handle(Geom2d_Line) aLine = new Geom2d_Line(aStart,gp_Dir2d(anEnd-aStart));
|
||||||
|
|
||||||
|
B.UpdateEdge(E,aLine,tmpF,0.);
|
||||||
|
B.Range(E,tmpF,0.,aVec.Modulus());
|
||||||
|
Handle(Geom_Curve) C3d;
|
||||||
|
B.UpdateEdge(E,C3d,0.);
|
||||||
|
B.Degenerated(E,Standard_True);
|
||||||
|
TopoDS_Wire aW;
|
||||||
|
B.MakeWire(aW);
|
||||||
|
B.Add(aW,E);
|
||||||
|
B.Add(aResult,aW);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// perform substitution of face
|
||||||
|
aContext->Replace(aContext->Apply(aFace),aResult);
|
||||||
|
|
||||||
|
|
||||||
|
ShapeFix_Face sff (aResult);
|
||||||
|
//Intializing by tolerances
|
||||||
|
sff.SetPrecision(myTolerance);
|
||||||
|
sff.SetMinTolerance(tol);
|
||||||
|
sff.SetMaxTolerance(Max(1.,myTolerance*1000.));
|
||||||
|
//Setting modes
|
||||||
|
sff.FixOrientationMode() = 0;
|
||||||
|
//sff.FixWireMode() = 0;
|
||||||
|
sff.SetContext(aContext);
|
||||||
|
// Applying the fixes
|
||||||
|
sff.Perform();
|
||||||
|
if(sff.Status(ShapeExtend_FAIL))
|
||||||
|
hasFailed = Standard_True;
|
||||||
|
|
||||||
|
// breaking down to several faces
|
||||||
|
TopoDS_Shape theResult = aContext->Apply(aResult);
|
||||||
|
for(TopExp_Explorer aFaceExp(theResult,TopAbs_FACE);aFaceExp.More();aFaceExp.Next()) {
|
||||||
|
TopoDS_Face aCurrent = TopoDS::Face(aFaceExp.Current().Oriented(TopAbs_FORWARD));
|
||||||
|
Handle(TColGeom_HArray2OfSurface) grid = new TColGeom_HArray2OfSurface ( 1, 1, 1, 1 );
|
||||||
|
grid->SetValue ( 1, 1, aBaseSurface );
|
||||||
|
Handle(ShapeExtend_CompositeSurface) G = new ShapeExtend_CompositeSurface ( grid );
|
||||||
|
ShapeFix_ComposeShell CompShell;
|
||||||
|
CompShell.Init ( G, aBaseLocation, aCurrent, ::Precision::Confusion() );//myPrecision
|
||||||
|
CompShell.SetContext( aContext );
|
||||||
|
|
||||||
|
TopTools_SequenceOfShape parts;
|
||||||
|
ShapeFix_SequenceOfWireSegment wires;
|
||||||
|
for(TopExp_Explorer W_Exp(aCurrent,TopAbs_WIRE);W_Exp.More();W_Exp.Next()) {
|
||||||
|
Handle(ShapeExtend_WireData) sbwd =
|
||||||
|
new ShapeExtend_WireData ( TopoDS::Wire(W_Exp.Current() ));
|
||||||
|
ShapeFix_WireSegment seg ( sbwd, TopAbs_REVERSED );
|
||||||
|
wires.Append(seg);
|
||||||
|
}
|
||||||
|
|
||||||
|
CompShell.DispatchWires ( parts,wires );
|
||||||
|
for (Standard_Integer j=1; j <= parts.Length(); j++ ) {
|
||||||
|
ShapeFix_Face aFixOrient(TopoDS::Face(parts(j)));
|
||||||
|
aFixOrient.SetContext(aContext);
|
||||||
|
aFixOrient.FixOrientation();
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Shape CompRes;
|
||||||
|
if ( faces.Length() !=1 ) {
|
||||||
|
TopoDS_Shell S;
|
||||||
|
B.MakeShell ( S );
|
||||||
|
for ( i=1; i <= parts.Length(); i++ )
|
||||||
|
B.Add ( S, parts(i) );
|
||||||
|
CompRes = S;
|
||||||
|
}
|
||||||
|
else CompRes = parts(1);
|
||||||
|
|
||||||
|
aContext->Replace(aCurrent,CompRes);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the remaining faces
|
||||||
|
for(i = 2; i <= faces.Length(); i++)
|
||||||
|
aContext->Remove(faces(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//TopoDS_Shape aResult = Shape;
|
||||||
|
if(NbModif>0) {
|
||||||
|
TopoDS_Shape aResult = aSolid;
|
||||||
|
if(!hasFailed) {
|
||||||
|
aResult = aContext->Apply(aSolid);
|
||||||
|
|
||||||
|
ShapeFix_Edge sfe;
|
||||||
|
for(exp.Init(aResult,TopAbs_EDGE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Edge E = TopoDS::Edge(exp.Current());
|
||||||
|
sfe.FixVertexTolerance (E);
|
||||||
|
// ptv add fix same parameter
|
||||||
|
sfe.FixSameParameter(E, myTolerance);
|
||||||
|
}
|
||||||
|
|
||||||
|
myContext->Replace(aSolid,aResult);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for( exp.Init(aSolid, TopAbs_FACE); exp.More(); exp.Next()) {
|
||||||
|
TopoDS_Face aFace = TopoDS::Face(exp.Current().Oriented(TopAbs_FORWARD));
|
||||||
|
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
|
||||||
|
sfw->SetContext(myContext);
|
||||||
|
sfw->SetPrecision(myTolerance);
|
||||||
|
sfw->SetMinTolerance(myTolerance);
|
||||||
|
sfw->SetMaxTolerance(Max(1.,myTolerance*1000.));
|
||||||
|
sfw->SetFace(aFace);
|
||||||
|
for ( TopoDS_Iterator iter(aFace,Standard_False); iter.More(); iter.Next()) {
|
||||||
|
TopoDS_Wire wire = TopoDS::Wire ( iter.Value() );
|
||||||
|
sfw->Load(wire);
|
||||||
|
sfw->FixReorder();
|
||||||
|
sfw->FixShifted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end processing each solid
|
||||||
|
|
||||||
|
aResShape = myContext->Apply(Shape);
|
||||||
|
return aResShape;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : IsSameDomain
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
Standard_Boolean BlockFix_UnionFaces::IsSameDomain(const TopoDS_Face& aFace,
|
||||||
|
const TopoDS_Face& aCheckedFace) const
|
||||||
|
{
|
||||||
|
//checking the same handless
|
||||||
|
TopLoc_Location L1, L2;
|
||||||
|
Handle(Geom_Surface) S1, S2;
|
||||||
|
|
||||||
|
S1 = BRep_Tool::Surface(aFace,L1);
|
||||||
|
S2 = BRep_Tool::Surface(aCheckedFace,L2);
|
||||||
|
|
||||||
|
return (S1 == S2 && L1 == L2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : MovePCurves
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
void BlockFix_UnionFaces::MovePCurves(TopoDS_Face& aTarget,
|
||||||
|
const TopoDS_Face& aSource) const
|
||||||
|
{
|
||||||
|
BRep_Builder B;
|
||||||
|
for(TopExp_Explorer wexp(aSource,TopAbs_WIRE);wexp.More();wexp.Next()) {
|
||||||
|
Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire(TopoDS::Wire(wexp.Current()),
|
||||||
|
aTarget, Precision::Confusion());
|
||||||
|
sfw->FixReorder();
|
||||||
|
Standard_Boolean isReoredFailed = sfw->StatusReorder ( ShapeExtend_FAIL );
|
||||||
|
sfw->FixEdgeCurves();
|
||||||
|
if(isReoredFailed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
sfw->FixShifted();
|
||||||
|
sfw->FixDegenerated();
|
||||||
|
|
||||||
|
// remove degenerated edges from not degenerated points
|
||||||
|
ShapeAnalysis_Edge sae;
|
||||||
|
Handle(ShapeExtend_WireData) sewd = sfw->WireData();
|
||||||
|
for(Standard_Integer i = 1; i<=sewd->NbEdges();i++) {
|
||||||
|
TopoDS_Edge E = sewd->Edge(i);
|
||||||
|
if(BRep_Tool::Degenerated(E)&&!sae.HasPCurve(E,aTarget)) {
|
||||||
|
sewd->Remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Wire ResWire = sfw->Wire();
|
||||||
|
B.Add(aTarget,ResWire);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
101
src/GEOMAlgo/BlockFix_UnionFaces.hxx
Normal file
101
src/GEOMAlgo/BlockFix_UnionFaces.hxx
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _BlockFix_UnionFaces_HeaderFile
|
||||||
|
#define _BlockFix_UnionFaces_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Real_HeaderFile
|
||||||
|
#include <Standard_Real.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Boolean_HeaderFile
|
||||||
|
#include <Standard_Boolean.hxx>
|
||||||
|
#endif
|
||||||
|
class TopoDS_Shape;
|
||||||
|
class TopoDS_Face;
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class BlockFix_UnionFaces {
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
// Methods PUBLIC
|
||||||
|
//
|
||||||
|
Standard_EXPORT BlockFix_UnionFaces();
|
||||||
|
Standard_EXPORT Standard_Real& GetTolerance() ;
|
||||||
|
Standard_EXPORT TopoDS_Shape Perform(const TopoDS_Shape& Shape) ;
|
||||||
|
Standard_EXPORT virtual Standard_Boolean IsSameDomain(const TopoDS_Face& aFace,const TopoDS_Face& aChekedFace) const;
|
||||||
|
Standard_EXPORT virtual void MovePCurves(TopoDS_Face& aTarget,const TopoDS_Face& aSource) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Methods PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PROTECTED
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Methods PRIVATE
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
// Fields PRIVATE
|
||||||
|
//
|
||||||
|
Standard_Real myTolerance;
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// other Inline functions and methods (like "C++: function call" methods)
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
26
src/GEOMAlgo/BlockFix_UnionFaces.ixx
Normal file
26
src/GEOMAlgo/BlockFix_UnionFaces.ixx
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// File generated by CPPExt (Value)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#include <BlockFix_UnionFaces.jxx>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
9
src/GEOMAlgo/BlockFix_UnionFaces.jxx
Normal file
9
src/GEOMAlgo/BlockFix_UnionFaces.jxx
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#ifndef _TopoDS_Shape_HeaderFile
|
||||||
|
#include <TopoDS_Shape.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _TopoDS_Face_HeaderFile
|
||||||
|
#include <TopoDS_Face.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _BlockFix_UnionFaces_HeaderFile
|
||||||
|
#include <BlockFix_UnionFaces.hxx>
|
||||||
|
#endif
|
91
src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx
Normal file
91
src/GEOMAlgo/Handle_BlockFix_BlockFixAPI.hxx
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _Handle_BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
#define _Handle_BlockFix_BlockFixAPI_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Handle_MMgt_TShared_HeaderFile
|
||||||
|
#include <Handle_MMgt_TShared.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Standard_Transient;
|
||||||
|
class Handle_Standard_Type;
|
||||||
|
class Handle(MMgt_TShared);
|
||||||
|
class BlockFix_BlockFixAPI;
|
||||||
|
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_BlockFixAPI);
|
||||||
|
|
||||||
|
class Handle(BlockFix_BlockFixAPI) : public Handle(MMgt_TShared) {
|
||||||
|
public:
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
Handle(BlockFix_BlockFixAPI)():Handle(MMgt_TShared)() {}
|
||||||
|
Handle(BlockFix_BlockFixAPI)(const Handle(BlockFix_BlockFixAPI)& aHandle) : Handle(MMgt_TShared)(aHandle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_BlockFixAPI)(const BlockFix_BlockFixAPI* anItem) : Handle(MMgt_TShared)((MMgt_TShared *)anItem)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_BlockFixAPI)& operator=(const Handle(BlockFix_BlockFixAPI)& aHandle)
|
||||||
|
{
|
||||||
|
Assign(aHandle.Access());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_BlockFixAPI)& operator=(const BlockFix_BlockFixAPI* anItem)
|
||||||
|
{
|
||||||
|
Assign((Standard_Transient *)anItem);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_BlockFixAPI* operator->()
|
||||||
|
{
|
||||||
|
return (BlockFix_BlockFixAPI *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_BlockFixAPI* operator->() const
|
||||||
|
{
|
||||||
|
return (BlockFix_BlockFixAPI *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_EXPORT ~Handle(BlockFix_BlockFixAPI)();
|
||||||
|
|
||||||
|
Standard_EXPORT static const Handle(BlockFix_BlockFixAPI) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||||
|
};
|
||||||
|
#endif
|
91
src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx
Normal file
91
src/GEOMAlgo/Handle_BlockFix_PeriodicSurfaceModifier.hxx
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
#define _Handle_BlockFix_PeriodicSurfaceModifier_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Handle_BRepTools_Modification_HeaderFile
|
||||||
|
#include <Handle_BRepTools_Modification.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Standard_Transient;
|
||||||
|
class Handle_Standard_Type;
|
||||||
|
class Handle(BRepTools_Modification);
|
||||||
|
class BlockFix_PeriodicSurfaceModifier;
|
||||||
|
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_PeriodicSurfaceModifier);
|
||||||
|
|
||||||
|
class Handle(BlockFix_PeriodicSurfaceModifier) : public Handle(BRepTools_Modification) {
|
||||||
|
public:
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier)():Handle(BRepTools_Modification)() {}
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier)(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier)(const BlockFix_PeriodicSurfaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const Handle(BlockFix_PeriodicSurfaceModifier)& aHandle)
|
||||||
|
{
|
||||||
|
Assign(aHandle.Access());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_PeriodicSurfaceModifier)& operator=(const BlockFix_PeriodicSurfaceModifier* anItem)
|
||||||
|
{
|
||||||
|
Assign((Standard_Transient *)anItem);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_PeriodicSurfaceModifier* operator->()
|
||||||
|
{
|
||||||
|
return (BlockFix_PeriodicSurfaceModifier *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_PeriodicSurfaceModifier* operator->() const
|
||||||
|
{
|
||||||
|
return (BlockFix_PeriodicSurfaceModifier *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_EXPORT ~Handle(BlockFix_PeriodicSurfaceModifier)();
|
||||||
|
|
||||||
|
Standard_EXPORT static const Handle(BlockFix_PeriodicSurfaceModifier) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||||
|
};
|
||||||
|
#endif
|
91
src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx
Normal file
91
src/GEOMAlgo/Handle_BlockFix_SphereSpaceModifier.hxx
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
// File generated by CPPExt (Transient)
|
||||||
|
//
|
||||||
|
// Copyright (C) 1991 - 2000 by
|
||||||
|
// Matra Datavision SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2001 - 2004 by
|
||||||
|
// Open CASCADE SA. All rights reserved.
|
||||||
|
//
|
||||||
|
// This file is part of the Open CASCADE Technology software.
|
||||||
|
//
|
||||||
|
// This software may be distributed and/or modified under the terms and
|
||||||
|
// conditions of the Open CASCADE Public License as defined by Open CASCADE SA
|
||||||
|
// and appearing in the file LICENSE included in the packaging of this file.
|
||||||
|
//
|
||||||
|
// This software is distributed on an "AS IS" basis, without warranty of any
|
||||||
|
// kind, and Open CASCADE SA hereby disclaims all such warranties,
|
||||||
|
// including without limitation, any warranties of merchantability, fitness
|
||||||
|
// for a particular purpose or non-infringement. Please see the License for
|
||||||
|
// the specific terms and conditions governing rights and limitations under the
|
||||||
|
// License.
|
||||||
|
|
||||||
|
#ifndef _Handle_BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
#define _Handle_BlockFix_SphereSpaceModifier_HeaderFile
|
||||||
|
|
||||||
|
#ifndef _Standard_Macro_HeaderFile
|
||||||
|
#include <Standard_Macro.hxx>
|
||||||
|
#endif
|
||||||
|
#ifndef _Standard_HeaderFile
|
||||||
|
#include <Standard.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _Handle_BRepTools_Modification_HeaderFile
|
||||||
|
#include <Handle_BRepTools_Modification.hxx>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Standard_Transient;
|
||||||
|
class Handle_Standard_Type;
|
||||||
|
class Handle(BRepTools_Modification);
|
||||||
|
class BlockFix_SphereSpaceModifier;
|
||||||
|
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(BlockFix_SphereSpaceModifier);
|
||||||
|
|
||||||
|
class Handle(BlockFix_SphereSpaceModifier) : public Handle(BRepTools_Modification) {
|
||||||
|
public:
|
||||||
|
void* operator new(size_t,void* anAddress)
|
||||||
|
{
|
||||||
|
return anAddress;
|
||||||
|
}
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return Standard::Allocate(size);
|
||||||
|
}
|
||||||
|
void operator delete(void *anAddress)
|
||||||
|
{
|
||||||
|
if (anAddress) Standard::Free((Standard_Address&)anAddress);
|
||||||
|
}
|
||||||
|
Handle(BlockFix_SphereSpaceModifier)():Handle(BRepTools_Modification)() {}
|
||||||
|
Handle(BlockFix_SphereSpaceModifier)(const Handle(BlockFix_SphereSpaceModifier)& aHandle) : Handle(BRepTools_Modification)(aHandle)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_SphereSpaceModifier)(const BlockFix_SphereSpaceModifier* anItem) : Handle(BRepTools_Modification)((BRepTools_Modification *)anItem)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_SphereSpaceModifier)& operator=(const Handle(BlockFix_SphereSpaceModifier)& aHandle)
|
||||||
|
{
|
||||||
|
Assign(aHandle.Access());
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
Handle(BlockFix_SphereSpaceModifier)& operator=(const BlockFix_SphereSpaceModifier* anItem)
|
||||||
|
{
|
||||||
|
Assign((Standard_Transient *)anItem);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_SphereSpaceModifier* operator->()
|
||||||
|
{
|
||||||
|
return (BlockFix_SphereSpaceModifier *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFix_SphereSpaceModifier* operator->() const
|
||||||
|
{
|
||||||
|
return (BlockFix_SphereSpaceModifier *)ControlAccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_EXPORT ~Handle(BlockFix_SphereSpaceModifier)();
|
||||||
|
|
||||||
|
Standard_EXPORT static const Handle(BlockFix_SphereSpaceModifier) DownCast(const Handle(Standard_Transient)& AnObject);
|
||||||
|
};
|
||||||
|
#endif
|
@ -52,7 +52,14 @@ LIB_SRC = \
|
|||||||
GEOMAlgo_PassKey.cxx \
|
GEOMAlgo_PassKey.cxx \
|
||||||
GEOMAlgo_PassKeyMapHasher.cxx \
|
GEOMAlgo_PassKeyMapHasher.cxx \
|
||||||
GEOMAlgo_ShapeAlgo.cxx \
|
GEOMAlgo_ShapeAlgo.cxx \
|
||||||
GEOMAlgo_Tools.cxx
|
GEOMAlgo_Tools.cxx \
|
||||||
|
BlockFix.cxx \
|
||||||
|
BlockFix_BlockFixAPI.cxx \
|
||||||
|
BlockFix_CheckTool.cxx \
|
||||||
|
BlockFix_PeriodicSurfaceModifier.cxx \
|
||||||
|
BlockFix_SphereSpaceModifier.cxx \
|
||||||
|
BlockFix_UnionEdges.cxx \
|
||||||
|
BlockFix_UnionFaces.cxx
|
||||||
|
|
||||||
LIB_CLIENT_IDL =
|
LIB_CLIENT_IDL =
|
||||||
LIB_SERVER_IDL =
|
LIB_SERVER_IDL =
|
||||||
@ -66,7 +73,11 @@ EXPORT_HEADERS = \
|
|||||||
GEOMAlgo_CoupleOfShapes.hxx \
|
GEOMAlgo_CoupleOfShapes.hxx \
|
||||||
GEOMAlgo_ListOfCoupleOfShapes.hxx \
|
GEOMAlgo_ListOfCoupleOfShapes.hxx \
|
||||||
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \
|
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx \
|
||||||
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx
|
Handle_GEOMAlgo_ListNodeOfListOfCoupleOfShapes.hxx \
|
||||||
|
BlockFix_BlockFixAPI.hxx \
|
||||||
|
BlockFix_CheckTool.hxx \
|
||||||
|
Handle_BlockFix_BlockFixAPI.hxx \
|
||||||
|
BlockFix_BlockFixAPI.lxx
|
||||||
|
|
||||||
# idl files
|
# idl files
|
||||||
EXPORT_IDLS=
|
EXPORT_IDLS=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user