CommitLineData
7fd59977 1-- File: BRepAlgoAPI_Section.cdl
2-- Created: Fri Feb 18 09:48:50 1994
3-- Author: Remi LEQUETTE
4--
5-- modified by Michael KLOKOV Wed Mar 6 15:01:25 2002
7
8class Section from BRepAlgoAPI inherits BooleanOperation from BRepAlgoAPI
9
10 ---Purpose: Computes the intersection of two shapes or geometries.
11 -- Geometries can be surfaces of planes.
12 -- Geometries are converted to faces
13 -- When a geometry has been converted to
14 -- topology the created shape can be found using
15 -- the methods Shape1 and Shape2 inherited from the class BooleanOperation.
16 -- The result (Shape() method) is a compound containing
17 -- edges built on intersection curves.
18 -- By default, the section is performed immediatly in
19 -- class constructors, with default values :
20 -- - geometries built are NOT approximated.
21 -- - PCurves are NOT computed on both parts.
22 -- Example : giving two shapes S1,S2 accessing faces,
23 -- let compute the section edges R on S1,S2,
24 -- performing approximation on new curves,
25 -- performing PCurve on part 1 but not on part 2 :
26 -- Standard_Boolean PerformNow = Standard_False;
27 -- BRepBoolAPI_Section S(S1,S2,PerformNow);
28 -- S.ComputePCurveOn1(Standard_True);
29 -- S.Approximation(Standard_True);
30 -- S.Build();
31 -- TopoDS_Shape R = S.Shape();
32 -- On Null Shapes of geometries, NotDone() is called.
33
34uses
35 Pln from gp,
36 Shape from TopoDS,
37 Surface from Geom,
38 Curve from Geom2d,
39 DSFiller from BOPTools,
40 ListOfShape from TopTools
41
42is
43 Create (S1,S2 : Shape from TopoDS;
45 PerformNow : Boolean = Standard_True)
46 returns Section from BRepAlgoAPI;
47
48 Create(Sh1,Sh2 : Shape from TopoDS;
49 PerformNow : Boolean = Standard_True)
50 ---Purpose: see upper
51 ---Level: Public
52 returns Section from BRepAlgoAPI;
53
54 Create(Sh : Shape from TopoDS; Pl : Pln from gp;
55 PerformNow : Boolean = Standard_True)
56 ---Purpose: see upper
57 ---Level: Public
58 returns Section from BRepAlgoAPI;
59
60 Create(Sh : Shape from TopoDS; Sf : Surface from Geom;
61 PerformNow : Boolean = Standard_True)
62 ---Purpose: see upper
63 ---Level: Public
64 returns Section from BRepAlgoAPI;
65
66 Create(Sf : Surface from Geom; Sh : Shape from TopoDS;
67 PerformNow : Boolean = Standard_True)
68 ---Purpose: see upper
69 ---Level: Public
70 returns Section from BRepAlgoAPI;
71
72 Create(Sf1 : Surface from Geom; Sf2 : Surface from Geom;
73 PerformNow : Boolean = Standard_True)
74 ---Purpose: This and the above classes construct a framework for
75 -- computing the section lines of:
76 -- - two shapes Sh1 and Sh2, or
77 -- - shape Sh and plane Pl, or
78 -- - shape Sh and surface Sf, or
79 -- - surface Sf and shape Sh, or
80 -- - two surfaces Sf1 and Sf2,
81 -- and builds a result if PerformNow equals true, its
82 -- default value. If PerformNow equals false, the intersection
83 -- will be computed later by the function Build.
84 -- The constructed shape will be returned by the function Shape.
85 -- This is a compound object composed of edges. These
86 -- intersection edges may be built:
87 -- - on new intersection lines, or
88 -- - on coincident portions of edges in the two intersected shapes.
89 -- These intersection edges are independent: they are not
90 -- chained or grouped in wires. If no intersection edge exists, the
91 -- result is an empty compound object.
92 -- Note that other objects than TopoDS_Shape shapes involved in
93 -- these syntaxes are converted into faces or shells before
94 -- performing the computation of the intersection. A shape
95 -- resulting from this conversion can be retrieved with the
96 -- function Shape1 or Shape2.
97 -- Parametric 2D curves on intersection edges
98 -- No parametric 2D curve (pcurve) is defined for each elementary
99 -- edge of the result. To attach such parametric curves to the
100 -- constructed edges you may use a constructor with the PerformNow
101 -- flag equal to false; then you use:
102 -- - the function ComputePCurveOn1 to ask for
103 -- the additional computation of a pcurve in the parametric
104 -- space of the first shape,
105 -- - the function ComputePCurveOn2 to ask for
106 -- the additional computation of a pcurve in the parametric
107 -- space of the second shape, in the end,
108 -- - the function Build to construct the result.
109 -- Approximation of intersection edges
110 -- The underlying 3D geometry attached to each elementary edge
111 -- of the result is:
112 -- - analytic where possible, provided the corresponding
113 -- geometry corresponds to a type of analytic curve
114 -- defined in the Geom package; for example, the intersection
115 -- of a cylindrical shape with a plane gives an ellipse or a circle;
116 -- - or elsewhere, given as a succession of points grouped
117 -- together in a BSpline curve of degree 1.
118 -- If you prefer to have an attached 3D geometry which is a
119 -- BSpline approximation of the computed set of points on
120 -- computed elementary intersection edges whose underlying geometry
121 -- is not analytic, you may use a constructor with the PerformNow
122 -- flag equal to false. Then you use:
123 -- - the function Approximation to ask for this
124 -- computation option, and
125 -- - the function Build to construct the result.
126 -- - Note that as a result, approximations will only be
127 -- computed on edges built on new intersection lines.
128 -- - Example
129 -- You may also combine these computation options. In the following example:
130 -- - each elementary edge of the computed intersection,
131 -- built on a new intersection line, which does not
132 -- correspond to an analytic Geom curve, will be approximated by
133 -- a BSpline curve whose degree is not greater than 8.
134 -- - each elementary edge built on a new intersection line, will have:
135 -- - a pcurve in the parametric space of the intersected face of shape S1,
136 -- - no pcurve in the parametric space of the intersected face of shape S2.
137 -- // TopoDS_Shape S1 = ... , S2 = ... ;
138 -- Standard_Boolean PerformNow = Standard_False;
139 -- BRepAlgoAPI_Section S ( S1, S2, PerformNow );
140 -- S.ComputePCurveOn1 (Standard_True);
141 -- S.Approximation (Standard_True);
142 -- S.Build();
143 -- TopoDS_Shape R = S.Shape();
144 returns Section from BRepAlgoAPI;
145
146 Init1(me : out;S1 : Shape from TopoDS);
147 ---Purpose: initialize first part
148 ---Level: Public
149
150 Init1(me : out;Pl : Pln from gp);
151 ---Purpose: initialize first part
152 ---Level: Public
153
154 Init1(me : out;Sf : Surface from Geom);
155 ---Purpose: initialize first part
156 ---Level: Public
157
158 Init2(me : out;S2 : Shape from TopoDS);
159 ---Purpose: initialize second part
160 ---Level: Public
161
162 Init2(me : out;Pl : Pln from gp);
163 ---Purpose: initialize second part
164 ---Level: Public
165
166 Init2(me : out;Sf : Surface from Geom);
167 ---Purpose: Reinitializes the first and the
168 -- second parts on which this algorithm is going to perform
169 -- the intersection computation. This is done with either: the
170 -- surface Sf, the plane Pl or the shape Sh.
171 -- You use the function Build to construct the result.
172
173 Approximation(me : out;B : Boolean);
174 ---Level: Public
175 ---Purpose: Defines an option for computation
176 -- of further intersections. This computation will be performed by
177 -- the function Build in this framework.
178 -- By default, the underlying 3D geometry attached to each
179 -- elementary edge of the result of a computed intersection is:
180 -- - analytic where possible, provided the corresponding
181 -- geometry corresponds to a type of analytic curve defined in
182 -- the Geom package; for example the intersection of a
183 -- cylindrical shape with a plane gives an ellipse or a circle;
184 -- - or elsewhere, given as a succession of points grouped
185 -- together in a BSpline curve of degree 1. If Approx equals
186 -- true, when further computations are performed in this framework
187 -- with the function Build, these edges will have an attached 3D
188 -- geometry which is a BSpline approximation of the computed
189 -- set of points.
190 -- Note that as a result, approximations will be computed
191 -- on edges built only on new intersection lines.
192
193 ComputePCurveOn1(me : out;B : Boolean);
194 ---Level: Public
195 ---Purpose:
196 -- Indicates if the Pcurve must be (or not) performed on first part.
197
198 ComputePCurveOn2(me : out;B : Boolean);
199 ---Level: Public
200 ---Purpose: Define options for the computation of further
201 -- intersections, which will be performed by the function Build
202 -- in this framework.
203 -- By default, no parametric 2D curve (pcurve) is defined for the
204 -- elementary edges of the result. If ComputePCurve1 equals true,
205 -- further computations performed in this framework with the function
206 -- Build will attach an additional pcurve in the parametric space of
207 -- the first shape to the constructed edges.
208 -- If ComputePCurve2 equals true, the additional pcurve will be
209 -- attached to the constructed edges in the parametric space of the
210 -- second shape.
211 -- These two functions may be used together.
212
213 Build(me : in out)
214 ---Purpose: Performs the computation of
215 -- section lines between two parts defined at the time of
216 -- construction of this framework or reinitialized with the Init1 and
217 -- Init2 functions.
218 -- The constructed shape will be returned by the function Shape.
219 -- This is a compound object composed of edges. These
220 -- intersection edges may be built:
221 -- - on new intersection lines, or
222 -- - on coincident portions of edges in the two intersected shapes.
223 -- These intersection edges are independent: they are not chained
224 -- or grouped into wires.
225 -- If no intersection edge exists, the result is an empty compound object.
226 -- The shapes involved in the construction of section lines can
227 -- be retrieved with the function Shape1 or Shape2. Note that other
228 -- objects than TopoDS_Shape shapes given as arguments at the
229 -- construction time of this framework, or to the Init1 or
230 -- Init2 function, are converted into faces or shells before
231 -- performing the computation of the intersection.
232 -- Parametric 2D curves on intersection edges
233 -- No parametric 2D curve (pcurve) is defined for the elementary
234 -- edges of the result. To attach parametric curves like this to
235 -- the constructed edges you have to use:
236 -- - the function
238 -- pcurve in the parametric space of the first shape,
239 -- - the function
241 -- pcurve in the parametric space of the second shape.
242 -- This must be done before calling this function.
243 -- Approximation of intersection edges
244 -- The underlying 3D geometry attached to each elementary edge of the result is:
245 -- - analytic (where possible) provided the corresponding
246 -- geometry corresponds to a type of analytic curve defined in
247 -- the Geom package; for example, the intersection of a
248 -- cylindrical shape with a plane gives an ellipse or a circle; or
249 -- - elsewhere, given as a succession of points grouped
250 -- together in a BSpline curve of degree 1.
251 -- If, on computed elementary intersection edges whose
252 -- underlying geometry is not analytic, you prefer to have an
253 -- attached 3D geometry which is a Bspline approximation of the
254 -- computed set of points, you have to use the function Approximation
255 -- to ask for this computation option before calling this function.
256 -- You may also have combined these computation options: look at the
257 -- example given above to illustrate the use of the constructors.
258 is redefined static;
259
260 HasAncestorFaceOn1(me; E : Shape from TopoDS;
261 F : out Shape from TopoDS)
262 returns Boolean;
263 ---Level: Public
264 ---Purpose:
265 -- get the face of the first part giving section edge <E>.
266 -- Returns True on the 3 following conditions :
267 -- 1/ <E> is an edge returned by the Shape() method.
268 -- 2/ First part of section performed is a shape.
269 -- 3/ <E> is built on a intersection curve (i.e <E>
270 -- is not the result of common edges)
271 -- When False, F remains untouched.
272
273 HasAncestorFaceOn2(me; E : Shape from TopoDS;
274 F : out Shape from TopoDS)
275 returns Boolean;
276 ---Purpose: Identifies the ancestor faces of
277 -- the intersection edge E resulting from the last
278 -- computation performed in this framework, that is, the faces of
279 -- the two original shapes on which the edge E lies:
280 -- - HasAncestorFaceOn1 gives the ancestor face in the first shape, and
281 -- - HasAncestorFaceOn2 gives the ancestor face in the second shape.
282 -- These functions return true if an ancestor face F is found, or false if not.
283 -- An ancestor face is identifiable for the edge E if the following
284 -- conditions are satisfied:
285 -- - the first part on which this algorithm performed its
286 -- last computation is a shape, that is, it was not given as
287 -- a surface or a plane at the time of construction of this
288 -- algorithm or at a later time by the Init1 function,
289 -- - E is one of the elementary edges built by the
290 -- last computation of this section algorithm.
291 -- To use these functions properly, you have to test the returned
292 -- Boolean value before using the ancestor face: F is significant
293 -- only if the returned Boolean value equals true.
294
295 PCurveOn1(me; E : Shape from TopoDS)
296 returns Curve from Geom2d;
297 ---Level: Public
298 ---Purpose: returns the PCurve connected to section edge <E>
299 -- and lying on first part of Section.
300 -- N.B : PCurve on first part is computed only if Section is performed
301 -- after setting ComputePCurveOn1(Standard_True).
302
303 PCurveOn2(me; E : Shape from TopoDS)
304 returns Curve from Geom2d;
305 ---Level: Public
306 ---Purpose: returns the PCurve connected to section edge <E>
307 -- and lying on second part of Section.
308 -- N.B : PCurve on second part is computed only if Section is performed
309 -- after setting ComputePCurveOn2(Standard_True).
310 -- Warning No pcurve is attached to an elementary edge of the
311 -- resulting section, and the function returns a null
312 -- handle, unless the function ComputePCurveOn1 or
313 -- ComputePCurveOn2 was previously used to define
314 -- this sort of option of computation.
315 -- - A null handle is also returned if the edge E does
316 -- not belong to the last computed intersection, that
317 -- is, if it is not one of the elementary edges of the
318 -- compound object returned by the function Shape.
319
320 InitParameters(me: out)
321 ---Level: Private
322 is private;
323
324fields
325 myshapeisnull : Boolean from Standard;
326 myparameterschanged : Boolean from Standard;
327 myApprox : Boolean from Standard;
328 myComputePCurve1 : Boolean from Standard;
329 myComputePCurve2 : Boolean from Standard;
330
331end Section from BRepAlgoAPI;