1 // Created on: 1998-07-22
2 // Created by: Philippe MANGIN
3 // Copyright (c) 1998-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 _BRepFill_PipeShell_HeaderFile
18 #define _BRepFill_PipeShell_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <TopoDS_Wire.hxx>
24 #include <TopoDS_Shape.hxx>
25 #include <BRepFill_SequenceOfSection.hxx>
26 #include <TopTools_DataMapOfShapeListOfShape.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Integer.hxx>
29 #include <Standard_Boolean.hxx>
30 #include <TopTools_HArray2OfShape.hxx>
31 #include <GeomFill_Trihedron.hxx>
32 #include <BRepFill_TransitionStyle.hxx>
33 #include <GeomFill_PipeError.hxx>
34 #include <Standard_Transient.hxx>
35 #include <BRepFill_TypeOfContact.hxx>
36 #include <TopTools_ListOfShape.hxx>
37 #include <TopTools_SequenceOfShape.hxx>
38 #include <TColStd_SequenceOfInteger.hxx>
40 class BRepFill_LocationLaw;
41 class BRepFill_SectionLaw;
42 class Standard_DomainError;
43 class StdFail_NotDone;
49 class BRepFill_Section;
54 class BRepFill_PipeShell;
55 DEFINE_STANDARD_HANDLE(BRepFill_PipeShell, Standard_Transient)
57 //! Computes a topological shell using some wires
58 //! (spines and profiles) and diplacement option
59 //! Perform general sweeping construction
60 class BRepFill_PipeShell : public Standard_Transient
66 //! Set an sweep's mode
67 //! If no mode are set, the mode used in MakePipe is used
68 Standard_EXPORT BRepFill_PipeShell(const TopoDS_Wire& Spine);
70 //! Set an Frenet or an CorrectedFrenet trihedron
71 //! to perform the sweeping
72 Standard_EXPORT void Set (const Standard_Boolean Frenet = Standard_False);
74 //! Set a Discrete trihedron
75 //! to perform the sweeping
76 Standard_EXPORT void SetDiscrete();
78 //! Set an fixed trihedron to perform the sweeping
79 //! all sections will be parallel.
80 Standard_EXPORT void Set (const gp_Ax2& Axe);
82 //! Set an fixed BiNormal direction to perform
84 Standard_EXPORT void Set (const gp_Dir& BiNormal);
86 //! Set support to the spine to define the BiNormal
87 //! at the spine, like the normal the surfaces.
88 //! Warning: To be effective, Each edge of the <spine> must
89 //! have an representation on one face of<SpineSupport>
90 Standard_EXPORT Standard_Boolean Set (const TopoDS_Shape& SpineSupport);
92 //! Set an auxiliary spine to define the Normal
93 //! For each Point of the Spine P, an Point Q is evalued
94 //! on <AuxiliarySpine>
95 //! If <CurvilinearEquivalence>
96 //! Q split <AuxiliarySpine> with the same length ratio
97 //! than P split <Spline>.
98 //! Else the plan define by P and the tangent to the <Spine>
99 //! intersect <AuxiliarySpine> in Q.
100 //! If <KeepContact> equals BRepFill_NoContact: The Normal is defined
101 //! by the vector PQ.
102 //! If <KeepContact> equals BRepFill_Contact: The Normal is defined to
103 //! achieve that the sweeped section is in contact to the
104 //! auxiliarySpine. The width of section is constant all along the path.
105 //! In other words, the auxiliary spine lies on the swept surface,
106 //! but not necessarily is a boundary of this surface. However,
107 //! the auxiliary spine has to be close enough to the main spine
108 //! to provide intersection with any section all along the path.
109 //! If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine
110 //! becomes a boundary of the swept surface and the width of section varies
112 Standard_EXPORT void Set (const TopoDS_Wire& AuxiliarySpine, const Standard_Boolean CurvilinearEquivalence = Standard_True, const BRepFill_TypeOfContact KeepContact = BRepFill_NoContact);
114 //! Define the maximum V degree of resulting surface
115 Standard_EXPORT void SetMaxDegree (const Standard_Integer NewMaxDegree);
117 //! Define the maximum number of spans in V-direction
118 //! on resulting surface
119 Standard_EXPORT void SetMaxSegments (const Standard_Integer NewMaxSegments);
121 //! Set the flag that indicates attempt to approximate
122 //! a C1-continuous surface if a swept surface proved
124 //! Give section to sweep.
125 //! Possibilities are :
126 //! - Give one or sevral profile
127 //! - Give one profile and an homotetic law.
128 //! - Automatic compute of correspondence between profile, and section on the sweeped shape
129 //! - correspondence between profile, and section on the sweeped shape defined by a vertex of the spine
130 Standard_EXPORT void SetForceApproxC1 (const Standard_Boolean ForceApproxC1);
132 //! Set an section. The correspondence with the spine, will be automatically performed.
133 Standard_EXPORT void Add (const TopoDS_Shape& Profile, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
135 //! Set an section. The correspondence with the spine, is given by Location.
136 Standard_EXPORT void Add (const TopoDS_Shape& Profile, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
138 //! Set an section and an homotetic law.
139 //! The homotetie's centers is given by point on the <Spine>.
140 Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
142 //! Set an section and an homotetic law.
143 //! The homotetie center is given by point on the <Spine>
144 Standard_EXPORT void SetLaw (const TopoDS_Shape& Profile, const Handle(Law_Function)& L, const TopoDS_Vertex& Location, const Standard_Boolean WithContact = Standard_False, const Standard_Boolean WithCorrection = Standard_False);
146 //! Delete an section.
147 Standard_EXPORT void DeleteProfile (const TopoDS_Shape& Profile);
149 //! Say if <me> is ready to build the shape
150 //! return False if <me> do not have section definition
151 Standard_EXPORT Standard_Boolean IsReady() const;
153 //! Get a status, when Simulate or Build failed.
154 Standard_EXPORT GeomFill_PipeError GetStatus() const;
156 Standard_EXPORT void SetTolerance (const Standard_Real Tol3d = 1.0e-4, const Standard_Real BoundTol = 1.0e-4, const Standard_Real TolAngular = 1.0e-2);
158 //! Set the Transition Mode to manage discontinuities
160 Standard_EXPORT void SetTransition (const BRepFill_TransitionStyle Mode = BRepFill_Modified, const Standard_Real Angmin = 1.0e-2, const Standard_Real Angmax = 6.0);
162 //! Perform simulation of the sweep :
163 //! Somes Section are returned.
164 Standard_EXPORT void Simulate (const Standard_Integer NumberOfSection, TopTools_ListOfShape& Sections);
166 //! Builds the resulting shape (redefined from MakeShape).
167 Standard_EXPORT Standard_Boolean Build();
169 //! Transform the sweeping Shell in Solid.
170 //! If the section are not closed returns False
171 Standard_EXPORT Standard_Boolean MakeSolid();
173 //! Returns the result Shape.
174 Standard_EXPORT const TopoDS_Shape& Shape() const;
176 Standard_EXPORT Standard_Real ErrorOnSurface() const;
178 //! Returns the TopoDS Shape of the bottom of the sweep.
179 Standard_EXPORT const TopoDS_Shape& FirstShape() const;
181 //! Returns the TopoDS Shape of the top of the sweep.
182 Standard_EXPORT const TopoDS_Shape& LastShape() const;
184 //! Returns the list of original profiles
185 void Profiles(TopTools_ListOfShape& theProfiles)
187 for (Standard_Integer i = 1; i <= mySeq.Length(); ++i)
188 theProfiles.Append(mySeq(i).OriginalShape());
191 //! Returns the spine
192 const TopoDS_Wire& Spine()
197 //! Returns the list of shapes generated from the
199 Standard_EXPORT void Generated (const TopoDS_Shape& S, TopTools_ListOfShape& L);
204 DEFINE_STANDARD_RTTIEXT(BRepFill_PipeShell,Standard_Transient)
214 Standard_EXPORT void Prepare();
216 Standard_EXPORT void Place (const BRepFill_Section& Sec, TopoDS_Wire& W, gp_Trsf& Trsf, Standard_Real& param);
218 Standard_EXPORT void ResetLoc();
220 Standard_EXPORT void BuildHistory (const BRepFill_Sweep& theSweep);
223 TopoDS_Shape myFirst;
225 TopoDS_Shape myShape;
226 BRepFill_SequenceOfSection mySeq;
227 TopTools_SequenceOfShape WSeq;
228 TColStd_SequenceOfInteger myIndOfSec;
229 TopTools_DataMapOfShapeListOfShape myEdgeNewEdges;
230 TopTools_DataMapOfShapeListOfShape myGenMap;
231 Standard_Real myTol3d;
232 Standard_Real myBoundTol;
233 Standard_Real myTolAngular;
234 Standard_Real angmin;
235 Standard_Real angmax;
236 Standard_Integer myMaxDegree;
237 Standard_Integer myMaxSegments;
238 Standard_Boolean myForceApproxC1;
239 Handle(Law_Function) myLaw;
240 Standard_Boolean myIsAutomaticLaw;
241 Handle(BRepFill_LocationLaw) myLocation;
242 Handle(BRepFill_SectionLaw) mySection;
243 Handle(TopTools_HArray2OfShape) myFaces;
244 GeomFill_Trihedron myTrihedron;
245 BRepFill_TransitionStyle myTransition;
246 GeomFill_PipeError myStatus;
247 Standard_Real myErrorOnSurf;
258 #endif // _BRepFill_PipeShell_HeaderFile