OCC.BRepAlgoAPI module

The BRepAlgoAPI package provides a full range ofservices to perform Boolean Operations on arguments (shapesthat are defined in the BRep data structures). Theimplemented new algorithm is intended to replace the OldBoolean Operations algorithm in the BRepAlgoAPI package.The New algorithm is free of a large number of weak spotsand limitations characteristics of the Old algorithm.It is more powerful and flexible.It can process arguments the Old algorithm was not adapted for.The new algorithm is based on a new approach to operationswith interfered shapes. The advantages of the new algorithminclude an ability to treat arguments that have sharedentities. It can properly process two solids with sharedfaces (in terms of TopoDS_Shape::IsSame()), twofaces that have shared edges and so on. Now the New BooleanOperation algorithm can treat a wide range of shapes while theOld one fails on them.A generalization of treatment of same-domain faceswas included into the New algorithm. Two faces that sharethe same domain are processed according to the common ruleeven if the underlying surfaces are of different types. Thisallows to execute Boolean Operations properly for the samedomain faces. It also concerns solids and shells that have thesame domain faces. It is quite frequent when two faces sharethe same domain. And the New algorithm successfully copeswith it in contrast to the Old one.Generalization oftreatment of degenerated edgesgives a possibility to process them properly. Although thereare still some difficulties with processing faces in areas closeto degenerated edges.Now the processing of arguments having internal sub-shapes givesa correct result. Internal sub-shape means a sub-shape of ashape with the orientation TopAbs_INTERNAL and is locatedinside the shape boundaries. The New algorithm processes faceswith internal edges properly. The new API of the BooleanOperations (in addition to the old API) allows to reuse thealready computed interference between arguments in differenttypes of Boolean Operations. It is possible to use once computedinterference in FUSE, CUT and COMMON operations on givenarguments. So there is no need to re-compute the interferencebetween the arguments. It allows to reduce time for more than oneoperation on given arguments.The shape type of a Boolean Operation result and types of the arguments:- For arguments with the same shape type (e.g. SOLID /SOLID) the type of the resulting shape will be aCOMPOUND, containing shapes of this type;- For arguments with different shape types (e.g.SHELL / SOLID) the type of the resulting shape will be aCOMPOUND, containing shapes of the type that is the same asthat of the low type of the argument. Example: ForSHELL/SOLID the result is a COMPOUND of SHELLs.- For arguments with different shape types some ofBoolean Operations can not be done using the defaultimplementation, because of a non-manifold type of theresult. Example: the FUSE operation for SHELL and SOLIDcan not be done, but the CUT operation can be done, whereSHELL is the object and SOLID is the tool.It is possible to perform Boolean Operations on argumentsof the COMPOUND shape type. In this case each compound must notbe heterogeneous, i.e. it must contain equidimensional shapes(EDGEs or/and WIREs, FACEs or/and SHELLs, SOLIDs). SOLIDsinside the COMPOUND must not contact (intersect or touch)each other. The same condition is true for SHELLs or FACEs,WIREs or EDGEs.It does not support Boolean Operations for COMPSOLID type of shape.

class BRepAlgoAPI_Algo(*args, **kwargs)

Bases: OCC.BRepBuilderAPI.BRepBuilderAPI_MakeShape

Allocator()
Return type:BOPCol_BaseAllocator
ErrorStatus()
  • Returns error status of the algorithm ==0 - no errors occured !=0 - is in the event of various error conditions
Return type:int
RunParallel()
  • Returns the flag of parallel processing
Return type:bool
SetProgressIndicator()
  • Set the Progress Indicator object.
Parameters:theObj (Handle_Message_ProgressIndicator &) –
Return type:None
SetRunParallel()
  • Set the flag of parallel processing if <theFlag> is true the parallel processing is switched on if <theFlag> is false the parallel processing is switched off
Parameters:theFlag (bool) –
Return type:None
WarningStatus()
  • Returns warning status of the algorithm ==0 - no warning occured !=0 - is in the event of various warning conditions
Return type:int
thisown

The membership flag

class BRepAlgoAPI_BooleanOperation(*args, **kwargs)

Bases: OCC.BRepAlgoAPI.BRepAlgoAPI_BuilderAlgo

BuilderCanWork()
  • Returns True if there was no errors occured obsolete
Return type:bool
FuseEdges()
  • Returns the flag of edge refining
Return type:bool
Operation()
  • Returns the type of Boolean Operation
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
Parameters:anOp (BOPAlgo_Operation) –
Return type:None
SetTools()
  • Sets the tools
Parameters:theLS (TopTools_ListOfShape &) –
Return type:None
Shape1()
  • Returns the first argument involved in this Boolean operation. Obsolete
Return type:TopoDS_Shape
Shape2()
  • Returns the second argument involved in this Boolean operation. Obsolete
Return type:TopoDS_Shape
Tools()
  • Gets the tools
Return type:TopTools_ListOfShape
thisown

The membership flag

class BRepAlgoAPI_BuilderAlgo(*args)

Bases: OCC.BRepAlgoAPI.BRepAlgoAPI_Algo

  • Empty constructor
Return type:None
  • Empty constructor
