1 // Created on: 1996-02-13 2 // Created by: Jacques GOUSSARD 3 // Copyright (c) 1996-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 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. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _BRepFeat_MakePrism_HeaderFile 18 #define _BRepFeat_MakePrism_HeaderFile 19 20 #include <Standard.hxx> 21 #include <Standard_DefineAlloc.hxx> 22 #include <Standard_Handle.hxx> 23 24 #include <TopoDS_Shape.hxx> 25 #include <TopTools_DataMapOfShapeListOfShape.hxx> 26 #include <gp_Dir.hxx> 27 #include <TColGeom_SequenceOfCurve.hxx> 28 #include <BRepFeat_StatusError.hxx> 29 #include <BRepFeat_Form.hxx> 30 #include <Standard_Integer.hxx> 31 #include <Standard_Boolean.hxx> 32 #include <Standard_Real.hxx> 33 class Geom_Curve; 34 class TopoDS_Face; 35 class TopoDS_Edge; 36 37 38 //! Describes functions to build prism features. 39 //! These can be depressions or protrusions. 40 //! The semantics of prism feature creation is 41 //! based on the construction of shapes: 42 //! - along a length 43 //! - up to a limiting face 44 //! - from a limiting face to a height. 45 //! The shape defining construction of the prism feature can be 46 //! either the supporting edge or the concerned area of a face. 47 //! In case of the supporting edge, this contour 48 //! can be attached to a face of the basis shape by 49 //! binding. When the contour is bound to this face, 50 //! the information that the contour will slide on the 51 //! face becomes available to the relevant class methods. 52 //! In case of the concerned area of a face, you 53 //! could, for example, cut it out and move it to a 54 //! different height which will define the limiting 55 //! face of a protrusion or depression. 56 class BRepFeat_MakePrism : public BRepFeat_Form 57 { 58 public: 59 60 DEFINE_STANDARD_ALLOC 61 62 63 //! Builds a prism by projecting a 64 //! wire along the face of a shape. Initializes the prism class. 65 BRepFeat_MakePrism(); 66 67 //! Builds a prism by projecting a 68 //! wire along the face of a shape. a face Pbase is selected in 69 //! the shape Sbase to serve as the basis for 70 //! the prism. The orientation of the prism will 71 //! be defined by the vector Direction. 72 //! Fuse offers a choice between: 73 //! - removing matter with a Boolean cut using the setting 0 74 //! - adding matter with Boolean fusion using the setting 1. 75 //! The sketch face Skface serves to determine 76 //! the type of operation. If it is inside the basis 77 //! shape, a local operation such as glueing can be performed. 78 //! Exceptions 79 //! Standard_ConstructionError if the face 80 //! does not belong to the basis or the prism shape. 81 BRepFeat_MakePrism(const TopoDS_Shape& Sbase, const TopoDS_Shape& Pbase, const TopoDS_Face& Skface, const gp_Dir& Direction, const Standard_Integer Fuse, const Standard_Boolean Modify); 82 83 //! Initializes this algorithm for building prisms along surfaces. 84 //! A face Pbase is selected in the shape Sbase 85 //! to serve as the basis for the prism. The 86 //! orientation of the prism will be defined by the vector Direction. 87 //! Fuse offers a choice between: 88 //! - removing matter with a Boolean cut using the setting 0 89 //! - adding matter with Boolean fusion using the setting 1. 90 //! The sketch face Skface serves to determine 91 //! the type of operation. If it is inside the basis 92 //! shape, a local operation such as glueing can be performed. 93 Standard_EXPORT void Init (const TopoDS_Shape& Sbase, const TopoDS_Shape& Pbase, const TopoDS_Face& Skface, const gp_Dir& Direction, const Standard_Integer Fuse, const Standard_Boolean Modify); 94 95 //! Indicates that the edge <E> will slide on the face 96 //! <OnFace>. Raises ConstructionError if the face does not belong to the 97 //! basis shape, or the edge to the prismed shape. 98 Standard_EXPORT void Add (const TopoDS_Edge& E, const TopoDS_Face& OnFace); 99 100 Standard_EXPORT void Perform (const Standard_Real Length); 101 102 Standard_EXPORT void Perform (const TopoDS_Shape& Until); 103 104 //! Assigns one of the following semantics 105 //! - to a height Length 106 //! - to a face Until 107 //! - from a face From to a height Until. 108 //! Reconstructs the feature topologically according to the semantic option chosen. 109 Standard_EXPORT void Perform (const TopoDS_Shape& From, const TopoDS_Shape& Until); 110 111 //! Realizes a semi-infinite prism, limited by the 112 //! position of the prism base. All other faces extend infinitely. 113 Standard_EXPORT void PerformUntilEnd(); 114 115 //! Realizes a semi-infinite prism, limited by the face Funtil. 116 Standard_EXPORT void PerformFromEnd (const TopoDS_Shape& FUntil); 117 118 //! Builds an infinite prism. The infinite descendants will not be kept in the result. 119 Standard_EXPORT void PerformThruAll(); 120 121 //! Assigns both a limiting shape, Until from 122 //! TopoDS_Shape, and a height, Length at which to stop generation of the prism feature. 123 Standard_EXPORT void PerformUntilHeight (const TopoDS_Shape& Until, const Standard_Real Length); 124 125 //! Returns the list of curves S parallel to the axis of the prism. 126 Standard_EXPORT void Curves (TColGeom_SequenceOfCurve& S); 127 128 //! Generates a curve along the center of mass of the primitive. 129 Standard_EXPORT Handle(Geom_Curve) BarycCurve(); 130 131 132 133 134 protected: 135 136 137 138 139 140 private: 141 142 143 144 TopoDS_Shape myPbase; 145 TopTools_DataMapOfShapeListOfShape mySlface; 146 gp_Dir myDir; 147 TColGeom_SequenceOfCurve myCurves; 148 Handle(Geom_Curve) myBCurve; 149 BRepFeat_StatusError myStatusError; 150 151 152 }; 153 154 155 #include <BRepFeat_MakePrism.lxx> 156 157 158 159 160 161 #endif // _BRepFeat_MakePrism_HeaderFile 162