# OCC.BRepAlgoAPI module

class `BRepAlgoAPI_BooleanOperation`(*args, **kwargs)

  Bases: `OCC.BRepBuilderAPI.BRepBuilderAPI_MakeShape`

  `BuilderCanWork`()

    Return type: | bool

  `Destroy`()

    Return type: | None

  `ErrorStatus`()
    - Returns the error status of operation. 0 - Ok 1 - The Object is created but Nothing is Done 2 - Null source shapes is not allowed 3 - Check types of the arguments 4 - Can not allocate memory for the DSFiller 5 - The Builder can not work with such types of arguments 6 - Unknown operation is not allowed 7 - Can not allocate memory for the Builder > 100 - See the Builder’s ErrorStatus

    Return type: | int

  `FuseEdges`()
    - Returns the flag of edge refining

    Return type: | bool

  `HasDeleted`()
    - Returns true if there is at least one deleted shape. For use in BRepNaming.

    Return type: | bool

  `HasGenerated`()
    - Returns true if there is at least one generated shape. For use in BRepNaming.

    Return type: | bool

  `HasModified`()
    - Returns true if there is at least one modified shape. For use in BRepNaming.

    Return type: | bool

  `Operation`()
    - Returns the type of Boolean Operation that has been performed.

    Return type: | BOPAlgo_Operation

  `RefineEdges`()
    - Fuse C1 edges

    Return type: | None

  `SectionEdges`()
    - Returns a list of section edges. The edges represent the result of intersection between arguments of Boolean Operation. They are computed during operation execution.

    Return type: | TopTools_ListOfShape

  `SetOperation`()
    - Sets the type of Boolean operation to perform It can be BOPAlgo_SECTION BOPAlgo_COMMON BOPAlgo_FUSE BOPAlgo_CUT BOPAlgo_CUT21

    Parameters: | anOp (BOPAlgo_Operation) –
    Return type: | None

  `Shape1`()
    - Returns the first shape involved in this Boolean operation.

    Return type: | TopoDS_Shape

  `Shape2`()
    - Returns the second shape involved in this Boolean operation.

    Return type: | TopoDS_Shape

  `thisown`

    The membership flag

class `BRepAlgoAPI_Check`(*args)

  Bases: `object`

  - Empty constructor.

  Return type: | None

  - Constructor for checking single shape. It calls methods Init(theS, TopoDS_Shape(), BOPAlgo_UNKNOWN, bTestSE, bTestSI) and Perform(). Params: theS - the shape that should be checked; bTestSE - flag that specifies whether check on small edges should be performed; by default it is set to True; bTestSI - flag that specifies whether check on self-interference should be performed; by default it is set to True;

  Parameters: | theS (TopoDS_Shape &) – bTestSE (bool) – default value is Standard_True bTestSI (bool) – default value is Standard_True
  Return type: | None

  - Constructor for couple of shapes. It calls methods Init(theS1, theS2, theOp, bTestSE, bTestSI) and Perform(). Params: theS1, theS2 - the initial shapes. theOp - the type of Boolean Operation; if it is not defined (set to UNKNOWN) for each shape performed check as for single shape. bTestSE - flag that specifies whether check on small edges should be performed; by default it is set to True; bTestSI - flag that specifies whether check on self-interference should be performed; by default it is set to True;

  Parameters: | theS1 (TopoDS_Shape &) – theS2 (TopoDS_Shape &) – theOp (BOPAlgo_Operation) – default value is BOPAlgo_UNKNOWN bTestSE (bool) – default value is Standard_True bTestSI (bool) – default value is Standard_True
  Return type: | None

  `IsValid`()
    - Shows whether shape(s) valid or not.

    Return type: | bool

  `Perform`()
    - Performs the check.

    Return type: | None

  `Result`()
    - Returns faulty shapes.

    Return type: | BOPAlgo_ListOfCheckResult

  `SetData`()
    - Sets data for check by Init method. The method provides alternative way for checking single shape.

    Parameters: | theS (TopoDS_Shape &) – bTestSE (bool) – default value is Standard_True bTestSI (bool) – default value is Standard_True
    Return type: | None

    - Sets data for check by Init method. The method provides alternative way for checking couple of shapes.

    Parameters: | theS1 (TopoDS_Shape &) – theS2 (TopoDS_Shape &) – theOp (BOPAlgo_Operation) – default value is BOPAlgo_UNKNOWN bTestSE (bool) – default value is Standard_True bTestSI (bool) – default value is Standard_True
    Return type: | None

  `thisown`

    The membership flag

class `BRepAlgoAPI_Common`(*args)

  Bases: `OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation`

  - Constructs a common part for shapes aS1 and aS2 .

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) – S1 – S2 – aDSF (BOPAlgo_PaveFiller &) –
  Return type: | None
  Return type: | None

  `thisown`

    The membership flag