Parameters:thePF (BOPAlgo_PaveFiller &) –
Return type:None
Arguments()
  • Gets the arguments
Return type:TopTools_ListOfShape
FuzzyValue()
  • Returns the additional tolerance
Return type:float
HasDeleted()
  • Returns true if there is at least one deleted shape. For use in BRepNaming. //! protected methods
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
SetArguments()
  • Sets the arguments
Parameters:theLS (TopTools_ListOfShape &) –
Return type:None
SetFuzzyValue()
  • Sets the additional tolerance
Parameters:theFuzz (float) –
Return type:None
thisown

The membership flag

class BRepAlgoAPI_Check(*args)

Bases: OCC.BRepAlgoAPI.BRepAlgoAPI_Algo

  • 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

FuzzyValue()
  • Returns the additional tolerance
Return type:float
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

SetFuzzyValue()
  • Sets the additional tolerance
Parameters:theFuzz (float) –
Return type:None
thisown

The membership flag

class BRepAlgoAPI_Common(*args)

Bases: OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation

  • Empty constructor
Return type:None
  • Empty constructor <PF> - PaveFiller object that is carried out
Parameters:PF (BOPAlgo_PaveFiller &) –
Return type:None
  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
Return type:

None

  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation <PF> - PaveFiller object that is carried out Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
  • PF (BOPAlgo_PaveFiller &) –
Return type:

None

thisown

The membership flag

class BRepAlgoAPI_Cut(*args)

Bases: OCC.BRepAlgoAPI.BRepAlgoAPI_BooleanOperation

  • Empty constructor
Return type:None
  • Empty constructor <PF> - PaveFiller object that is carried out
Parameters:PF (BOPAlgo_PaveFiller &) –
Return type:None
  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
Return type:

None

  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation <PF> - PaveFiller object that is carried out Obsolete
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

  • Empty constructor
Return type:None
  • Empty constructor <PF> - PaveFiller object that is carried out
Parameters:PF (BOPAlgo_PaveFiller &) –
Return type:None
  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
Return type:

None

  • Constructor with two shapes <S1> -argument <S2> -tool <anOperation> - the type of the operation <PF> - PaveFiller object that is carried out Obsolete
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

  • Empty constructor
Return type:None
  • Empty constructor <PF> - PaveFiller object that is carried out
Parameters:PF (BOPAlgo_PaveFiller &) –
Return type:None
  • Constructor with two shapes <S1> -argument <S2> -tool <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

  • Constructor with two shapes <S1> -argument <S2> -tool <PF> - PaveFiller object that is carried out <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • S2 (TopoDS_Shape &) –
  • aDSF (BOPAlgo_PaveFiller &) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

  • Constructor with two shapes <S1> - argument <Pl> - tool <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • Pl (gp_Pln) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

  • Constructor with two shapes <S1> - argument <Sf> - tool <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • S1 (TopoDS_Shape &) –
  • Sf (Handle_Geom_Surface &) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

  • Constructor with two shapes <Sf> - argument <S2> - tool <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • Sf (Handle_Geom_Surface &) –
  • S2 (TopoDS_Shape &) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

  • Constructor with two shapes <Sf1> - argument <Sf2> - tool <PerformNow> - the flag: if <PerformNow>=True - the algorithm is performed immediatly Obsolete
Parameters:
  • Sf1 (Handle_Geom_Surface &) –
  • Sf2 (Handle_Geom_Surface &) –
  • PerformNow (bool) – default value is Standard_True
Return type:

None

Approximation()
Parameters:B (bool) –
Return type:None
ComputePCurveOn1()
  • Indicates whether the P-Curve should be (or not) performed on the argument. By default, no parametric 2D curve (pcurve) is defined for the edges of the result. If ComputePCurve1 equals true, further computations performed to attach an P-Curve in the parametric space of the argument to the constructed edges. Obsolete
Parameters:B (bool) –
Return type:None
ComputePCurveOn2()
  • Indicates whether the P-Curve should be (or not) performed on the tool. By default, no parametric 2D curve (pcurve) is defined for the edges of the result. If ComputePCurve1 equals true, further computations performed to attach an P-Curve in the parametric space of the tool to the constructed edges. Obsolete
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() metwod. 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. Obsolete
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. Obsolete
Parameters:
  • E (TopoDS_Shape &) –
  • F (TopoDS_Shape &) –
Return type:

bool

Init1()
  • initialize the argument <S1> - argument Obsolete
Parameters:S1 (TopoDS_Shape &) –
Return type:None
  • initialize the argument <Pl> - argument Obsolete
Parameters:Pl (gp_Pln) –
Return type:None
  • initialize the argument <Sf> - argument Obsolete
Parameters:Sf (Handle_Geom_Surface &) –
Return type:None
Init2()
  • initialize the tool <S2> - tool Obsolete
Parameters:S2 (TopoDS_Shape &) –
Return type:None
  • initialize the tool <Pl> - tool Obsolete
Parameters:Pl (gp_Pln) –
Return type:None
  • initialize the tool <Sf> - tool Obsolete
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()
new_instancemethod(func, inst, cls)
register_handle(handle, base_object)

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