+ pd << theShape1 << ", " << theShape2;
+
+ if (IsCheckSelfInte) {
+ pd << ", True";
+ }
+
+ pd << ")";
+
+ SetErrorCode(OK);
+ return aBool;
+}
+
+//=============================================================================
+/*!
+ * MakeFuse
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuse
+ (Handle(GEOM_Object) theShape1,
+ Handle(GEOM_Object) theShape2,
+ const bool IsCheckSelfInte,
+ const bool IsRmExtraEdges)
+{
+ SetErrorCode(KO);
+
+ if (theShape1.IsNull() || theShape2.IsNull()) return NULL;
+
+ //Add a new Boolean object
+ Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
+
+ //Add a new Boolean function
+ Handle(GEOM_Function) aFunction =
+ aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
+
+ GEOMImpl_IBoolean aCI (aFunction);
+
+ Handle(GEOM_Function) aRef1 = theShape1->GetLastFunction();
+ Handle(GEOM_Function) aRef2 = theShape2->GetLastFunction();
+
+ if (aRef1.IsNull() || aRef2.IsNull()) return NULL;
+
+ aCI.SetShape1(aRef1);
+ aCI.SetShape2(aRef2);
+ aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+ aCI.SetRmExtraEdges(IsRmExtraEdges);
+
+ //Compute the Boolean value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Boolean driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aBool << " = geompy.MakeFuse(";
+ pd << theShape1 << ", " << theShape2 << ", "
+ << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
+
+ SetErrorCode(OK);
+ return aBool;
+}
+
+//=============================================================================
+/*!
+ * MakeFuseList
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeFuseList
+ (const Handle(TColStd_HSequenceOfTransient)& theShapes,
+ const bool IsCheckSelfInte,
+ const bool IsRmExtraEdges)
+{
+ SetErrorCode(KO);
+
+ if (theShapes.IsNull()) return NULL;
+
+ //Add a new Boolean object
+ Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
+
+ //Add a new Boolean function
+ Handle(GEOM_Function) aFunction =
+ aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_FUSE_LIST);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
+
+ GEOMImpl_IBoolean aCI (aFunction);
+
+ TCollection_AsciiString aDescription;
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq =
+ getShapeFunctions(theShapes, aDescription);
+
+ if (aShapesSeq.IsNull()) return NULL;
+
+ aCI.SetShapes(aShapesSeq);
+ aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+ aCI.SetRmExtraEdges(IsRmExtraEdges);
+
+ //Compute the Boolean value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Boolean driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aBool << " = geompy.MakeFuseList([" << aDescription.ToCString() << "], "
+ << IsCheckSelfInte << ", " << IsRmExtraEdges << ")";
+
+ SetErrorCode(OK);
+ return aBool;
+}
+
+//=============================================================================
+/*!
+ * MakeCommonList
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCommonList
+ (const Handle(TColStd_HSequenceOfTransient)& theShapes,
+ const Standard_Boolean IsCheckSelfInte)
+{
+ SetErrorCode(KO);
+
+ if (theShapes.IsNull()) return NULL;
+
+ //Add a new Boolean object
+ Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
+
+ //Add a new Boolean function
+ Handle(GEOM_Function) aFunction =
+ aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_COMMON_LIST);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
+
+ GEOMImpl_IBoolean aCI (aFunction);
+
+ TCollection_AsciiString aDescription;
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq =
+ getShapeFunctions(theShapes, aDescription);
+
+ if (aShapesSeq.IsNull()) return NULL;
+
+ aCI.SetShapes(aShapesSeq);
+ aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+
+ //Compute the Boolean value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Boolean driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aBool <<
+ " = geompy.MakeCommonList([" << aDescription.ToCString() << "]";
+
+ if (IsCheckSelfInte) {
+ pd << ", True";
+ }
+
+ pd << ")";
+
+ SetErrorCode(OK);
+ return aBool;
+}
+
+//=============================================================================
+/*!
+ * MakeCutList
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeCutList
+ (Handle(GEOM_Object) theMainShape,
+ const Handle(TColStd_HSequenceOfTransient)& theShapes,
+ const Standard_Boolean IsCheckSelfInte)
+{
+ SetErrorCode(KO);
+
+ if (theShapes.IsNull()) return NULL;
+
+ //Add a new Boolean object
+ Handle(GEOM_Object) aBool = GetEngine()->AddObject(GEOM_BOOLEAN);
+
+ //Add a new Boolean function
+ Handle(GEOM_Function) aFunction =
+ aBool->AddFunction(GEOMImpl_BooleanDriver::GetID(), BOOLEAN_CUT_LIST);
+
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_BooleanDriver::GetID()) return NULL;
+
+ GEOMImpl_IBoolean aCI (aFunction);
+ Handle(GEOM_Function) aMainRef = theMainShape->GetLastFunction();
+
+ if (aMainRef.IsNull()) return NULL;
+
+ TCollection_AsciiString aDescription;
+ Handle(TColStd_HSequenceOfTransient) aShapesSeq =
+ getShapeFunctions(theShapes, aDescription);
+
+ if (aShapesSeq.IsNull()) return NULL;
+
+ aCI.SetShape1(aMainRef);
+ aCI.SetShapes(aShapesSeq);
+ aCI.SetCheckSelfIntersection(IsCheckSelfInte);
+
+ //Compute the Boolean value
+ try {
+ OCC_CATCH_SIGNALS;
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Boolean driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+
+ pd << aBool << " = geompy.MakeCutList("
+ << theMainShape << ", [" << aDescription.ToCString() << "]";
+
+ if (IsCheckSelfInte) {
+ pd << ", True";
+ }
+
+ pd << ")";