1 // Created on: 1995-07-17
2 // Created by: Jing-Cheng MEI
3 // Copyright (c) 1995-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 _BRepOffsetAPI_ThruSections_HeaderFile
18 #define _BRepOffsetAPI_ThruSections_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <TopTools_SequenceOfShape.hxx>
25 #include <Standard_Boolean.hxx>
26 #include <Standard_Real.hxx>
27 #include <TopoDS_Face.hxx>
28 #include <TopTools_DataMapOfShapeShape.hxx>
29 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
30 #include <TopTools_DataMapOfShapeInteger.hxx>
31 #include <GeomAbs_Shape.hxx>
32 #include <Approx_ParametrizationType.hxx>
33 #include <Standard_Integer.hxx>
34 #include <BRepBuilderAPI_MakeShape.hxx>
35 #include <TopTools_Array1OfShape.hxx>
36 class Standard_DomainError;
40 class Geom_BSplineSurface;
43 //! Describes functions to build a loft. This is a shell or a
44 //! solid passing through a set of sections in a given
45 //! sequence. Usually sections are wires, but the first and
46 //! the last sections may be vertices (punctual sections).
47 class BRepOffsetAPI_ThruSections : public BRepBuilderAPI_MakeShape
54 //! Initializes an algorithm for building a shell or a solid
55 //! passing through a set of sections, where:
56 //! - isSolid is set to true if the construction algorithm is
57 //! required to build a solid or to false if it is required to build
58 //! a shell (the default value),
59 //! - ruled is set to true if the faces generated between
60 //! the edges of two consecutive wires are ruled surfaces or to
61 //! false (the default value) if they are smoothed out by approximation,
62 //! - pres3d defines the precision criterion used by the
63 //! approximation algorithm; the default value is 1.0e-6.
64 //! Use AddWire and AddVertex to define the
65 //! successive sections of the shell or solid to be built.
66 Standard_EXPORT BRepOffsetAPI_ThruSections(const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
68 //! Initializes this algorithm for building a shell or a solid
69 //! passing through a set of sections, where:
70 //! - isSolid is set to true if this construction algorithm is
71 //! required to build a solid or to false if it is required to
72 //! build a shell. false is the default value;
73 //! - ruled is set to true if the faces generated between the
74 //! edges of two consecutive wires are ruled surfaces or
75 //! to false (the default value) if they are smoothed out by approximation,
76 //! - pres3d defines the precision criterion used by the
77 //! approximation algorithm; the default value is 1.0e-6.
78 //! Use AddWire and AddVertex to define the successive
79 //! sections of the shell or solid to be built.
80 Standard_EXPORT void Init (const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
82 //! Adds the wire wire to the set of
83 //! sections through which the shell or solid is built.
84 //! Use the Build function to construct the shape.
85 Standard_EXPORT void AddWire (const TopoDS_Wire& wire);
87 //! Adds the vertex Vertex (punctual section) to the set of sections
88 //! through which the shell or solid is built. A vertex may be added to the
89 //! set of sections only as first or last section. At least one wire
90 //! must be added to the set of sections by the method AddWire.
91 //! Use the Build function to construct the shape.
92 Standard_EXPORT void AddVertex (const TopoDS_Vertex& aVertex);
94 //! Sets/unsets the option to
95 //! compute origin and orientation on wires to avoid twisted results
96 //! and update wires to have same number of edges.
97 Standard_EXPORT void CheckCompatibility (const Standard_Boolean check = Standard_True);
99 //! Define the approximation algorithm
100 Standard_EXPORT void SetSmoothing (const Standard_Boolean UseSmoothing);
102 //! Define the type of parametrization used in the approximation
103 Standard_EXPORT void SetParType (const Approx_ParametrizationType ParType);
105 //! Define the Continuity used in the approximation
106 Standard_EXPORT void SetContinuity (const GeomAbs_Shape C);
108 //! define the Weights associed to the criterium used in
109 //! the optimization.
112 Standard_EXPORT void SetCriteriumWeight (const Standard_Real W1, const Standard_Real W2, const Standard_Real W3);
114 //! Define the maximal U degree of result surface
115 Standard_EXPORT void SetMaxDegree (const Standard_Integer MaxDeg);
117 //! returns the type of parametrization used in the approximation
118 Standard_EXPORT Approx_ParametrizationType ParType() const;
120 //! returns the Continuity used in the approximation
121 Standard_EXPORT GeomAbs_Shape Continuity() const;
123 //! returns the maximal U degree of result surface
124 Standard_EXPORT Standard_Integer MaxDegree() const;
126 //! Define the approximation algorithm
127 Standard_EXPORT Standard_Boolean UseSmoothing() const;
129 //! returns the Weights associed to the criterium used in
130 //! the optimization.
131 Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const;
133 Standard_EXPORT virtual void Build() Standard_OVERRIDE;
135 //! Returns the TopoDS Shape of the bottom of the loft if solid
136 Standard_EXPORT const TopoDS_Shape& FirstShape() const;
138 //! Returns the TopoDS Shape of the top of the loft if solid
139 Standard_EXPORT const TopoDS_Shape& LastShape() const;
142 //! Returns the Face generated by each edge
143 //! except the last wire
145 //! Returns the Face generated by each edge of the first wire
146 Standard_EXPORT TopoDS_Shape GeneratedFace (const TopoDS_Shape& Edge) const;
148 //! Returns a list of new shapes generated from the shape
149 //! S by the shell-generating algorithm.
150 //! This function is redefined from BRepBuilderAPI_MakeShape::Generated.
151 //! S can be an edge or a vertex of a given Profile (see methods AddWire and AddVertex).
152 Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
165 Standard_EXPORT void CreateRuled();
167 Standard_EXPORT void CreateSmoothed();
169 Standard_EXPORT Handle(Geom_BSplineSurface) TotalSurf (const TopTools_Array1OfShape& shapes,
170 const Standard_Integer NbSect,
171 const Standard_Integer NbEdges,
172 const Standard_Boolean w1Point,
173 const Standard_Boolean w2Point,
174 const Standard_Boolean vClosed) const;
177 TopTools_SequenceOfShape myWires;
178 TopTools_DataMapOfShapeListOfInteger myEdgeNewIndices;
179 TopTools_DataMapOfShapeInteger myVertexIndex;
180 Standard_Integer myNbEdgesInSection;
181 Standard_Boolean myIsSolid;
182 Standard_Boolean myIsRuled;
183 Standard_Boolean myWCheck;
184 Standard_Real myPres3d;
187 Standard_Boolean myDegen1;
188 Standard_Boolean myDegen2;
189 TopTools_DataMapOfShapeShape myEdgeFace;
190 GeomAbs_Shape myContinuity;
191 Approx_ParametrizationType myParamType;
192 Standard_Integer myDegMax;
193 Standard_Real myCritWeights[3];
194 Standard_Boolean myUseSmoothing;
205 #endif // _BRepOffsetAPI_ThruSections_HeaderFile