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

b311480e | 1 | -- Created on: 1998-04-08 |

2 | -- Created by: Philippe MANGIN | |

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

4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS | |

5 | -- | |

6 | -- The content of this file is subject to the Open CASCADE Technology Public | |

7 | -- License Version 6.5 (the "License"). You may not use the content of this file | |

8 | -- except in compliance with the License. Please obtain a copy of the License | |

9 | -- at http://www.opencascade.org and read it completely before using this file. | |

10 | -- | |

11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |

12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |

13 | -- | |

14 | -- The Original Code and all software distributed under the License is | |

15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the | |

16 | -- Initial Developer hereby disclaims all such warranties, including without | |

17 | -- limitation, any warranties of merchantability, fitness for a particular | |

18 | -- purpose or non-infringement. Please see the License for the specific terms | |

19 | -- and conditions governing the rights and limitations under the License. | |

20 | ||

7fd59977 | 21 | |

22 | ||

23 | class MakePipeShell from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI | |

24 | ||

25 | ---Purpose: This class provides for a framework to construct a shell | |

26 | -- or a solid along a spine consisting in a wire. | |

27 | -- To produce a solid, the initial wire must be closed. | |

28 | -- Two approaches are used: | |

29 | -- - definition by section | |

30 | -- - by a section and a scaling law | |

31 | -- - by addition of successive intermediary sections | |

32 | -- - definition by sweep mode. | |

33 | -- - pseudo-Frenet | |

34 | -- - constant | |

35 | -- - binormal constant | |

36 | -- - normal defined by a surface support | |

37 | -- - normal defined by a guiding contour. | |

38 | -- The two global approaches can also be combined. | |

39 | -- You can also close the surface later in order to form a solid. | |

40 | -- Warning: In this version some limitation exist | |

