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

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

2 | -- Created by: Philippe MANGIN | |

3 | -- Copyright (c) 1998-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 MakePipeShell from BRepOffsetAPI inherits MakeSweep from BRepPrimAPI | |

18 | ||

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

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

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

22 | -- Two approaches are used: | |

23 | -- - definition by section | |

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

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

26 | -- - definition by sweep mode. | |

27 | -- - pseudo-Frenet | |

28 | -- - constant | |

29 | -- - binormal constant | |

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

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

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

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

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

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

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

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

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

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

40 | uses | |

41 | Dir from gp, | |

42 | Ax2 from gp, | |

43 | Function from Law, | |

44 | ListOfShape from TopTools, | |

45 | Shape from TopoDS, | |

46 | Wire from TopoDS, | |

47 | Vertex from TopoDS, | |

48 | TransitionMode from BRepBuilderAPI, | |

49 | PipeError from BRepBuilderAPI, | |

f9032cf2 | 50 | PipeShell from BRepFill, |

51 | TypeOfContact from BRepFill | |

7fd59977 | 52 | |

53 | raises | |

54 | DomainError from Standard, | |

55 | NotDone from StdFail | |

56 | ||

57 | is | |

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

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

60 | returns MakePipeShell from BRepOffsetAPI; | |

61 | ||

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

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

64 | ---See Also: GeomFill_IsCorrectedFrenet | |

65 | ||

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

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

68 | -- to perform the sweeping | |

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

70 | ||

a31abc03 | 71 | SetDiscreteMode(me : in out); |

72 | ---Purpose: Sets a Discrete trihedron | |

73 | -- to perform the sweeping | |

74 | ||

7fd59977 | 75 | SetMode(me : in out; Axe : Ax2 from gp); |

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

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

78 | ||

79 | ||

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

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

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

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

84 | ||

85 | ||

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

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

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

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

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

91 | returns Boolean; | |

92 | ||

93 | SetMode(me : in out; | |

94 | AuxiliarySpine : Wire from TopoDS; | |

95 | CurvilinearEquivalence : Boolean; | |

f9032cf2 | 96 | KeepContact : TypeOfContact from BRepFill = BRepFill_NoContact ); |

7fd59977 | 97 | |

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

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

100 | -- on <AuxiliarySpine> | |

101 | -- If <CurvilinearEquivalence> | |

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

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

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

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

2a62d883 | 106 | -- If <KeepContact> equals BRepFill_NoContact: The Normal is defined |

107 | -- by the vector PQ. | |

108 | -- If <KeepContact> equals BRepFill_Contact: The Normal is defined to | |

109 | -- achieve that the sweeped section is in contact to the | |

110 | -- auxiliarySpine. The width of section is constant all along the path. | |

111 | -- In other words, the auxiliary spine lies on the swept surface, | |

112 | -- but not necessarily is a boundary of this surface. However, | |

113 | -- the auxiliary spine has to be close enough to the main spine | |

114 | -- to provide intersection with any section all along the path. | |

115 | -- If <KeepContact> equals BRepFill_ContactOnBorder: The auxiliary spine | |

116 | -- becomes a boundary of the swept surface and the width of section varies | |

117 | -- along the path. | |

7fd59977 | 118 | |

119 | ---Level: Public | |

120 | ||

a31abc03 | 121 | |

7fd59977 | 122 | -- ================================= |

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

124 | -- ================================= | |

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

126 | -- Possibilities are : | |

127 | -- - Give one or sevral section | |

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

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

130 | -- on the sweeped shape | |

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

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

133 | ||

134 | -- Option is : | |

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

136 | -- contact with the spine | |

137 | ||

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

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

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

141 | ||

142 | ||

143 | Add(me:in out; | |

144 | Profile : Shape from TopoDS; | |

145 | WithContact : Boolean = Standard_False; | |

146 | WithCorrection : Boolean = Standard_False ); | |

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

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

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

150 | -- computed automatically. | |

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

152 | -- contact with the spine. | |

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

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

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

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

157 | ||

158 | Add(me:in out; | |

159 | Profile : Shape from TopoDS; | |

160 | Location : Vertex from TopoDS; | |

161 | WithContact : Boolean = Standard_False; | |

162 | WithCorrection : Boolean = Standard_False) | |

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

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

165 | -- Warning: | |

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

167 | raises DomainError; | |

168 | ||

169 | SetLaw(me :in out; | |

170 | Profile : Shape from TopoDS; | |

171 | L : Function from Law; | |

172 | WithContact : Boolean = Standard_False; | |

173 | WithCorrection : Boolean = Standard_False); | |

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

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

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

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

