| 1 | -- Created by: Peter KURNEV |
| 2 | -- Copyright (c) 2010-2014 OPEN CASCADE SAS |
| 3 | -- Copyright (c) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE |
| 4 | -- Copyright (c) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, |
| 5 | -- EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS |
| 6 | -- |
| 7 | -- This file is part of Open CASCADE Technology software library. |
| 8 | -- |
| 9 | -- This library is free software; you can redistribute it and / or modify it |
| 10 | -- under the terms of the GNU Lesser General Public version 2.1 as published |
| 11 | -- by the Free Software Foundation, with special exception defined in the file |
| 12 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
| 13 | -- distribution for complete text of the license and disclaimer of any warranty. |
| 14 | -- |
| 15 | -- Alternatively, this file may be used under the terms of Open CASCADE |
| 16 | -- commercial license or contractual agreement. |
| 17 | |
| 18 | class AlgoTools from BOPTools |
| 19 | ---Purpose: |
| 20 | |
| 21 | uses |
| 22 | Pnt from gp, |
| 23 | Pnt2d from gp, |
| 24 | Dir from gp, |
| 25 | Plane from Geom, |
| 26 | State from TopAbs, |
| 27 | ShapeEnum from TopAbs, |
| 28 | Curve from IntTools, |
| 29 | Shape from TopoDS, |
| 30 | Vertex from TopoDS, |
| 31 | Edge from TopoDS, |
| 32 | Face from TopoDS, |
| 33 | Wire from TopoDS, |
| 34 | Solid from TopoDS, |
| 35 | -- |
| 36 | BaseAllocator from BOPCol, |
| 37 | ListOfShape from BOPCol, |
| 38 | IndexedMapOfShape from BOPCol, |
| 39 | IndexedDataMapOfShapeListOfShape from BOPCol, |
| 40 | Context from BOPInt, |
| 41 | ListOfCoupleOfShape from BOPTools, |
| 42 | Range from IntTools |
| 43 | |
| 44 | --raises |
| 45 | |
| 46 | is |
| 47 | ComputeVV(myclass; |
| 48 | aV1:Vertex from TopoDS; |
| 49 | aP2:Pnt from gp; |
| 50 | aTolP2:Real from Standard) |
| 51 | returns Integer from Standard; |
| 52 | |
| 53 | ComputeVV(myclass; |
| 54 | aV1:Vertex from TopoDS; |
| 55 | aV2:Vertex from TopoDS) |
| 56 | returns Integer from Standard; |
| 57 | |
| 58 | MakeVertex (myclass; |
| 59 | aLV: out ListOfShape from BOPCol; |
| 60 | aV : out Vertex from TopoDS); |
| 61 | |
| 62 | MakeEdge(myclass; |
| 63 | theCurve:Curve from IntTools; |
| 64 | theV1: Vertex from TopoDS; |
| 65 | theT1: Real from Standard; |
| 66 | theV2: Vertex from TopoDS; |
| 67 | theT2: Real from Standard; |
| 68 | theTolR3D: Real from Standard; |
| 69 | theE :out Edge from TopoDS); |
| 70 | |
| 71 | MakePCurve(myclass; |
| 72 | theE : Edge from TopoDS; |
| 73 | theF1: Face from TopoDS; |
| 74 | theF2: Face from TopoDS; |
| 75 | theCurve:Curve from IntTools; |
| 76 | thePC1:Boolean from Standard; |
| 77 | thePC2:Boolean from Standard); |
| 78 | |
| 79 | MakeContainer(myclass; |
| 80 | theType:ShapeEnum from TopAbs; |
| 81 | theShape:out Shape from TopoDS); |
| 82 | |
| 83 | |
| 84 | IsHole(myclass; |
| 85 | aW: Shape from TopoDS; |
| 86 | aF: Shape from TopoDS) |
| 87 | returns Boolean from Standard; |
| 88 | |
| 89 | IsSplitToReverse(myclass; |
| 90 | theSplit : Shape from TopoDS; |
| 91 | theShape : Shape from TopoDS; |
| 92 | theContext:out Context from BOPInt) |
| 93 | ---Purpose: Returns True if the shape theSplit has opposite |
| 94 | -- direction than theShape |
| 95 | -- theContext - cashed geometrical tools |
| 96 | returns Boolean from Standard; |
| 97 | |
| 98 | IsSplitToReverse(myclass; |
| 99 | theSplit : Face from TopoDS; |
| 100 | theShape : Face from TopoDS; |
| 101 | theContext:out Context from BOPInt) |
| 102 | ---Purpose: Returns True if normal direction of the face |
| 103 | -- theShape is not the same as for the face |
| 104 | -- theSplit |
| 105 | -- theContext - cashed geometrical tools |
| 106 | returns Boolean from Standard; |
| 107 | |
| 108 | IsSplitToReverse (myclass; |
| 109 | aE1: Edge from TopoDS; |
| 110 | aE2: Edge from TopoDS; |
| 111 | aContext:out Context from BOPInt) |
| 112 | returns Boolean from Standard; |
| 113 | |
| 114 | |
| 115 | AreFacesSameDomain(myclass; |
| 116 | theF1: Face from TopoDS; |
| 117 | theF2: Face from TopoDS; |
| 118 | theContext:out Context from BOPInt) |
| 119 | returns Boolean from Standard; |
| 120 | |
| 121 | CheckSameGeom (myclass; |
| 122 | theF1: Face from TopoDS; |
| 123 | theF2: Face from TopoDS; |
| 124 | theContext:out Context from BOPInt) |
| 125 | returns Boolean from Standard; |
| 126 | |
| 127 | Sense (myclass; |
| 128 | theF1: Face from TopoDS; |
| 129 | theF2: Face from TopoDS) |
| 130 | returns Integer from Standard; |
| 131 | |
| 132 | GetEdgeOff (myclass; |
| 133 | theEdge :Edge from TopoDS; |
| 134 | theFace :Face from TopoDS; |
| 135 | theEdgeOff :out Edge from TopoDS) |
| 136 | ---Purpose: Returns True if the face theFace contains |
| 137 | -- the edge theEdge but with opposite orientation. |
| 138 | -- If the method returns True theEdgeOff is the |
| 139 | -- edge founded |
| 140 | returns Boolean from Standard; |
| 141 | |
| 142 | GetFaceOff(myclass; |
| 143 | theEdge :Edge from TopoDS; |
| 144 | theFace :Face from TopoDS; |
| 145 | theLCEF :out ListOfCoupleOfShape from BOPTools; |
| 146 | theFaceOff :out Face from TopoDS; |
| 147 | theContext :out Context from BOPInt) |
| 148 | returns Boolean from Standard; |
| 149 | |
| 150 | ---Purpose: For the face theFace and its edge theEdge |
| 151 | -- finds the face suitable to produce shell. |
| 152 | -- theLCEF - set of faces to search. All faces |
| 153 | -- from theLCEF must share edge theEdge |
| 154 | |
| 155 | IsInternalFace(myclass; |
| 156 | theFace :Face from TopoDS; |
| 157 | theEdge :Edge from TopoDS; |
| 158 | theFace1 :Face from TopoDS; |
| 159 | theFace2 :Face from TopoDS; |
| 160 | theContext:out Context from BOPInt) |
| 161 | ---Purpose: Returns True if the face theFace is inside of the |
| 162 | -- couple of faces theFace1, theFace2. |
| 163 | -- The faces theFace, theFace1, theFace2 must |
| 164 | -- share the edge theEdge |
| 165 | returns Integer from Standard; |
| 166 | |
| 167 | IsInternalFace(myclass; |
| 168 | theFace :Face from TopoDS; |
| 169 | theEdge :Edge from TopoDS; |
| 170 | theLF :out ListOfShape from BOPCol; |
| 171 | theContext:out Context from BOPInt) |
| 172 | ---Purpose: Returns True if the face theFace is inside of the |
| 173 | -- appropriate couple of faces (from the set theLF) . |
| 174 | -- The faces of the set theLF and theFace must |
| 175 | -- share the edge theEdge |
| 176 | returns Integer from Standard; |
| 177 | |
| 178 | IsInternalFace(myclass; |
| 179 | theFace :Face from TopoDS; |
| 180 | theSolid :Solid from TopoDS; |
| 181 | theMEF :out IndexedDataMapOfShapeListOfShape from BOPCol; |
| 182 | theTol :Real from Standard; |
| 183 | theContext:out Context from BOPInt) |
| 184 | ---Purpose: Returns True if the face theFace is inside the |
| 185 | -- solid theSolid. |
| 186 | -- theMEF - Map Edge/Faces for theSolid |
| 187 | -- theTol - value of precision of computation |
| 188 | -- theContext- cahed geometrical tools |
| 189 | returns Integer from Standard; |
| 190 | |
| 191 | |
| 192 | GetEdgeOnFace (myclass; |
| 193 | theEdge :Edge from TopoDS; |
| 194 | theFace :Face from TopoDS; |
| 195 | theEdgeOnF :out Edge from TopoDS) |
| 196 | ---Purpose: For the face theFace gets the edge theEdgeOnF |
| 197 | -- that is the same as theEdge |
| 198 | -- Returns True if such edge exists |
| 199 | -- Returns False if there is no such edge |
| 200 | returns Boolean from Standard; |
| 201 | |
| 202 | ComputeState(myclass; |
| 203 | thePoint :Pnt from gp; |
| 204 | theSolid :Solid from TopoDS; |
| 205 | theTol :Real from Standard; |
| 206 | theContext:out Context from BOPInt) |
| 207 | ---Purpose: Computes the 3-D state of the point thePoint |
| 208 | -- toward solid theSolid. |
| 209 | -- theTol - value of precision of computation |
| 210 | -- theContext- cahed geometrical tools |
| 211 | -- Returns 3-D state. |
| 212 | returns State from TopAbs; |
| 213 | |
| 214 | ComputeState(myclass; |
| 215 | theVertex:Vertex from TopoDS; |
| 216 | theSolid :Solid from TopoDS; |
| 217 | theTol :Real from Standard; |
| 218 | theContext:out Context from BOPInt) |
| 219 | ---Purpose: Computes the 3-D state of the vertex theVertex |
| 220 | -- toward solid theSolid. |
| 221 | -- theTol - value of precision of computation |
| 222 | -- theContext- cahed geometrical tools |
| 223 | -- Returns 3-D state. |
| 224 | returns State from TopAbs; |
| 225 | |
| 226 | ComputeState(myclass; |
| 227 | theEdge :Edge from TopoDS; |
| 228 | theSolid :Solid from TopoDS; |
| 229 | theTol :Real from Standard; |
| 230 | theContext:out Context from BOPInt) |
| 231 | ---Purpose: Computes the 3-D state of the edge theEdge |
| 232 | -- toward solid theSolid. |
| 233 | -- theTol - value of precision of computation |
| 234 | -- theContext- cahed geometrical tools |
| 235 | -- Returns 3-D state. |
| 236 | returns State from TopAbs; |
| 237 | |
| 238 | ComputeState(myclass; |
| 239 | theFace :Face from TopoDS; |
| 240 | theSolid :Solid from TopoDS; |
| 241 | theTol :Real from Standard; |
| 242 | theBounds:out IndexedMapOfShape from BOPCol; |
| 243 | theContext:out Context from BOPInt) |
| 244 | ---Purpose: Computes the 3-D state of the face theFace |
| 245 | -- toward solid theSolid. |
| 246 | -- theTol - value of precision of computation |
| 247 | -- theBounds - set of edges of theFace to avoid |
| 248 | -- theContext- cahed geometrical tools |
| 249 | -- Returns 3-D state. |
| 250 | returns State from TopAbs; |
| 251 | |
| 252 | ComputeStateByOnePoint(myclass; |
| 253 | theShape :Shape from TopoDS; |
| 254 | theSolid :Solid from TopoDS; |
| 255 | theTol :Real from Standard; |
| 256 | theContext:out Context from BOPInt) |
| 257 | ---Purpose: Computes the 3-D state of the shape theShape |
| 258 | -- toward solid theSolid. |
| 259 | -- theTol - value of precision of computation |
| 260 | -- theContext- cahed geometrical tools |
| 261 | -- Returns 3-D state. |
| 262 | returns State from TopAbs; |
| 263 | |
| 264 | MakeConnexityBlock(myclass; |
| 265 | theLS :out ListOfShape from BOPCol; |
| 266 | theMapAvoid:out IndexedMapOfShape from BOPCol; |
| 267 | theLSCB :out ListOfShape from BOPCol; |
| 268 | theAllocator:BaseAllocator from BOPCol); |
| 269 | ---Purpose: For the list of faces theLS build block |
| 270 | -- theLSCB in terms of connexity by edges |
| 271 | -- theMapAvoid - set of edges to avoid for |
| 272 | -- the treatment |
| 273 | |
| 274 | MakeConnexityBlocks(myclass; |
| 275 | theS :Shape from TopoDS; |
| 276 | theType1 :ShapeEnum from TopAbs; |
| 277 | theType2 :ShapeEnum from TopAbs; |
| 278 | theLCB :out ListOfShape from BOPCol); |
| 279 | ---Purpose: For the compound theS build the blocks |
| 280 | -- theLCB (as list of compounds) |
| 281 | -- in terms of connexity by the shapes of theType |
| 282 | |
| 283 | OrientFacesOnShell (myclass; |
| 284 | theS :out Shape from TopoDS); |
| 285 | |
| 286 | CorrectTolerances (myclass; |
| 287 | theS: Shape from TopoDS; |
| 288 | theTolMax: Real from Standard =0.0001); |
| 289 | ---Purpose: |
| 290 | --- Provides valid values of tolerances for the shape <theS> |
| 291 | --- <theTolMax> is max value of the tolerance that can be |
| 292 | --- accepted for correction. If real value of the tolerance |
| 293 | --- will be greater than <aTolMax>, the correction does not |
| 294 | --- perform. |
| 295 | --- |
| 296 | CorrectCurveOnSurface (myclass; |
| 297 | theS: Shape from TopoDS; |
| 298 | theTolMax: Real from Standard =0.0001); |
| 299 | ---Purpose: |
| 300 | --- Provides valid values of tolerances for the shape <theS> |
| 301 | --- in terms of BRepCheck_InvalidCurveOnSurface. |
| 302 | --- |
| 303 | CorrectPointOnCurve (myclass; |
| 304 | theS: Shape from TopoDS; |
| 305 | theTolMax: Real from Standard =0.0001); |
| 306 | ---Purpose: |
| 307 | --- Provides valid values of tolerances for the shape <theS> |
| 308 | --- in terms of BRepCheck_InvalidPointOnCurve. |
| 309 | --- |
| 310 | --fields |
| 311 | |
| 312 | --copy from BOPTools_AlgoTools.cdl |
| 313 | MakeNewVertex (myclass; |
| 314 | aP1 : Pnt from gp; |
| 315 | aTol: Real from Standard; |
| 316 | aNewVertex:out Vertex from TopoDS); |
| 317 | ---Purpose: |
| 318 | --- Make a vertex using 3D-point <aP1> and 3D-tolerance value <aTol> |
| 319 | --- |
| 320 | MakeNewVertex (myclass; |
| 321 | aV1,aV2: Vertex from TopoDS; |
| 322 | aNewVertex:out Vertex from TopoDS); |
| 323 | ---Purpose: |
| 324 | --- Make a vertex using couple of vertices <aV1, aV2> |
| 325 | --- |
| 326 | MakeNewVertex (myclass; |
| 327 | aE1: Edge from TopoDS; |
| 328 | aP1: Real from Standard; |
| 329 | aE2: Edge from TopoDS; |
| 330 | aP2: Real from Standard; |
| 331 | aNewVertex:out Vertex from TopoDS); |
| 332 | ---Purpose: |
| 333 | --- Make a vertex in place of intersection between two edges |
| 334 | --- <aE1, aE2> with parameters <aP1, aP2> |
| 335 | --- |
| 336 | MakeNewVertex (myclass; |
| 337 | aE1: Edge from TopoDS; |
| 338 | aP1: Real from Standard; |
| 339 | aF2: Face from TopoDS; |
| 340 | aNewVertex:out Vertex from TopoDS); |
| 341 | ---Purpose: |
| 342 | --- Make a vertex in place of intersection between the edge <aE1> |
| 343 | --- with parameter <aP1> and the face <aF2> |
| 344 | --- |
| 345 | PointOnEdge (myclass; |
| 346 | aEdge: Edge from TopoDS; |
| 347 | aPrm: Real from Standard; |
| 348 | aP:out Pnt from gp); |
| 349 | ---Purpose: |
| 350 | --- Compute a 3D-point on the edge <aEdge> at parameter <aPrm> |
| 351 | --- |
| 352 | MakeSplitEdge (myclass; |
| 353 | aE1: Edge from TopoDS; |
| 354 | aV1: Vertex from TopoDS; |
| 355 | aP1: Real from Standard; |
| 356 | aV2: Vertex from TopoDS; |
| 357 | aP2: Real from Standard; |
| 358 | aNewEdge:out Edge from TopoDS); |
| 359 | ---Purpose: |
| 360 | --- Make the edge from base edge <aE1> and two vertices <aV1,aV2> |
| 361 | --- at parameters <aP1,aP2> |
| 362 | --- |
| 363 | MakeSectEdge (myclass; |
| 364 | aIC: Curve from IntTools; |
| 365 | aV1: Vertex from TopoDS; |
| 366 | aP1: Real from Standard; |
| 367 | aV2: Vertex from TopoDS; |
| 368 | aP2: Real from Standard; |
| 369 | aNewEdge:out Edge from TopoDS); |
| 370 | ---Purpose: |
| 371 | --- Make the edge from 3D-Curve <aIC> and two vertices <aV1,aV2> |
| 372 | --- at parameters <aP1,aP2> |
| 373 | --- |
| 374 | UpdateVertex (myclass; |
| 375 | aIC: Curve from IntTools; |
| 376 | aT : Real from Standard; |
| 377 | aV : Vertex from TopoDS); |
| 378 | ---Purpose: |
| 379 | --- Update the tolerance value for vertex <aV> |
| 380 | --- taking into account the fact that <aV> lays on |
| 381 | --- the curve <aIC> |
| 382 | --- |
| 383 | UpdateVertex (myclass; |
| 384 | aE : Edge from TopoDS; |
| 385 | aT : Real from Standard; |
| 386 | aV : Vertex from TopoDS); |
| 387 | ---Purpose: |
| 388 | --- Update the tolerance value for vertex <aV> |
| 389 | --- taking into account the fact that <aV> lays on |
| 390 | --- the edge <aE> |
| 391 | --- |
| 392 | UpdateVertex (myclass; |
| 393 | aVF : Vertex from TopoDS; |
| 394 | aVN : Vertex from TopoDS); |
| 395 | ---Purpose: |
| 396 | --- Update the tolerance value for vertex <aVN> |
| 397 | --- taking into account the fact that <aVN> should |
| 398 | --- cover tolerance zone of <aVF> |
| 399 | --- |
| 400 | |
| 401 | CorrectRange (myclass; |
| 402 | aE1: Edge from TopoDS; |
| 403 | aE2: Edge from TopoDS; |
| 404 | aSR: Range from IntTools; |
| 405 | aNewSR:out Range from IntTools); |
| 406 | ---Purpose: |
| 407 | --- Correct shrunk range <aSR> taking into account 3D-curve |
| 408 | --- resolution and corresp. tolerances' values of <aE1>, <aE2> |
| 409 | --- |
| 410 | CorrectRange (myclass; |
| 411 | aE: Edge from TopoDS; |
| 412 | aF: Face from TopoDS; |
| 413 | aSR: Range from IntTools; |
| 414 | aNewSR:out Range from IntTools); |
| 415 | ---Purpose: |
| 416 | --- Correct shrunk range <aSR> taking into account 3D-curve |
| 417 | --- resolution and corresp. tolerances' values of <aE>, <aF> |
| 418 | --- |
| 419 | |
| 420 | IsBlockInOnFace(myclass; |
| 421 | aShR : Range from IntTools; |
| 422 | aF : Face from TopoDS; |
| 423 | aE : Edge from TopoDS; |
| 424 | aContext:out Context from BOPInt) |
| 425 | returns Boolean from Standard; |
| 426 | ---Purpose: |
| 427 | --- Returns TRUE if PaveBlock <aPB> lays on the face <aF>, i.e |
| 428 | --- the <PB> is IN or ON in 2D of <aF> |
| 429 | |
| 430 | IsMicroEdge(myclass; |
| 431 | theEdge : Edge from TopoDS; |
| 432 | theContext : Context from BOPInt) |
| 433 | returns Boolean from Standard; |
| 434 | ---Purpose: |
| 435 | --- Checks if it is possible to compute shrunk range for the edge <aE>. |
| 436 | --- |
| 437 | |
| 438 | CorrectShapeTolerances (myclass; |
| 439 | theS: Shape from TopoDS); |
| 440 | ---Purpose: |
| 441 | --- Corrects tolerance values of the sub-shapes of the shape <theS> if needed. |
| 442 | --- |
| 443 | |
| 444 | Dimension(myclass; |
| 445 | theS:Shape from TopoDS) |
| 446 | returns Integer from Standard; |
| 447 | ---Purpose: |
| 448 | --- Retutns dimension of the shape <theS>. |
| 449 | |
| 450 | end AlgoTools; |