class `BRepAlgoAPI_Cut`(*args)

  Bases: `OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation`

  - Shape aS2 cuts shape aS1. The resulting shape is a new shape produced by the cut operation.

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) –
  Return type: | None

  - Constructs a new shape cut from shape aS1 by shape aS2 using aDSFiller (see BRepAlgoAPI_BooleanOperation Constructor).

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) – aDSF (BOPAlgo_PaveFiller &) – bFWD (bool) – default value is Standard_True
  Return type: | None

  `thisown`

    The membership flag

class `BRepAlgoAPI_Fuse`(*args)

  Bases: `OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation`

  - Constructs a fuse of shapes aS1 and aS2.

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) –
  Return type: | None

  - Constructs a new shape that is a fuse of shapes aS1 and aS2 using aDSFiller.

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) – aDSF (BOPAlgo_PaveFiller &) –
  Return type: | None

  `thisown`

    The membership flag

class `BRepAlgoAPI_Section`(*args)

  Bases: `OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation`

  Parameters: | S1 (TopoDS_Shape &) – S2 (TopoDS_Shape &) – aDSF (BOPAlgo_PaveFiller &) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  - see upper

  Parameters: | Sh1 (TopoDS_Shape &) – Sh2 (TopoDS_Shape &) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  - see upper

  Parameters: | Sh (TopoDS_Shape &) – Pl (gp_Pln) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  - see upper

  Parameters: | Sh (TopoDS_Shape &) – Sf (Handle_Geom_Surface &) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  - see upper

  Parameters: | Sf (Handle_Geom_Surface &) – Sh (TopoDS_Shape &) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  - This and the above classes construct a framework for computing the section lines of: - two shapes Sh1 and Sh2, or - shape Sh and plane Pl, or - shape Sh and surface Sf, or - surface Sf and shape Sh, or - two surfaces Sf1 and Sf2, and builds a result if PerformNow equals true, its default value. If PerformNow equals false, the intersection will be computed later by the function Build. The constructed shape will be returned by the function Shape. This is a compound object composed of edges. These intersection edges may be built: - on new intersection lines, or - on coincident portions of edges in the two intersected shapes. These intersection edges are independent: they are not chained or grouped in wires. If no intersection edge exists, the result is an empty compound object. Note that other objects than TopoDS_Shape shapes involved in these syntaxes are converted into faces or shells before performing the computation of the intersection. A shape resulting from this conversion can be retrieved with the function Shape1 or Shape2. Parametric 2D curves on intersection edges No parametric 2D curve (pcurve) is defined for each elementary edge of the result. To attach such parametric curves to the constructed edges you may use a constructor with the PerformNow flag equal to false; then you use: - the function ComputePCurveOn1 to ask for the additional computation of a pcurve in the parametric space of the first shape, - the function ComputePCurveOn2 to ask for the additional computation of a pcurve in the parametric space of the second shape, in the end, - the function Build to construct the result. Approximation of intersection edges The underlying 3D geometry attached to each elementary edge of the result is: - analytic where possible, provided the corresponding geometry corresponds to a type of analytic curve defined in the Geom package; for example, the intersection of a cylindrical shape with a plane gives an ellipse or a circle; - or elsewhere, given as a succession of points grouped together in a BSpline curve of degree 1. If you prefer to have an attached 3D geometry which is a BSpline approximation of the computed set of points on computed elementary intersection edges whose underlying geometry is not analytic, you may use a constructor with the PerformNow flag equal to false. Then you use: - the function Approximation to ask for this computation option, and - the function Build to construct the result. - Note that as a result, approximations will only be computed on edges built on new intersection lines. - Example You may also combine these computation options. In the following example: - each elementary edge of the computed intersection, built on a new intersection line, which does not correspond to an analytic Geom curve, will be approximated by a BSpline curve whose degree is not greater than 8. - each elementary edge built on a new intersection line, will have: - a pcurve in the parametric space of the intersected face of shape S1, - no pcurve in the parametric space of the intersected face of shape S2. // TopoDS_Shape S1 = ... , S2 = ... ; Standard_Boolean PerformNow = Standard_False; BRepAlgoAPI_Section S ( S1, S2, PerformNow ); S.ComputePCurveOn1 (Standard_True); S.Approximation (Standard_True); S.Build(); TopoDS_Shape R = S.Shape();

  Parameters: | Sf1 (Handle_Geom_Surface &) – Sf2 (Handle_Geom_Surface &) – PerformNow (bool) – default value is Standard_True
  Return type: | None

  `Approximation`()
    - Defines an option for computation of further intersections. This computation will be performed by the function Build in this framework. By default, the underlying 3D geometry attached to each elementary edge of the result of a computed intersection is: - analytic where possible, provided the corresponding geometry corresponds to a type of analytic curve defined in the Geom package; for example the intersection of a cylindrical shape with a plane gives an ellipse or a circle; - or elsewhere, given as a succession of points grouped together in a BSpline curve of degree 1. If Approx equals true, when further computations are performed in this framework with the function Build, these edges will have an attached 3D geometry which is a BSpline approximation of the computed set of points. Note that as a result, approximations will be computed on edges built only on new intersection lines.

    Parameters: | B (bool) –
    Return type: | None

  `ComputePCurveOn1`()
    - Indicates if the Pcurve must be (or not) performed on first part.

    Parameters: | B (bool) –
    Return type: | None

  `ComputePCurveOn2`()
    - Define options for the computation of further intersections, which will be performed by the function Build in this framework. By default, no parametric 2D curve (pcurve) is defined for the elementary edges of the result. If ComputePCurve1 equals true, further computations performed in this framework with the function Build will attach an additional pcurve in the parametric space of the first shape to the constructed edges. If ComputePCurve2 equals true, the additional pcurve will be attached to the constructed edges in the parametric space of the second shape. These two functions may be used together.

    Parameters: | B (bool) –
    Return type: | None

  `HasAncestorFaceOn1`()
    - get the face of the first part giving section edge <E>. Returns True on the 3 following conditions : 1/ <E> is an edge returned by the Shape() method. 2/ First part of section performed is a shape. 3/ <E> is built on a intersection curve (i.e <E> is not the result of common edges) When False, F remains untouched.

    Parameters: | E (TopoDS_Shape &) – F (TopoDS_Shape &) –
    Return type: | bool

  `HasAncestorFaceOn2`()
    - Identifies the ancestor faces of the intersection edge E resulting from the last computation performed in this framework, that is, the faces of the two original shapes on which the edge E lies: - HasAncestorFaceOn1 gives the ancestor face in the first shape, and - HasAncestorFaceOn2 gives the ancestor face in the second shape. These functions return true if an ancestor face F is found, or false if not. An ancestor face is identifiable for the edge E if the following conditions are satisfied: - the first part on which this algorithm performed its last computation is a shape, that is, it was not given as a surface or a plane at the time of construction of this algorithm or at a later time by the Init1 function, - E is one of the elementary edges built by the last computation of this section algorithm. To use these functions properly, you have to test the returned Boolean value before using the ancestor face: F is significant only if the returned Boolean value equals true.

    Parameters: | E (TopoDS_Shape &) – F (TopoDS_Shape &) –
    Return type: | bool

  `Init1`()
    - initialize first part

    Parameters: | S1 (TopoDS_Shape &) –
    Return type: | None

    - initialize first part

    Parameters: | Pl (gp_Pln) –
    Return type: | None

    - initialize first part

    Parameters: | Sf (Handle_Geom_Surface &) –
    Return type: | None

  `Init2`()
    - initialize second part

    Parameters: | S2 (TopoDS_Shape &) –
    Return type: | None

    - initialize second part

    Parameters: | Pl (gp_Pln) –
    Return type: | None

    - Reinitializes the first and the second parts on which this algorithm is going to perform the intersection computation. This is done with either: the surface Sf, the plane Pl or the shape Sh. You use the function Build to construct the result.

    Parameters: | Sf (Handle_Geom_Surface &) –
    Return type: | None

  `thisown`

    The membership flag

