Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 1997-10-13 |

2 | -- Created by: Roman BORISOV | |

3 | -- Copyright (c) 1997-1999 Matra Datavision | |

973c2be1 | 4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |

b311480e | 5 | -- |

973c2be1 | 6 | -- This file is part of Open CASCADE Technology software library. |

b311480e | 7 | -- |

d5f74e42 | 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 | |

973c2be1 | 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. | |

b311480e | 13 | -- |

973c2be1 | 14 | -- Alternatively, this file may be used under the terms of Open CASCADE |

15 | -- commercial license or contractual agreement. | |

7fd59977 | 16 | |

17 | class NormalProjection from BRepOffsetAPI inherits MakeShape from BRepBuilderAPI | |

18 | ||

19 | ---Purpose: A framework to define projection onto a shape | |

20 | -- according to the normal from each point to be projected. | |

21 | -- The target shape is a face, and the source shape is an edge or a wire. | |

22 | -- The target face is considered to be a 2D surface. | |

23 | ||

24 | ||

25 | uses Shape from TopoDS, | |

26 | Edge from TopoDS, | |

27 | Shape from GeomAbs, | |

28 | NormalProjection from BRepAlgo, | |

29 | ListOfShape from TopTools | |

30 | ||

31 | ||

32 | raises ConstructionError from Standard, | |

33 | NoSuchObject from Standard, | |

34 | NotDone from StdFail | |

35 | ||

36 | is | |

37 | ||

38 | Create | |

39 | ---Purpose: Constructs an empty framework to define projection on | |

40 | -- a shape according to the normal from each point to be | |

41 | -- projected to the shape. | |

42 | returns NormalProjection; | |

43 | ||

44 | ||

45 | Create(S: Shape from TopoDS) | |

46 | ||

47 | returns NormalProjection; | |

48 | ---Purpose: Constructs a framework to define projection onto the | |

49 | -- basis shape S according to the normal from each point | |

50 | -- to be projected from the shape added to this framework by Add. | |

51 | -- Default parameters of the algorithm: Tol3D = 1.e-04, Tol2D =sqr(tol3d) | |

52 | -- , InternalContinuity = GeomAbs_C2, MaxDegree = 14, MaxSeg = 16. | |

53 | ||

54 | Init(me: in out; S: Shape from TopoDS) | |

55 | ---Purpose: Initializes the empty constructor framework with the shape S. | |

56 | is static; | |

57 | ||

58 | Add(me: in out; ToProj: Shape from TopoDS) | |

59 | ---Purpose: Adds the shape ToProj to the framework for calculation | |

60 | -- of the projection by Compute3d. | |

61 | -- ToProj is an edge or a wire and will be projected onto the basis shape. | |

62 | -- Exceptions | |

63 | -- Standard_ConstructionError if ToProj is not added. | |

64 | raises ConstructionError from Standard | |

65 | is static; | |

66 | ||

67 | SetParams(me : in out; Tol3D, Tol2D : Real from Standard; | |

68 | InternalContinuity : Shape from GeomAbs; | |

69 | MaxDegree , MaxSeg : Integer from Standard) | |

70 | ---Purpose: Sets the parameters used for computation | |

71 | -- Tol3 is the requiered tolerance between the 3d projected | |

72 | -- curve and its 2d representation | |

73 | -- InternalContinuity is the order of constraints | |

74 | -- used for approximation | |

75 | -- MaxDeg and MaxSeg are the maximum degree and the maximum | |

76 | -- number of segment for BSpline resulting of an approximation. | |

77 | ||

78 | is static; | |

79 | ||

80 | SetMaxDistance(me: in out; MaxDist: Real from Standard) | |

81 | ---Purpose: Sets the maximum distance between target shape and | |

82 | -- shape to project. If this condition is not satisfied then corresponding | |

83 | -- part of solution is discarded. | |

84 | -- if MaxDist < 0 then this method does not affect the algorithm | |

85 | is static; | |

86 | ||

87 | SetLimit(me : in out; FaceBoundaries: Boolean from Standard = Standard_True) | |

88 | ---Purpose: Manage limitation of projected edges. | |

89 | --By default edges are limited by face boundaries, | |

90 | --else they are limited by supporting surface boundaries. | |

91 | is static; | |

92 | ||

93 | Compute3d(me: in out; With3d: Boolean from Standard = Standard_True) | |

94 | ---Purpose: Returns true if a 3D curve is computed. If not, false is | |

95 | -- returned and an initial 3D curve is kept to build the resulting edges. | |

96 | is static; | |

97 | ||

98 | Build(me: in out) | |

99 | is redefined; | |

100 | ---Purpose: Builds the result of the projection as a compound of | |

101 | -- wires. Tries to build oriented wires. | |

102 | ||

103 | ||

104 | IsDone(me) | |

105 | ---Purpose: | |

106 | returns Boolean from Standard | |

107 | is redefined static; | |

108 | ---Purpose: Returns true if the object was correctly built by the shape | |

109 | -- construction algorithm. | |

110 | -- If at the construction time of the shape, the algorithm | |

111 | -- cannot be completed, or the original data is corrupted, | |

112 | -- IsDone returns false and therefore protects the use of | |

113 | -- functions to access the result of the construction | |

114 | -- (typically the Shape function). | |

115 | ||

116 | Projection(me) | |

117 | ---Purpose: Performs the projection. | |

118 | -- The construction of the result is performed by Build. | |

119 | -- Exceptions | |

120 | -- StdFail_NotDone if the projection was not performed. | |

121 | returns Shape from TopoDS | |

122 | ---C++: return const& | |

123 | raises NotDone from StdFail | |

124 | is static; | |

125 | ||

126 | Couple(me; E: Edge from TopoDS) | |

127 | ---Purpose: Returns the initial face corresponding to the projected edge E. | |

128 | -- Exceptions | |

129 | -- StdFail_NotDone if no face was found. | |

130 | -- Standard_NoSuchObject if if a face corresponding to | |

131 | -- E has already been found. | |

132 | returns Shape from TopoDS | |

133 | ---C++: return const& | |

134 | raises NotDone from StdFail, | |

135 | NoSuchObject from Standard | |

136 | is static; | |

137 | ||

138 | Generated (me: in out; S : Shape from TopoDS) | |

139 | ---Purpose: Returns the list of shapes generated from the | |

140 | -- shape <S>. | |

141 | ---C++: return const & | |

142 | ---Level: Public | |

143 | returns ListOfShape from TopTools | |

144 | is redefined; | |

145 | ||

146 | ||

147 | Ancestor(me; E: Edge from TopoDS) | |

148 | ---Purpose: Returns the initial edge corresponding to the edge E | |

149 | -- resulting from the computation of the projection. | |

150 | -- Exceptions | |

151 | -- StdFail_NotDone if no edge was found. | |

152 | -- Standard_NoSuchObject if an edge corresponding to | |

153 | -- E has already been found. | |

154 | returns Shape from TopoDS | |

155 | ---C++: return const& | |

156 | raises NotDone from StdFail, | |

157 | NoSuchObject from Standard | |

158 | is static; | |

159 | ||

160 | BuildWire(me; Liste : out ListOfShape from TopTools) | |

161 | returns Boolean from Standard | |

162 | is static; | |

163 | --- Purpose : build the result as a list of wire if possible in -- | |

164 | -- a first returns a wire only if there is only a wire. | |

165 | fields | |

166 | ||

167 | myNormalProjector : NormalProjection from BRepAlgo; | |

168 | ||

169 | end NormalProjection; |