--- /dev/null
+// Created by: Eugeny MALTCHIKOV
+// Copyright (c) 2015 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BOPTest.ixx>
+//
+#include <Draw.hxx>
+#include <DBRep.hxx>
+//
+#include <BRep_Builder.hxx>
+//
+#include <TopoDS_Compound.hxx>
+//
+#include <BOPAlgo_Builder.hxx>
+//
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+//
+#include <BOPTest_DrawableShape.hxx>
+#include <BOPTest_Objects.hxx>
+
+//
+static Standard_Integer bmodified (Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bgenerated (Draw_Interpretor&, Standard_Integer, const char**);
+static Standard_Integer bisdeleted (Draw_Interpretor&, Standard_Integer, const char**);
+
+//=======================================================================
+//function : HistoryCommands
+//purpose :
+//=======================================================================
+void BOPTest::HistoryCommands(Draw_Interpretor& theCommands)
+{
+ static Standard_Boolean done = Standard_False;
+ if (done) return;
+ done = Standard_True;
+ // Chapter's name
+ const char* g = "BOPTest commands";
+ // Commands
+ theCommands.Add("bmodified" , "Use: bmodified rc shape", __FILE__, bmodified , g);
+ theCommands.Add("bgenerated", "Use: bgenerated rc shape", __FILE__, bgenerated, g);
+ theCommands.Add("bisdeleted", "Use: bisdeleted shape" , __FILE__, bisdeleted, g);
+}
+
+//=======================================================================
+//function : bmodified
+//purpose :
+//=======================================================================
+Standard_Integer bmodified(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n < 3) {
+ di << "Use: bmodified rc shape\n";
+ return 1;
+ }
+ //
+ TopoDS_Shape aS = DBRep::Get(a[2]);
+ if (aS.IsNull()) {
+ di << "Null shape\n";
+ return 1;
+ }
+ //
+ TopAbs_ShapeEnum aType = aS.ShapeType();
+ if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
+ di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
+ return 1;
+ }
+ //
+ BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
+ const TopTools_ListOfShape& aLS = aBuilder.Modified(aS);
+ //
+ if (aLS.IsEmpty()) {
+ di << "The shape has not been modified\n";
+ return 0;
+ }
+ //
+ BRep_Builder aBB;
+ TopoDS_Compound aRes;
+ //
+ aBB.MakeCompound(aRes);
+ TopTools_ListIteratorOfListOfShape aIt(aLS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ aBB.Add(aRes, aS);
+ }
+ //
+ DBRep::Set(a[1], aRes);
+ //
+ return 0;
+}
+
+//=======================================================================
+//function : bgenerated
+//purpose :
+//=======================================================================
+Standard_Integer bgenerated(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n < 3) {
+ di << "Use: bgenerated rc shape\n";
+ return 1;
+ }
+ //
+ TopoDS_Shape aS = DBRep::Get(a[2]);
+ if (aS.IsNull()) {
+ di << "Null shape\n";
+ return 1;
+ }
+ //
+ TopAbs_ShapeEnum aType = aS.ShapeType();
+ if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
+ di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
+ return 1;
+ }
+ //
+ BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
+ const TopTools_ListOfShape& aLS = aBuilder.Generated(aS);
+ //
+ if (aLS.IsEmpty()) {
+ di << "No shapes were generated from the shape\n";
+ return 0;
+ }
+ //
+ BRep_Builder aBB;
+ TopoDS_Compound aRes;
+ //
+ aBB.MakeCompound(aRes);
+ TopTools_ListIteratorOfListOfShape aIt(aLS);
+ for (; aIt.More(); aIt.Next()) {
+ const TopoDS_Shape& aS = aIt.Value();
+ aBB.Add(aRes, aS);
+ }
+ //
+ DBRep::Set(a[1], aRes);
+ //
+ return 0;
+}
+
+//=======================================================================
+//function : bisdeleted
+//purpose :
+//=======================================================================
+Standard_Integer bisdeleted(Draw_Interpretor& di,
+ Standard_Integer n,
+ const char** a)
+{
+ if (n < 2) {
+ di << "Use: bisdeleted shape\n";
+ return 1;
+ }
+ //
+ TopoDS_Shape aS = DBRep::Get(a[1]);
+ if (aS.IsNull()) {
+ di << "Null shape\n";
+ return 1;
+ }
+ //
+ TopAbs_ShapeEnum aType = aS.ShapeType();
+ if (!(aType==TopAbs_VERTEX || aType==TopAbs_EDGE ||
+ aType==TopAbs_FACE || aType==TopAbs_SOLID)) {
+ di << "The shape must be one of the following types: VERTEX, EDGE, FACE or SOLID\n";
+ return 1;
+ }
+ //
+ BOPAlgo_Builder& aBuilder = BOPTest_Objects::Builder();
+ Standard_Boolean isDeleted = aBuilder.IsDeleted(aS);
+ //
+ di << (isDeleted ? "Deleted" : "Not deleted") << "\n";
+ //
+ return 0;
+}
--- /dev/null
+puts "========"
+puts "OCC26393"
+puts "========"
+puts ""
+#################################################################
+# Add draw commands to evaluate history of modifications of BOP
+#################################################################
+
+restore [locate_data_file OCC26393-w.brep] w
+restore [locate_data_file OCC26393-v1.brep] v0
+restore [locate_data_file OCC26393-v2.brep] v1
+
+bclearobjects
+bcleartools
+baddobjects w
+baddtools v0 v1
+bfillds
+bbuild r
+
+set bug_info [bmodified v0m v0]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "The shape has not been modified"} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work."
+}
+
+set bug_info [bmodified v1m v1]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "The shape has not been modified"} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work."
+}
+
+set bug_info [bisdeleted v0]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+set bug_info [bisdeleted v1]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+explode w e
+
+set bug_info [bmodified w1m w_1]
+if {$bug_info != ""} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work correctly."
+}
+
+set bug_info [bisdeleted w_1]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+set bug_info [bmodified w2m w_2]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "The shape has not been modified"} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work."
+}
+
+set bug_info [bisdeleted w_2]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+set bug_info [bmodified w3m w_3]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "The shape has not been modified"} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work."
+}
+
+set bug_info [bisdeleted w_3]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+set bug_info [bmodified w4m w_4]
+if {$bug_info != ""} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work correctly."
+}
+
+set bug_info [bisdeleted w_4]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}
+
+set bug_info [bmodified w5m w_5]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "The shape has not been modified"} {
+ puts "ERROR: OCC26393 is reproduced. Command bmodified does not work."
+}
+
+set bug_info [bisdeleted w_5]
+set bug_info [string trim [string range $bug_info 0 [expr {[string first "\n" $bug_info] - 1}]]]
+if {$bug_info != "Not deleted"} {
+ puts "ERROR: OCC26393 is reproduced. Command bisdeleted does not work."
+}