class `SwigPyIterator`(*args, **kwargs)

  Bases: `object`

  `advance`()
  `copy`()
  `decr`()
  `distance`()
  `equal`()
  `incr`()
  `next`()
  `previous`()
  `thisown`

    The membership flag

  `value`()

class `brepalgoapi`

  Bases: `object`

  static `DumpOper`(*args)
    - Check shapes on validity for boolean operation. Dump arguments and result of boolean operation in the file specified by path.

    Parameters: | theFilePath (char *) – theShape1 (TopoDS_Shape &) – theShape2 (TopoDS_Shape &) – theResult (TopoDS_Shape &) – theOperation (BOPAlgo_Operation) – isNonValidArgs (bool) –
    Return type: | void

  `thisown`

    The membership flag

`brepalgoapi_DumpOper`(*args)
  - Check shapes on validity for boolean operation. Dump arguments and result of boolean operation in the file specified by path.

  Parameters: | theFilePath (char *) – theShape1 (TopoDS_Shape &) – theShape2 (TopoDS_Shape &) – theResult (TopoDS_Shape &) – theOperation (BOPAlgo_Operation) – isNonValidArgs (bool) –
  Return type: | void

`register_handle`(handle, base_object)

  Inserts the handle into the base object to prevent memory corruption in certain cases