85843588 |
1 | // Created on: 2018-03-14 |
2 | // Created by: Nikolai BUKHALOV |
3 | // Copyright (c) 1999-2018 OPEN CASCADE SAS |
4 | // |
5 | // This file is part of Open CASCADE Technology software library. |
6 | // |
7 | // This library is free software; you can redistribute it and/or modify it under |
8 | // the terms of the GNU Lesser General Public License version 2.1 as published |
9 | // by the Free Software Foundation, with special exception defined in the file |
10 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
11 | // distribution for complete text of the license and disclaimer of any warranty. |
12 | // |
13 | // Alternatively, this file may be used under the terms of Open CASCADE |
14 | // commercial license or contractual agreement. |
15 | |
16 | #ifndef _BRepFill_AdvancedEvolved_HeaderFile |
17 | #define _BRepFill_AdvancedEvolved_HeaderFile |
18 | |
19 | #include <Standard.hxx> |
20 | #include <Standard_DefineAlloc.hxx> |
21 | #include <Standard_Handle.hxx> |
22 | |
23 | #include <TopoDS_Compound.hxx> |
24 | #include <TopoDS_Wire.hxx> |
25 | #include <TopTools_IndexedMapOfShape.hxx> |
26 | #include <TopTools_ListOfShape.hxx> |
27 | #include <Standard_CString.hxx> |
28 | |
29 | class BOPAlgo_MakerVolume; |
30 | class TopoDS_Face; |
31 | |
32 | //! Constructs an evolved volume from a spine (wire or face) |
33 | //! and a profile ( wire). |
34 | class BRepFill_AdvancedEvolved |
35 | { |
36 | public: |
37 | |
38 | DEFINE_STANDARD_ALLOC; |
39 | |
40 | //! Constructor |
41 | Standard_EXPORT BRepFill_AdvancedEvolved() :myErrorStatus(BRepFill_AdvancedEvolved_Empty), |
42 | myFuzzyValue(0.0), |
43 | myIsParallel(Standard_True), |
44 | myDebugShapesPath("C:\\Temp") |
45 | { |
46 | } |
47 | |
48 | Standard_EXPORT void Perform(const TopoDS_Wire& theSpine, |
49 | const TopoDS_Wire& theProfile, |
50 | const Standard_Real theTolerance, |
51 | const Standard_Boolean theSolidReq = Standard_True); |
52 | |
53 | Standard_Boolean IsDone(unsigned int* theErrorCode = 0) const |
54 | { |
55 | if (theErrorCode) |
56 | *theErrorCode = myErrorStatus; |
57 | |
58 | return (myErrorStatus == BRepFill_AdvancedEvolved_OK); |
59 | } |
60 | |
61 | //! returns the resulting shape. |
62 | const TopoDS_Shape& Shape() const |
63 | { |
64 | return myResult; |
65 | } |
66 | |
67 | //! Sets directory where the debug shapes will be saved |
68 | void SetTemporaryDirectory(const Standard_CString& thePath) |
69 | { |
70 | myDebugShapesPath = thePath; |
71 | } |
72 | |
73 | //! Sets/Unsets computation in parallel mode |
74 | void SetParallelMode(const Standard_Boolean theVal) |
75 | { |
76 | myIsParallel = theVal; |
77 | } |
78 | |
79 | protected: |
80 | |
81 | Standard_EXPORT void PerformSweep(); |
82 | |
83 | Standard_EXPORT void GetLids(); |
84 | |
85 | Standard_EXPORT void BuildSolid(); |
86 | |
87 | Standard_EXPORT void RemoveExcessSolids(const TopTools_ListOfShape& theLSplits, |
88 | const TopoDS_Shape& theShape, |
89 | TopTools_ListOfShape& theArgsList, |
90 | BOPAlgo_MakerVolume& theMV); |
91 | |
92 | Standard_EXPORT void ExtractOuterSolid(TopoDS_Shape& theShape, |
93 | TopTools_ListOfShape& theArgsList); |
94 | |
95 | Standard_EXPORT void GetSpineAndProfile(const TopoDS_Wire& theSpine, |
96 | const TopoDS_Wire& theProfile); |
97 | |
98 | Standard_EXPORT void UnifyShape(); |
99 | |
100 | Standard_EXPORT Standard_Boolean PerformBoolean(const TopTools_ListOfShape& theArgsList, |
101 | TopoDS_Shape& theResult) const; |
102 | |
103 | Standard_EXPORT Standard_Boolean CheckSingularityAndAdd(const TopoDS_Face& theF, |
104 | const Standard_Real theFuzzyToler, |
105 | TopTools_ListOfShape& theListOfFaces, |
106 | TopTools_ListOfShape& theListOfSplits) const; |
107 | |
108 | Standard_EXPORT Standard_Boolean IsLid(const TopoDS_Face& theF, |
109 | const TopTools_IndexedMapOfShape& theMapOfLids) const; |
110 | |
111 | private: |
112 | |
113 | enum |
114 | { |
115 | BRepFill_AdvancedEvolved_Empty = 0, |
116 | BRepFill_AdvancedEvolved_NotPlanarSpine, |
117 | BRepFill_AdvancedEvolved_SweepError, |
118 | BRepFill_AdvancedEvolved_NoLids, |
119 | BRepFill_AdvancedEvolved_NotSolid, |
120 | BRepFill_AdvancedEvolved_NotVolume, |
121 | BRepFill_AdvancedEvolved_OK = UINT_MAX |
122 | } myErrorStatus; |
123 | |
124 | TopoDS_Wire mySpine; |
125 | TopoDS_Wire myProfile; |
126 | TopoDS_Shape myPipeShell; |
127 | TopoDS_Compound myTopBottom; // Lids can be split on several faces |
128 | TopoDS_Shape myResult; |
129 | Standard_Real myFuzzyValue; |
130 | Standard_Boolean myIsParallel; |
131 | Standard_CString myDebugShapesPath; |
132 | |
133 | }; |
134 | |
135 | |
136 | |
137 | |
138 | |
139 | |
140 | |
141 | #endif // _BRepFill_AdvancedEvolved_HeaderFile |