178 | -- Warning: | |

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

180 | ||

181 | ||

182 | SetLaw(me :in out; | |

183 | Profile : Shape from TopoDS; | |

184 | L : Function from Law; | |

185 | Location : Vertex from TopoDS; | |

186 | WithContact : Boolean = Standard_False; | |

187 | WithCorrection : Boolean = Standard_False); | |

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

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

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

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

192 | -- Warning: | |

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

194 | ||

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

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

197 | ||

198 | -- ======================================== | |

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

200 | -- ======================================== | |

201 | IsReady(me) | |

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

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

204 | returns Boolean; | |

205 | ||

206 | GetStatus(me) | |

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

208 | -- BRepBuilderAPI_PipeDone, | |

209 | -- BRepBuilderAPI_PipeNotDone, | |

210 | -- BRepBuilderAPI_PlaneNotIntersectGuide, | |

211 | -- BRepBuilderAPI_ImpossibleContact. | |

212 | returns PipeError from BRepBuilderAPI; | |

213 | ||

214 | ||

215 | SetTolerance(me : in out; | |

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

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

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

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

220 | -- - 3D tolerance Tol3d | |

221 | -- - boundary tolerance BoundTol | |

222 | -- - angular tolerance TolAngular. | |

223 | ||

e9216c6a | 224 | |

225 | ||

226 | -- ============================================ | |

227 | -- Methods to set parameters for approximation | |

228 | -- ============================================ | |

229 | SetMaxDegree(me : in out; | |

230 | NewMaxDegree : Integer from Standard); | |

231 | ---Purpose: Define the maximum V degree of resulting surface | |

232 | ||

233 | SetMaxSegments(me : in out; | |

234 | NewMaxSegments : Integer from Standard); | |

235 | ---Purpose: Define the maximum number of spans in V-direction | |

236 | -- on resulting surface | |

237 | ||

a31abc03 | 238 | SetForceApproxC1(me : in out; |

239 | ForceApproxC1 : Boolean from Standard); | |

240 | ---Purpose: Set the flag that indicates attempt to approximate | |

241 | -- a C1-continuous surface if a swept surface proved | |

242 | -- to be C0. | |

243 | ||

7fd59977 | 244 | SetTransitionMode(me : in out; |

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

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

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

248 | -- transition mode can be BRepBuilderAPI_Transformed | |

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

250 | -- BRepBuilderAPI_RoundCorner: | |

251 | -- - RepBuilderAPI_Transformed: | |

252 | -- discontinuities are treated by | |

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

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

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

256 | -- self-intersected shell. | |

257 | -- - BRepBuilderAPI_RightCorner: | |

258 | -- discontinuities are treated like right | |

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

260 | -- corresponding to two adjacent | |

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

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

263 | -- - BRepBuilderAPI_RoundCorner: | |

264 | -- discontinuities are treated like round | |

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

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

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

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

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

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

271 | -- Warnings | |

272 | -- The mode BRepBuilderAPI_RightCorner provides a | |

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

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

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

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

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

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

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

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

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

282 | -- orthogonal to the spine. | |

283 | ||

284 | is static; | |

285 | ||

286 | Simulate(me : in out; | |

287 | NumberOfSection : Integer; | |

288 | Result : out ListOfShape from TopTools) | |

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

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

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

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

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

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

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

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

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

298 | raises NotDone; | |

299 | ||

300 | Build(me : in out) | |

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

302 | ---Level: Public | |

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

304 | is redefined; | |

305 | ||

306 | MakeSolid(me : in out) | |

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

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

309 | returns Boolean | |

310 | raises NotDone; | |

311 | ||

312 | FirstShape (me : in out) | |

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

314 | returns Shape from TopoDS | |

315 | is redefined; | |

316 | ||

317 | LastShape (me : in out) | |

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

319 | returns Shape from TopoDS | |

320 | is redefined; | |

321 | ||

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

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

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

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

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

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

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

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

330 | -- the end of the Spine. | |

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

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

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

334 | -- resulting shell. | |

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

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

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

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

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

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

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

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

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

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

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

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

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

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

349 | returns ListOfShape from TopTools | |

350 | is redefined; | |

351 | ||

73920cd4 | 352 | ErrorOnSurface (me) |

353 | returns Real from Standard; | |

354 | ||

7fd59977 | 355 | fields |

f9032cf2 | 356 | |

7fd59977 | 357 | myPipe : PipeShell from BRepFill; |

358 | ||

359 | end MakePipeShell; | |

360 | ||

361 | ||

362 |