File indexing completed on 2026-11-22 10:19:15
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef _BRepBuilderAPI_Sewing_HeaderFile
0018 #define _BRepBuilderAPI_Sewing_HeaderFile
0019
0020 #include <Standard.hxx>
0021 #include <Standard_Type.hxx>
0022
0023 #include <TopoDS_Shape.hxx>
0024 #include <TopTools_ShapeMapHasher.hxx>
0025 #include <NCollection_IndexedDataMap.hxx>
0026 #include <NCollection_IndexedMap.hxx>
0027 #include <NCollection_List.hxx>
0028 #include <NCollection_DataMap.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <NCollection_Map.hxx>
0031 #include <Standard_Transient.hxx>
0032 #include <NCollection_Sequence.hxx>
0033 #include <NCollection_Array1.hxx>
0034 #include <gp_Pnt.hxx>
0035
0036 #include <Message_ProgressRange.hxx>
0037
0038 class BRepTools_ReShape;
0039 class TopoDS_Edge;
0040 class TopoDS_Face;
0041 class Geom_Surface;
0042 class TopLoc_Location;
0043 class Geom2d_Curve;
0044 class Geom_Curve;
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068 class BRepBuilderAPI_Sewing : public Standard_Transient
0069 {
0070
0071 public:
0072
0073
0074
0075
0076
0077
0078 Standard_EXPORT BRepBuilderAPI_Sewing(const double tolerance = 1.0e-06,
0079 const bool option1 = true,
0080 const bool option2 = true,
0081 const bool option3 = true,
0082 const bool option4 = false);
0083
0084
0085 Standard_EXPORT void Init(const double tolerance = 1.0e-06,
0086 const bool option1 = true,
0087 const bool option2 = true,
0088 const bool option3 = true,
0089 const bool option4 = false);
0090
0091
0092 Standard_EXPORT void Load(const TopoDS_Shape& shape);
0093
0094
0095 Standard_EXPORT void Add(const TopoDS_Shape& shape);
0096
0097
0098
0099 Standard_EXPORT void Perform(const Message_ProgressRange& theProgress = Message_ProgressRange());
0100
0101
0102
0103
0104 Standard_EXPORT const TopoDS_Shape& SewedShape() const;
0105
0106
0107 Standard_EXPORT void SetContext(const occ::handle<BRepTools_ReShape>& theContext);
0108
0109
0110 Standard_EXPORT const occ::handle<BRepTools_ReShape>& GetContext() const;
0111
0112
0113 Standard_EXPORT int NbFreeEdges() const;
0114
0115
0116 Standard_EXPORT const TopoDS_Edge& FreeEdge(const int index) const;
0117
0118
0119
0120 Standard_EXPORT int NbMultipleEdges() const;
0121
0122
0123 Standard_EXPORT const TopoDS_Edge& MultipleEdge(const int index) const;
0124
0125
0126 Standard_EXPORT int NbContigousEdges() const;
0127
0128
0129 Standard_EXPORT const TopoDS_Edge& ContigousEdge(const int index) const;
0130
0131
0132 Standard_EXPORT const NCollection_List<TopoDS_Shape>& ContigousEdgeCouple(const int index) const;
0133
0134
0135 Standard_EXPORT bool IsSectionBound(const TopoDS_Edge& section) const;
0136
0137
0138
0139
0140
0141
0142 Standard_EXPORT const TopoDS_Edge& SectionToBoundary(const TopoDS_Edge& section) const;
0143
0144
0145 Standard_EXPORT int NbDegeneratedShapes() const;
0146
0147
0148 Standard_EXPORT const TopoDS_Shape& DegeneratedShape(const int index) const;
0149
0150
0151 Standard_EXPORT bool IsDegenerated(const TopoDS_Shape& shape) const;
0152
0153
0154 Standard_EXPORT bool IsModified(const TopoDS_Shape& shape) const;
0155
0156
0157 Standard_EXPORT const TopoDS_Shape& Modified(const TopoDS_Shape& shape) const;
0158
0159
0160 Standard_EXPORT bool IsModifiedSubShape(const TopoDS_Shape& shape) const;
0161
0162
0163 Standard_EXPORT TopoDS_Shape ModifiedSubShape(const TopoDS_Shape& shape) const;
0164
0165
0166 Standard_EXPORT void Dump() const;
0167
0168
0169 Standard_EXPORT int NbDeletedFaces() const;
0170
0171
0172 Standard_EXPORT const TopoDS_Face& DeletedFace(const int index) const;
0173
0174
0175 Standard_EXPORT TopoDS_Face WhichFace(const TopoDS_Edge& theEdg, const int index = 1) const;
0176
0177
0178 bool SameParameterMode() const;
0179
0180
0181 void SetSameParameterMode(const bool SameParameterMode);
0182
0183
0184 double Tolerance() const;
0185
0186
0187 void SetTolerance(const double theToler);
0188
0189
0190 double MinTolerance() const;
0191
0192
0193 void SetMinTolerance(const double theMinToler);
0194
0195
0196 double MaxTolerance() const;
0197
0198
0199 void SetMaxTolerance(const double theMaxToler);
0200
0201
0202 bool FaceMode() const;
0203
0204
0205 void SetFaceMode(const bool theFaceMode);
0206
0207
0208 bool FloatingEdgesMode() const;
0209
0210
0211
0212
0213 void SetFloatingEdgesMode(const bool theFloatingEdgesMode);
0214
0215
0216
0217 bool LocalTolerancesMode() const;
0218
0219
0220
0221
0222 void SetLocalTolerancesMode(const bool theLocalTolerancesMode);
0223
0224
0225 void SetNonManifoldMode(const bool theNonManifoldMode);
0226
0227
0228
0229
0230 bool NonManifoldMode() const;
0231
0232 DEFINE_STANDARD_RTTIEXT(BRepBuilderAPI_Sewing, Standard_Transient)
0233
0234 protected:
0235
0236
0237 Standard_EXPORT void Cutting(const Message_ProgressRange& theProgress = Message_ProgressRange());
0238
0239 Standard_EXPORT void Merging(const bool passage,
0240 const Message_ProgressRange& theProgress = Message_ProgressRange());
0241
0242 Standard_EXPORT bool IsMergedClosed(const TopoDS_Edge& Edge1,
0243 const TopoDS_Edge& Edge2,
0244 const TopoDS_Face& fase) const;
0245
0246 Standard_EXPORT bool FindCandidates(NCollection_Sequence<TopoDS_Shape>& seqSections,
0247 NCollection_IndexedMap<int>& mapReference,
0248 NCollection_Sequence<int>& seqCandidates,
0249 NCollection_Sequence<bool>& seqOrientations);
0250
0251 Standard_EXPORT void AnalysisNearestEdges(const NCollection_Sequence<TopoDS_Shape>& sequenceSec,
0252 NCollection_Sequence<int>& seqIndCandidate,
0253 NCollection_Sequence<bool>& seqOrientations,
0254 const bool evalDist = true);
0255
0256
0257 Standard_EXPORT bool MergedNearestEdges(const TopoDS_Shape& edge,
0258 NCollection_Sequence<TopoDS_Shape>& SeqMergedEdge,
0259 NCollection_Sequence<bool>& SeqMergedOri);
0260
0261 Standard_EXPORT void EdgeProcessing(
0262 const Message_ProgressRange& theProgress = Message_ProgressRange());
0263
0264
0265 Standard_EXPORT void EdgeRegularity(
0266 const Message_ProgressRange& theProgress = Message_ProgressRange());
0267
0268 Standard_EXPORT void CreateOutputInformations();
0269
0270
0271 Standard_EXPORT virtual bool IsUClosedSurface(const occ::handle<Geom_Surface>& surf,
0272 const TopoDS_Shape& theEdge,
0273 const TopLoc_Location& theloc) const;
0274
0275
0276 Standard_EXPORT virtual bool IsVClosedSurface(const occ::handle<Geom_Surface>& surf,
0277 const TopoDS_Shape& theEdge,
0278 const TopLoc_Location& theloc) const;
0279
0280
0281
0282 Standard_EXPORT virtual void FaceAnalysis(
0283 const Message_ProgressRange& theProgress = Message_ProgressRange());
0284
0285
0286 Standard_EXPORT virtual void FindFreeBoundaries();
0287
0288
0289
0290 Standard_EXPORT virtual void VerticesAssembling(
0291 const Message_ProgressRange& theProgress = Message_ProgressRange());
0292
0293
0294 Standard_EXPORT virtual void CreateSewedShape();
0295
0296
0297
0298 Standard_EXPORT virtual void GetFreeWires(
0299 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& MapFreeEdges,
0300 NCollection_Sequence<TopoDS_Shape>& seqWires);
0301
0302
0303 Standard_EXPORT virtual void EvaluateAngulars(NCollection_Sequence<TopoDS_Shape>& sequenceSec,
0304 NCollection_Array1<bool>& secForward,
0305 NCollection_Array1<double>& tabAng,
0306 const int indRef) const;
0307
0308
0309 Standard_EXPORT virtual void EvaluateDistances(NCollection_Sequence<TopoDS_Shape>& sequenceSec,
0310 NCollection_Array1<bool>& secForward,
0311 NCollection_Array1<double>& tabAng,
0312 NCollection_Array1<double>& arrLen,
0313 NCollection_Array1<double>& tabMinDist,
0314 const int indRef) const;
0315
0316
0317 Standard_EXPORT virtual occ::handle<Geom2d_Curve> SameRange(
0318 const occ::handle<Geom2d_Curve>& CurvePtr,
0319 const double FirstOnCurve,
0320 const double LastOnCurve,
0321 const double RequestedFirst,
0322 const double RequestedLast) const;
0323
0324
0325 Standard_EXPORT virtual void SameParameter(const TopoDS_Edge& edge) const;
0326
0327
0328 Standard_EXPORT virtual TopoDS_Edge SameParameterEdge(
0329 const TopoDS_Shape& edge,
0330 const NCollection_Sequence<TopoDS_Shape>& seqEdges,
0331 const NCollection_Sequence<bool>& seqForward,
0332 NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>& mapMerged,
0333 const occ::handle<BRepTools_ReShape>& locReShape);
0334
0335
0336 Standard_EXPORT virtual TopoDS_Edge SameParameterEdge(
0337 const TopoDS_Edge& edge1,
0338 const TopoDS_Edge& edge2,
0339 const NCollection_List<TopoDS_Shape>& listFaces1,
0340 const NCollection_List<TopoDS_Shape>& listFaces2,
0341 const bool secForward,
0342 int& whichSec,
0343 const bool firstCall = true);
0344
0345
0346
0347 Standard_EXPORT void ProjectPointsOnCurve(const NCollection_Array1<gp_Pnt>& arrPnt,
0348 const occ::handle<Geom_Curve>& Crv,
0349 const double first,
0350 const double last,
0351 NCollection_Array1<double>& arrDist,
0352 NCollection_Array1<double>& arrPara,
0353 NCollection_Array1<gp_Pnt>& arrProj,
0354 const bool isConsiderEnds) const;
0355
0356
0357
0358 Standard_EXPORT virtual void CreateCuttingNodes(
0359 const NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher>& MapVert,
0360 const TopoDS_Shape& bound,
0361 const TopoDS_Shape& vfirst,
0362 const TopoDS_Shape& vlast,
0363 const NCollection_Array1<double>& arrDist,
0364 const NCollection_Array1<double>& arrPara,
0365 const NCollection_Array1<gp_Pnt>& arrPnt,
0366 NCollection_Sequence<TopoDS_Shape>& seqNode,
0367 NCollection_Sequence<double>& seqPara);
0368
0369
0370
0371 Standard_EXPORT virtual void CreateSections(const TopoDS_Shape& bound,
0372 const NCollection_Sequence<TopoDS_Shape>& seqNode,
0373 const NCollection_Sequence<double>& seqPara,
0374 NCollection_List<TopoDS_Shape>& listEdge);
0375
0376
0377
0378
0379 Standard_EXPORT virtual void SameParameterShape();
0380
0381 double myTolerance;
0382 bool mySewing;
0383 bool myAnalysis;
0384 bool myCutting;
0385 bool myNonmanifold;
0386 NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myOldShapes;
0387 TopoDS_Shape mySewedShape;
0388 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myDegenerated;
0389 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myFreeEdges;
0390 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myMultipleEdges;
0391 NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0392 myContigousEdges;
0393 NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myContigSecBound;
0394 int myNbShapes;
0395 int myNbVertices;
0396 int myNbEdges;
0397 NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0398 myBoundFaces;
0399 NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0400 myBoundSections;
0401 NCollection_DataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> mySectionBound;
0402 NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myVertexNode;
0403 NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Shape, TopTools_ShapeMapHasher> myVertexNodeFree;
0404 NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0405 myNodeSections;
0406 NCollection_DataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher>
0407 myCuttingNode;
0408 NCollection_IndexedMap<TopoDS_Shape, TopTools_ShapeMapHasher> myLittleFace;
0409 TopoDS_Shape myShape;
0410 occ::handle<BRepTools_ReShape> myReShape;
0411
0412 private:
0413 bool myFaceMode;
0414 bool myFloatingEdgesMode;
0415 bool mySameParameterMode;
0416 bool myLocalToleranceMode;
0417 double myMinTolerance;
0418 double myMaxTolerance;
0419 NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> myMergedEdges;
0420 };
0421
0422 #include <BRepBuilderAPI_Sewing.lxx>
0423
0424 #endif