41 | -- -- We can add only 1 Section (else Standard_NotImplemented is raised | |

42 | -- -- Mode with auxilary spine is incompatible with hometetic laws | |

43 | -- -- Mode with auxilary spine and keep contact produce only CO surface. | |

44 | -- -- Transition treatement is implemented only with the option <BRepBuilderAPI_Transformed> | |

45 | -- Normaly all these limitations have to be deleted in mext version. | |

46 | uses | |

47 | Dir from gp, | |

48 | Ax2 from gp, | |

49 | Function from Law, | |

50 | ListOfShape from TopTools, | |

51 | Shape from TopoDS, | |

52 | Wire from TopoDS, | |

53 | Vertex from TopoDS, | |

54 | TransitionMode from BRepBuilderAPI, | |

55 | PipeError from BRepBuilderAPI, | |

56 | PipeShell from BRepFill | |

57 | ||

58 | raises | |

59 | DomainError from Standard, | |

60 | NotDone from StdFail | |

61 | ||

62 | is | |

63 | Create( Spine : Wire from TopoDS) | |

64 | --- Purpose: Constructs the shell-generating framework defined by the wire Spine. | |

65 | returns MakePipeShell from BRepOffsetAPI; | |

66 | ||

67 | ---Purpose: Sets an sweep's mode | |

68 | -- If no mode are setted, the mode use in MakePipe is used | |

69 | ---See Also: GeomFill_IsCorrectedFrenet | |

70 | ||

71 | SetMode(me : in out; IsFrenet : Boolean = Standard_False); | |

72 | ---Purpose: Sets a Frenet or a CorrectedFrenet trihedron | |

73 | -- to perform the sweeping | |

74 | -- If IsFrenet is false, a corrected Frenet trihedron is used. | |

75 | ||

76 | SetMode(me : in out; Axe : Ax2 from gp); | |

77 | ---Purpose: Sets a fixed trihedron to perform the sweeping | |

78 | -- all sections will be parallel. | |

79 | ||

80 | ||

81 | SetMode(me : in out; BiNormal : Dir from gp); | |

82 | ---Purpose: Sets a fixed BiNormal direction to perform the -- | |

83 | -- sweeping. Angular relations beetween the | |

84 | -- section(s) and <BiNormal> will be constant | |

85 | ||

86 | ||

87 | SetMode(me : in out; SpineSupport : Shape from TopoDS) | |

88 | ---Purpose: Sets support to the spine to define the BiNormal of | |

89 | -- the trihedron, like the normal to the surfaces. | |

90 | -- Warning: To be effective, Each edge of the <spine> must | |

91 | -- have an representaion on one face of<SpineSupport> | |

92 | returns Boolean; | |

93 | ||

94 | SetMode(me : in out; | |

95 | AuxiliarySpine : Wire from TopoDS; | |

96 | CurvilinearEquivalence : Boolean; | |

97 | KeepContact : Boolean = Standard_False ); | |

98 | ||

99 | ---Purpose: Sets an auxiliary spine to define the Normal | |

100 | -- For each Point of the Spine P, an Point Q is evalued | |

101 | -- on <AuxiliarySpine> | |

102 | -- If <CurvilinearEquivalence> | |

103 | -- Q split <AuxiliarySpine> with the same length ratio | |

104 | -- than P split <Spline>. | |

105 | -- Else the plan define by P and the tangent to the <Spine> | |

106 | -- intersect <AuxiliarySpine> in Q. | |

107 | -- If <KeepContact> the Normal is defined to assume like the sweeped | |

108 | -- section is in contact to the <AuxiliarySpine> | |

109 | -- Else the Normal is defined by the vector PQ. | |

110 | ||

111 | ---Level: Public | |

112 | ||

113 | -- ================================= | |

114 | -- Methodes to define section(s) | |

115 | -- ================================= | |

116 | ---Purpose: Give section to sweep. | |

117 | -- Possibilities are : | |

118 | -- - Give one or sevral section | |

119 | -- - Give one profile and an homotetic law. | |

120 | -- - Automatic compute of correspondance beetween spine, and section | |

121 | -- on the sweeped shape | |

122 | -- - correspondance beetween spine, and section on the sweeped shape | |

123 | -- defined by a vertex of the spine | |

124 | ||

125 | -- Option is : | |

126 | -- -"WithContact" : The section is translated to be in | |

127 | -- contact with the spine | |

128 | ||

129 | -- -"WithCorrection" The section is rotated to have a Normal -- | |

130 | -- parallel to the trihedron's normal and have tangent | |

131 | -- perpendicular to the trihedron's tangent. | |

132 | ||

133 | ||

134 | Add(me:in out; | |

135 | Profile : Shape from TopoDS; | |

136 | WithContact : Boolean = Standard_False; | |

137 | WithCorrection : Boolean = Standard_False ); | |

138 | ---Purpose: Adds the section Profile to this framework. First and last | |

139 | -- sections may be punctual, so the shape Profile may be | |

140 | -- both wire and vertex. Correspondent point on spine is | |

141 | -- computed automatically. | |

142 | -- If WithContact is true, the section is translated to be in | |

143 | -- contact with the spine. | |

144 | -- If WithCorrection is true, the section is rotated to be | |

145 | -- orthogonal to the spine?s tangent in the correspondent | |

146 | -- point. This option has no sense if the section is punctual | |

147 | -- (Profile is of type TopoDS_Vertex). | |

148 | ||

149 | Add(me:in out; | |

150 | Profile : Shape from TopoDS; | |

151 | Location : Vertex from TopoDS; | |

152 | WithContact : Boolean = Standard_False; | |

153 | WithCorrection : Boolean = Standard_False) | |

154 | ---Purpose: Adds the section Profile to this framework. | |

155 | -- Correspondent point on the spine is given by Location. | |

156 | -- Warning: | |

157 | -- To be effective, it is not recommended to combine methods Add and SetLaw. | |

158 | raises DomainError; | |

159 | ||

160 | SetLaw(me :in out; | |

161 | Profile : Shape from TopoDS; | |

162 | L : Function from Law; | |

163 | WithContact : Boolean = Standard_False; | |

164 | WithCorrection : Boolean = Standard_False); | |

165 | ---Purpose: Sets the evolution law defined by the wire Profile with | |

166 | -- its position (Location, WithContact, WithCorrection | |

167 | -- are the same options as in methods Add) and a | |

168 | -- homotetic law defined by the function L. | |

169 | -- Warning: | |

170 | -- To be effective, it is not recommended to combine methods Add and SetLaw. | |

171 | ||

172 | ||

173 | SetLaw(me :in out; | |

174 | Profile : Shape from TopoDS; | |

175 | L : Function from Law; | |

176 | Location : Vertex from TopoDS; | |

177 | WithContact : Boolean = Standard_False; | |

178 | WithCorrection : Boolean = Standard_False); | |

179 | ---Purpose: Sets the evolution law defined by the wire Profile with | |

180 | -- its position (Location, WithContact, WithCorrection | |

181 | -- are the same options as in methods Add) and a | |

182 | -- homotetic law defined by the function L. | |

183 | -- Warning: | |

184 | -- To be effective, it is not recommended to combine methods Add and SetLaw. | |

185 | ||

186 | Delete(me : in out; Profile : Shape) ; | |

187 | ---Purpose: Removes the section Profile from this framework. | |

188 | ||

189 | -- ======================================== | |

190 | -- Methodes to perform and read shape | |

191 | -- ======================================== | |

192 | IsReady(me) | |

193 | ---Purpose: Returns true if this tool object is ready to build the | |

194 | -- shape, i.e. has a definition for the wire section Profile. | |

195 | returns Boolean; | |

196 | ||

197 | GetStatus(me) | |

198 | ---Purpose: Get a status, when Simulate or Build failed. It can be | |

199 | -- BRepBuilderAPI_PipeDone, | |

200 | -- BRepBuilderAPI_PipeNotDone, | |

201 | -- BRepBuilderAPI_PlaneNotIntersectGuide, | |

202 | -- BRepBuilderAPI_ImpossibleContact. | |

203 | returns PipeError from BRepBuilderAPI; | |

204 | ||

205 | ||

206 | SetTolerance(me : in out; | |

207 | Tol3d : Real = 1.0e-4; | |

208 | BoundTol : Real = 1.0e-4; | |

209 | TolAngular : Real = 1.0e-2); | |

210 | ---Purpose: Sets the following tolerance values | |

211 | -- - 3D tolerance Tol3d | |

212 | -- - boundary tolerance BoundTol | |

213 | -- - angular tolerance TolAngular. | |

214 | ||

215 | SetTransitionMode(me : in out; | |

216 | Mode :TransitionMode from BRepBuilderAPI = BRepBuilderAPI_Transformed) | |

217 | ---Purpose: Sets the transition mode to manage discontinuities on | |

218 | -- the swept shape caused by fractures on the spine. The | |

219 | -- transition mode can be BRepBuilderAPI_Transformed | |

220 | -- (default value), BRepBuilderAPI_RightCorner, | |

221 | -- BRepBuilderAPI_RoundCorner: | |

222 | -- - RepBuilderAPI_Transformed: | |

223 | -- discontinuities are treated by | |

224 | -- modification of the sweeping mode. The | |

225 | -- pipe is "transformed" at the fractures of | |

226 | -- the spine. This mode assumes building a | |

227 | -- self-intersected shell. | |

228 | -- - BRepBuilderAPI_RightCorner: | |

229 | -- discontinuities are treated like right | |

230 | -- corner. Two pieces of the pipe | |

231 | -- corresponding to two adjacent | |

232 | -- segments of the spine are extended | |

233 | -- and intersected at a fracture of the spine. | |

234 | -- - BRepBuilderAPI_RoundCorner: | |

235 | -- discontinuities are treated like round | |

236 | -- corner. The corner is treated as rotation | |

237 | -- of the profile around an axis which | |

238 | -- passes through the point of the spine?s | |

239 | -- fracture. This axis is based on cross | |

240 | -- product of directions tangent to the | |

241 | -- adjacent segments of the spine at their common point. | |

242 | -- Warnings | |

243 | -- The mode BRepBuilderAPI_RightCorner provides a | |

244 | -- valid result if intersection of two pieces of the pipe | |

245 | -- (corresponding to two adjacent segments of the spine) | |

246 | -- in the neighborhood of the spine?s fracture is | |

247 | -- connected and planar. This condition can be violated if | |

248 | -- the spine is non-linear in some neighborhood of the | |

249 | -- fracture or if the profile was set with a scaling law. | |

250 | -- The last mode, BRepBuilderAPI_RoundCorner, will | |

251 | -- assuredly provide a good result only if a profile was set | |

252 | -- with option WithCorrection = True, i.e. it is strictly | |

253 | -- orthogonal to the spine. | |

254 | ||

255 | is static; | |

256 | ||

257 | Simulate(me : in out; | |

258 | NumberOfSection : Integer; | |

259 | Result : out ListOfShape from TopTools) | |

260 | ---Purpose: Simulates the resulting shape by calculating its | |

261 | -- cross-sections. The spine is devided by this | |

262 | -- cross-sections into (NumberOfSection - 1) equal | |

263 | -- parts, the number of cross-sections is | |

264 | -- NumberOfSection. The cross-sections are wires and | |

265 | -- they are returned in the list Result. | |

266 | -- This gives a rapid preview of the resulting shape, | |

267 | -- which will be obtained using the settings you have provided. | |

268 | -- Raises NotDone if <me> it is not Ready | |

269 | raises NotDone; | |

270 | ||

271 | Build(me : in out) | |

272 | ---Purpose: Builds the resulting shape (redefined from MakeShape). | |

273 | ---Level: Public | |

274 | raises NotDone -- If <me> it is not Ready | |

275 | is redefined; | |

276 | ||

277 | MakeSolid(me : in out) | |

278 | ---Purpose: Transforms the sweeping Shell in Solid. | |

279 | -- If a propfile is not closed returns False | |

280 | returns Boolean | |

281 | raises NotDone; | |

282 | ||

283 | FirstShape (me : in out) | |

284 | ---Purpose: Returns the TopoDS Shape of the bottom of the sweep. | |

285 | returns Shape from TopoDS | |

286 | is redefined; | |

287 | ||

288 | LastShape (me : in out) | |

289 | ---Purpose: Returns the TopoDS Shape of the top of the sweep. | |

290 | returns Shape from TopoDS | |

291 | is redefined; | |

292 | ||

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

294 | ---Purpose: Returns a list of new shapes generated from the shape | |

295 | -- S by the shell-generating algorithm. | |

296 | -- This function is redefined from BRepOffsetAPI_MakeShape::Generated. | |

297 | -- S can be an edge of the given Spine (see Constructor), | |

298 | -- it can be an edge or a boundary vertex of a shape | |

299 | -- returned by the method FirstShape(), it can also be a | |

300 | -- Profile (see method Add()) closest to the beginning or | |

301 | -- the end of the Spine. | |

302 | -- If S is an edge of the given Spine, then method | |

303 | -- Generated() returns a list of generated faces and a list | |

304 | -- of edges from a free boundary (if it exists) of the | |

305 | -- resulting shell. | |

306 | -- If S is an edge of the start shape (see FirstShape()), | |

307 | -- method Generated() returns a list of faces generated | |

308 | -- along the whole spine from the given edge. | |

309 | -- If S is a boundary vertex of the start shape (see | |

310 | -- FirstShape()), method Generated() returns a list of | |

311 | -- edges from the free boundary of the resulting shell, | |

312 | -- generated along the whole spine. | |

313 | -- If S is a Profile closest to the beginning of the Spine, | |

314 | -- method Generated() returns the start shape, that can | |

315 | -- also be obtained by method FirstShape(). | |

316 | -- If S is a Profile closest to the end of the Spine, method | |

317 | -- Generated() returns the end shape, that can also be | |

318 | -- obtained by method LastShape(). | |

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

320 | returns ListOfShape from TopTools | |

321 | is redefined; | |

322 | ||

323 | fields | |

324 | myPipe : PipeShell from BRepFill; | |

325 | ||

326 | end MakePipeShell; | |

327 | ||

328 | ||

329 |