1 // Created on: 1994-02-18
2 // Created by: Remi LEQUETTE
3 // Copyright (c) 1994-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepAlgoAPI_Section_HeaderFile
18 #define _BRepAlgoAPI_Section_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <BRepAlgoAPI_BooleanOperation.hxx>
26 class BOPAlgo_PaveFiller;
33 //! The algorithm is to build a Secton operation between arguments and tools.
34 //! The result of Section operation consists of vertices and edges.
35 //! The result of Section operation contains:
36 //! 1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
37 //! 2. vertices that are subjects of V/E, V/F interferences
38 //! 3. new edges that are subjects of F/F interferences
39 //! 4. edges that are Common Blocks
40 class BRepAlgoAPI_Section : public BRepAlgoAPI_BooleanOperation
48 Standard_EXPORT BRepAlgoAPI_Section();
49 Standard_EXPORT virtual ~BRepAlgoAPI_Section();
52 //! <PF> - PaveFiller object that is carried out
53 Standard_EXPORT BRepAlgoAPI_Section(const BOPAlgo_PaveFiller& PF);
55 //! Constructor with two shapes
58 //! <PerformNow> - the flag:
59 //! if <PerformNow>=True - the algorithm is performed immediatly
61 Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const Standard_Boolean PerformNow = Standard_True);
63 //! Constructor with two shapes
66 //! <PF> - PaveFiller object that is carried out
67 //! <PerformNow> - the flag:
68 //! if <PerformNow>=True - the algorithm is performed immediatly
70 Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, const TopoDS_Shape& S2, const BOPAlgo_PaveFiller& aDSF, const Standard_Boolean PerformNow = Standard_True);
72 //! Constructor with two shapes
75 //! <PerformNow> - the flag:
76 //! if <PerformNow>=True - the algorithm is performed immediatly
78 Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, const gp_Pln& Pl, const Standard_Boolean PerformNow = Standard_True);
80 //! Constructor with two shapes
83 //! <PerformNow> - the flag:
84 //! if <PerformNow>=True - the algorithm is performed immediatly
86 Standard_EXPORT BRepAlgoAPI_Section(const TopoDS_Shape& S1, const Handle(Geom_Surface)& Sf, const Standard_Boolean PerformNow = Standard_True);
88 //! Constructor with two shapes
91 //! <PerformNow> - the flag:
92 //! if <PerformNow>=True - the algorithm is performed immediatly
94 Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf, const TopoDS_Shape& S2, const Standard_Boolean PerformNow = Standard_True);
96 //! Constructor with two shapes
99 //! <PerformNow> - the flag:
100 //! if <PerformNow>=True - the algorithm is performed immediatly
102 Standard_EXPORT BRepAlgoAPI_Section(const Handle(Geom_Surface)& Sf1, const Handle(Geom_Surface)& Sf2, const Standard_Boolean PerformNow = Standard_True);
104 //! initialize the argument
107 Standard_EXPORT void Init1 (const TopoDS_Shape& S1);
109 //! initialize the argument
112 Standard_EXPORT void Init1 (const gp_Pln& Pl);
114 //! initialize the argument
117 Standard_EXPORT void Init1 (const Handle(Geom_Surface)& Sf);
119 //! initialize the tool
122 Standard_EXPORT void Init2 (const TopoDS_Shape& S2);
124 //! initialize the tool
127 Standard_EXPORT void Init2 (const gp_Pln& Pl);
129 //! initialize the tool
132 Standard_EXPORT void Init2 (const Handle(Geom_Surface)& Sf);
134 Standard_EXPORT void Approximation (const Standard_Boolean B);
137 //! Indicates whether the P-Curve should be (or not)
138 //! performed on the argument.
139 //! By default, no parametric 2D curve (pcurve) is defined for the
140 //! edges of the result.
141 //! If ComputePCurve1 equals true, further computations performed
142 //! to attach an P-Curve in the parametric space of the argument
143 //! to the constructed edges.
145 Standard_EXPORT void ComputePCurveOn1 (const Standard_Boolean B);
148 //! Indicates whether the P-Curve should be (or not)
149 //! performed on the tool.
150 //! By default, no parametric 2D curve (pcurve) is defined for the
151 //! edges of the result.
152 //! If ComputePCurve1 equals true, further computations performed
153 //! to attach an P-Curve in the parametric space of the tool
154 //! to the constructed edges.
156 Standard_EXPORT void ComputePCurveOn2 (const Standard_Boolean B);
158 //! Performs the algorithm
159 //! Filling interference Data Structure (if it is necessary)
160 //! Building the result of the operation.
161 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
164 //! get the face of the first part giving section edge <E>.
165 //! Returns True on the 3 following conditions :
166 //! 1/ <E> is an edge returned by the Shape() metwod.
167 //! 2/ First part of section performed is a shape.
168 //! 3/ <E> is built on a intersection curve (i.e <E>
169 //! is not the result of common edges)
170 //! When False, F remains untouched.
172 Standard_EXPORT Standard_Boolean HasAncestorFaceOn1 (const TopoDS_Shape& E, TopoDS_Shape& F) const;
174 //! Identifies the ancestor faces of
175 //! the intersection edge E resulting from the last
176 //! computation performed in this framework, that is, the faces of
177 //! the two original shapes on which the edge E lies:
178 //! - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
179 //! - HasAncestorFaceOn2 gives the ancestor face in the second shape.
180 //! These functions return true if an ancestor face F is found, or false if not.
181 //! An ancestor face is identifiable for the edge E if the following
182 //! conditions are satisfied:
183 //! - the first part on which this algorithm performed its
184 //! last computation is a shape, that is, it was not given as
185 //! a surface or a plane at the time of construction of this
186 //! algorithm or at a later time by the Init1 function,
187 //! - E is one of the elementary edges built by the
188 //! last computation of this section algorithm.
189 //! To use these functions properly, you have to test the returned
190 //! Boolean value before using the ancestor face: F is significant
191 //! only if the returned Boolean value equals true.
193 Standard_EXPORT Standard_Boolean HasAncestorFaceOn2 (const TopoDS_Shape& E, TopoDS_Shape& F) const;
201 Standard_EXPORT void Init (const Standard_Boolean PerformNow);
203 Standard_EXPORT virtual void SetAttributes() Standard_OVERRIDE;
212 Standard_Boolean myParametersChanged;
213 Standard_Boolean myApprox;
214 Standard_Boolean myComputePCurve1;
215 Standard_Boolean myComputePCurve2;
226 #endif // _BRepAlgoAPI_Section_HeaderFile