]> OCCT Git - occt-copy.git/commitdiff
0023030: Collect all DRAW commands created for testing bugs into one package
authordbv <dbv@opencascade.com>
Mon, 26 Mar 2012 11:59:41 +0000 (15:59 +0400)
committerdbv <dbv@opencascade.com>
Mon, 26 Mar 2012 11:59:41 +0000 (15:59 +0400)
QA* packages have been collected in one QABugs package.

82 files changed:
adm/UDLIST
src/QAAMINO/QAAMINO.cdl [deleted file]
src/QAAMINO/QAAMINO.cxx [deleted file]
src/QAAlcatel/QAAlcatel.cdl [deleted file]
src/QAAlcatel/QAAlcatel.cxx [deleted file]
src/QABRGM/QABRGM.cdl [deleted file]
src/QABRGM/QABRGM.cxx [deleted file]
src/QABUC/FILES [deleted file]
src/QABUC/QABUC.cdl [deleted file]
src/QABUC/QABUC.cxx [deleted file]
src/QABUC/QABUC_CMPLRS.edl [deleted file]
src/QABugs/FILES [new file with mode: 0644]
src/QABugs/QABugs.cdl [new file with mode: 0644]
src/QABugs/QABugs.cxx [new file with mode: 0644]
src/QABugs/QABugs_1.cxx [new file with mode: 0644]
src/QABugs/QABugs_10.cxx [new file with mode: 0644]
src/QABugs/QABugs_11.cxx [new file with mode: 0644]
src/QABugs/QABugs_12.cxx [new file with mode: 0644]
src/QABugs/QABugs_13.cxx [new file with mode: 0644]
src/QABugs/QABugs_14.cxx [new file with mode: 0644]
src/QABugs/QABugs_15.cxx [new file with mode: 0644]
src/QABugs/QABugs_16.cxx [new file with mode: 0644]
src/QABugs/QABugs_17.cxx [new file with mode: 0644]
src/QABugs/QABugs_18.cxx [new file with mode: 0644]
src/QABugs/QABugs_19.cxx [new file with mode: 0644]
src/QABugs/QABugs_2.cxx [new file with mode: 0644]
src/QABugs/QABugs_3.cxx [new file with mode: 0644]
src/QABugs/QABugs_4.cxx [new file with mode: 0644]
src/QABugs/QABugs_5.cxx [new file with mode: 0644]
src/QABugs/QABugs_6.cxx [new file with mode: 0644]
src/QABugs/QABugs_7.cxx [new file with mode: 0644]
src/QABugs/QABugs_8.cxx [new file with mode: 0644]
src/QABugs/QABugs_9.cxx [new file with mode: 0644]
src/QABugs/QABugs_CMPLRS.edl [new file with mode: 0644]
src/QABugs/QABugs_MyText.cdl [new file with mode: 0644]
src/QABugs/QABugs_MyText.cxx [new file with mode: 0644]
src/QABugs/QABugs_PresentableObject.cdl [new file with mode: 0644]
src/QABugs/QABugs_PresentableObject.cxx [new file with mode: 0644]
src/QACADCAM/FILES [deleted file]
src/QACADCAM/QACADCAM.cdl [deleted file]
src/QACADCAM/QACADCAM.cxx [deleted file]
src/QACADCAM/QACADCAM_CMPLRS.edl [deleted file]
src/QACEADRT/QACEADRT.cdl [deleted file]
src/QACEADRT/QACEADRT.cxx [deleted file]
src/QADraw/QADraw_Additional.cxx
src/QAInsynchro/QAInsynchro.cdl [deleted file]
src/QAInsynchro/QAInsynchro.cxx [deleted file]
src/QAMARTEC/QAMARTEC.cdl [deleted file]
src/QAMARTEC/QAMARTEC.cxx [deleted file]
src/QAMitutoyoUK/QAMitutoyoUK.cdl [deleted file]
src/QAMitutoyoUK/QAMitutoyoUK.cxx [deleted file]
src/QAMitutoyoUS/QAMitutoyoUS.cdl [deleted file]
src/QAMitutoyoUS/QAMitutoyoUS.cxx [deleted file]
src/QANIC/QANIC.cdl [deleted file]
src/QANIC/QANIC.cxx [deleted file]
src/QAOCC/FILES [deleted file]
src/QAOCC/QAOCC.cdl [deleted file]
src/QAOCC/QAOCC.cxx [deleted file]
src/QAOCC/QAOCC_CMPLRS.edl [deleted file]
src/QAQuickPen/QAQuickPen.cdl [deleted file]
src/QAQuickPen/QAQuickPen.cxx [deleted file]
src/QARicardo/FILES [deleted file]
src/QARicardo/QARicardo.cdl [deleted file]
src/QARicardo/QARicardo.cxx [deleted file]
src/QARicardo/QARicardo_CMPLRS.edl [deleted file]
src/QARina/QARina.cdl [deleted file]
src/QARina/QARina.cxx [deleted file]
src/QARoutelous/QARoutelous.cdl [deleted file]
src/QARoutelous/QARoutelous.cxx [deleted file]
src/QARoutelous/QARoutelous_PresentableObject.cdl [deleted file]
src/QARoutelous/QARoutelous_PresentableObject.cxx [deleted file]
src/QASamtech/QASamtech.cdl [deleted file]
src/QASamtech/QASamtech.cxx [deleted file]
src/QATelco/QATelco.cdl [deleted file]
src/QATelco/QATelco.cxx [deleted file]
src/QATelco/QATelco_MyText.cdl [deleted file]
src/QATelco/QATelco_MyText.cxx [deleted file]
src/QAUsinor/QAUsinor.cdl [deleted file]
src/QAUsinor/QAUsinor.cxx [deleted file]
src/QAYasaki/QAYasaki.cdl [deleted file]
src/QAYasaki/QAYasaki.cxx [deleted file]
src/TKQADraw/PACKAGES

index 07f3139e4278ac5259793178ea8cefa8b760e14f..2165d54dd056b2be9572cf80acf5c1b866f36beb 100644 (file)
@@ -492,33 +492,13 @@ t TKXDEDRAW
 t TKXSDRAW
 x DRAWEXE
 p DebugTools
-p QAAMINO
-p QAAlcatel
-p QABRGM
-p QABUC
-p QACADCAM
-p QADBMReflex
 p QADraw
-p QAInsynchro
-p QAMARTEC
-p QAMitutoyoUK
-p QAMitutoyoUS
 p QANCollection
-p QANIC
 p QANewBRepNaming
 p QANewDBRepNaming
 p QANewModTopOpe
-p QAOCC
-p QAQuickPen
-p QARicardo
-p QARina
-p QARoutelous
-p QASamtech
-p QATelco
-p QAUsinor
 p QAViewer2dTest
-p QAYasaki
 r QAResources
 t TKQADraw
-p QACEADRT
 p QADNaming
+p QABugs
diff --git a/src/QAAMINO/QAAMINO.cdl b/src/QAAMINO/QAAMINO.cdl
deleted file mode 100755 (executable)
index f5f7084..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-07-18
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAAMINO
-     uses Draw
-is
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAAMINO/QAAMINO.cxx b/src/QAAMINO/QAAMINO.cxx
deleted file mode 100755 (executable)
index 6c620c9..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-// Created on: 2002-07-18
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAAMINO.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Vertex.hxx>
-
-#include <TopExp_Explorer.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS.hxx>
-#include <BRepBndLib.hxx>
-#include <gp_Pln.hxx>
-#include <BRep_Tool.hxx>
-#include <BRepAlgoAPI_Section.hxx>
-#include <BRepAlgo_Section.hxx>
-#include <Precision.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-#include <stdio.h>
-
-//=======================================================================
-//function : OCC527 
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC527(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verify amount of arguments of the command
-    //if (argc < 2) { di << "OCC527 FAULTY. Use : OCC527 shape "; return 0;} 
-    if (argc < 2 || argc > 3) {
-      di << "Usage : " << argv[0] << " shape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-      return 1;
-    }
-    Standard_Boolean IsBRepAlgoAPI = Standard_True;
-    if (argc == 3) {
-      Standard_Integer IsB = atoi(argv[2]);
-      if (IsB != 1) {
-       IsBRepAlgoAPI = Standard_False;
-//#if ! defined(BRepAlgo_def04)
-//     di << "Error: There is not BRepAlgo_Section class" << "\n";
-//     return 1;
-//#endif
-      }
-    }
-    
-    // 2. Get selected shape
-    TopoDS_Shape aShape = DBRep::Get(argv[1]);
-    if(aShape.IsNull()) { di << "OCC527 FAULTY. Entry shape is NULL"; return 0;} 
-
-    // 3. Explode entry shape on faces and build sections from Zmin to Zmax with step aStep
-    const Standard_Real Zmin = -40.228173882121, Zmax = 96.408126285268, aStep = 1.0;
-    char str[100]; str[0] = 0; sprintf(str,"Test range: [%f, %f] with step %f\n",Zmin,Zmax,aStep); di << str;
-    int nbf = 0;
-    TopExp_Explorer aExp1;
-    for (aExp1.Init(aShape,TopAbs_FACE); aExp1.More(); aExp1.Next())
-    {
-      // Process one face
-      str[0] = 0; sprintf(str,"Face #%d: \t",nbf++); di << str;
-      TopoDS_Face aFace = TopoDS::Face(aExp1.Current());
-      
-      // Build BndBox in order to avoid try of building section 
-      // if plane of the one does not intersect BndBox of the face
-      Bnd_Box aFaceBox;
-      BRepBndLib::Add(aFace,aFaceBox);
-      Standard_Real X1,X2,Y1,Y2,Z1,Z2;
-      aFaceBox.Get(X1,Y1,Z1,X2,Y2,Z2);
-
-      // Build sections from Zmin to Zmax with step aStep
-      Standard_Boolean wasBuilt = Standard_False;
-      double gmaxdist = 0.0, gzmax = Zmax;
-      for (double zcur = Zmax; zcur > Zmin; zcur -= aStep)
-      {
-        // If plane of the section does not intersect BndBox of the face do nothing
-        if(zcur < Z1 || zcur > Z2 ) continue;
-                
-        // Build current section
-        gp_Pln pl(0,0,1,-zcur);
-//#if ! defined(BRepAlgoAPI_def01)
-//        BRepAlgoAPI_Section aSection(aFace,pl,Standard_False);
-//#else
-//        BRepAlgo_Section aSection(aFace,pl,Standard_False);
-//#endif
-//        aSection.Approximation(Standard_True);
-//        aSection.Build();
-//        // If section was built meassure distance between vertexes and plane of the one. Max distance is stored.
-//        if (aSection.IsDone())
-       
-       Standard_Boolean IsDone;
-       TopoDS_Shape aResult;
-       if (IsBRepAlgoAPI) {
-         di << "BRepAlgoAPI_Section aSection(aFace,pl,Standard_False)" <<"\n";
-         BRepAlgoAPI_Section aSection(aFace,pl,Standard_False);
-         aSection.Approximation(Standard_True);
-         aSection.Build();
-         IsDone = aSection.IsDone();
-         aResult = aSection.Shape();
-       } else {
-         di << "BRepAlgo_Section aSection(aFace,pl,Standard_False)" <<"\n";
-         BRepAlgo_Section aSection(aFace,pl,Standard_False);
-         aSection.Approximation(Standard_True);
-         aSection.Build();
-         IsDone = aSection.IsDone();
-         aResult = aSection.Shape();
-       }
-
-        if (IsDone)
-         {
-//         TopoDS_Shape aResult = aSection.Shape();
-           if (!aResult.IsNull())
-             {
-            double lmaxdist = 0.0;
-            double lmaxtoler = 0.0;
-            TopExp_Explorer aExp2;
-            for (aExp2.Init(aResult,TopAbs_VERTEX); aExp2.More(); aExp2.Next())
-            {
-              TopoDS_Vertex aV = TopoDS::Vertex(aExp2.Current());
-              Standard_Real  toler = BRep_Tool::Tolerance(aV);
-              double dist = pl.Distance(BRep_Tool::Pnt(aV));
-              if (dist > lmaxdist) lmaxdist = dist;
-              wasBuilt = Standard_True;
-      // If section was built check distance beetwen vertexes and plane of the one
-      str[0] =0;
-//       if (wasBuilt) 
-//       {
-//         if(gmaxdist > Precision::Confusion())
-//           sprintf(str,"Dist=%f, Param=%f FAULTY\n",gmaxdist,gzmax);
-//         else
-//           sprintf(str,"Dist=%f, Param=%f\n",gmaxdist,gzmax);
-        if(dist > toler)
-          sprintf(str,"Dist=%f, Toler=%f, Param=%f FAULTY\n",dist,toler,gzmax);
-        else
-          sprintf(str,"Dist=%f, Toler=%f, Param=%f\n",dist,toler,gzmax);
-//       }
-//       else sprintf(str,"No result\n");
-      di << str;
-            }
-            if (lmaxdist > gmaxdist)
-            {
-              gmaxdist = lmaxdist;
-              gzmax = zcur;
-            }
-          }
-        }
-      }
-    }
-  }
-  catch (Standard_Failure) {di << "OCC527 Exception \n" ;return 0;}
-  
-  return 0;
-}
-
-#include <StlMesh_Mesh.hxx>
-#include <StlTransfer.hxx>
-//=======================================================================
-//function : OCC1048
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1048 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  // Verify amount of arguments of the command
-  if (argc < 2) { di << "Usage : " << argv[0] <<" shape"; return 1;}
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-
-  Standard_Real theDeflection = 0.006;
-  Handle(StlMesh_Mesh) theStlMesh = new StlMesh_Mesh;
-  StlTransfer::BuildIncrementalMesh(aShape, theDeflection, Standard_False, theStlMesh);
-
-  Standard_Integer NBTRIANGLES = theStlMesh->NbTriangles();
-  di<<"Info: Number of triangles = "<<NBTRIANGLES<<"\n";
-
-  return 0;
-}
-
-void QAAMINO::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAAMINO";
-
-  //theCommands.Add("OCC527", "OCC527 shape", __FILE__, OCC527, group);  
-  theCommands.Add("OCC527", "OCC527 shape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC527, group);  
-  theCommands.Add("OCC1048", "OCC1048 shape", __FILE__, OCC1048, group);  
-  return;
-}
diff --git a/src/QAAlcatel/QAAlcatel.cdl b/src/QAAlcatel/QAAlcatel.cdl
deleted file mode 100755 (executable)
index d43647e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-05-21
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAAlcatel
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAAlcatel/QAAlcatel.cxx b/src/QAAlcatel/QAAlcatel.cxx
deleted file mode 100755 (executable)
index 754a4ae..0000000
+++ /dev/null
@@ -1,534 +0,0 @@
-// Created on: 2002-05-21
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAAlcatel.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_MapOfInteger.hxx>
-
-#include <TDocStd_Document.hxx>
-#include <TDocStd_Application.hxx>
-#include <DDocStd.hxx>
-#include <TDocStd_Owner.hxx>
-#include <TDF_Label.hxx>
-#include <DDF.hxx>
-#include <TPrsStd_AISViewer.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-
-#include <Draw_Viewer.hxx>
-#include <Draw.hxx>
-
-#ifndef WNT
-extern Draw_Viewer dout;
-#else
-Standard_IMPORT Draw_Viewer dout;
-#endif
-
-#include <BRep_Builder.hxx>
-#include <BRepTools.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <TopoDS.hxx>
-
-#if ! defined(WNT)
-extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#else
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#endif
-
-static TColStd_MapOfInteger theactivatedmodes(8);
-
-#include <AIS_PlaneTrihedron.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <GC_MakePlane.hxx>
-
-static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " shape mode" << "\n";
-    return 1;
-  }
-  
-  Standard_Integer ChoosingMode = -1;
-  if ( strcmp (argv [2], "VERTEX") == 0 ) {
-    ChoosingMode = 1;
-  }
-  if ( strcmp (argv [2], "EDGE") == 0 ) {
-    ChoosingMode = 2;
-  }
-  if ( strcmp (argv [2], "WIRE") == 0 ) {
-    ChoosingMode = 3;
-  }
-  if ( strcmp (argv [2], "FACE") == 0 ) {
-    ChoosingMode = 4;
-  }
-  if ( strcmp (argv [2], "SHELL") == 0 ) {
-    ChoosingMode = 5;
-  }
-  if ( strcmp (argv [2], "SOLID") == 0 ) {
-    ChoosingMode = 6;
-  }
-  if ( strcmp (argv [2], "COMPOUND") == 0 ) {
-    ChoosingMode = 7;
-  }
-  if ( ChoosingMode == -1 ) {
-    di << "ERROR : " << argv[1] << " : vrong value of a mode" << "\n";
-    return 1;
-  }
-
-  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
-
-  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-  
-  TCollection_AsciiString aName(argv[1]);
-  Handle(AIS_InteractiveObject) AISObj;
-  
-  if(!aMap.IsBound2(aName)) {
-    di << "Use 'vdisplay' before" << "\n";
-    return 1;
-  } else {
-    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
-    if(AISObj.IsNull()){
-      di << argv[1] << " : No interactive object" << "\n";
-      return 1;
-    } 
-
-    if (!aContext->HasOpenedContext()) {
-      aContext->OpenLocalContext();
-    }
-
-    if(!theactivatedmodes.Contains(ChoosingMode)) {
-      aContext->ActivateStandardMode(AIS_Shape::SelectionType(ChoosingMode));
-      theactivatedmodes.Add(ChoosingMode);
-    }
-    aContext->Erase(AISObj, updateviewer, PutInCollector);
-    aContext->UpdateCurrentViewer();
-
-    aContext->Display(AISObj, updateviewer);
-    aContext->UpdateCurrentViewer();
-
-    const TColStd_ListOfInteger& aList = aContext->ActivatedStandardModes();
-    Standard_Integer SelectMode;
-    TCollection_AsciiString SelectModeString;
-    TColStd_ListIteratorOfListOfInteger itr(aList);
-    for (; itr.More(); itr.Next()) {
-      SelectMode = itr.Value();
-      //cout << "SelectMode = " << SelectMode << endl;
-
-      switch (SelectMode)
-       {
-       case 1:
-         SelectModeString.Copy("VERTEX");
-         break;
-       case 2:
-         SelectModeString.Copy("EDGE");
-         break;
-       case 3:
-         SelectModeString.Copy("WIRE");
-         break;
-       case 4:
-         SelectModeString.Copy("FACE");
-         break;
-       case 5:
-         SelectModeString.Copy("SHELL");
-         break;
-       case 6:
-         SelectModeString.Copy("SOLID");
-         break;
-       case 7:
-         SelectModeString.Copy("COMPOUND");
-         break;
-       default:
-         SelectModeString.Copy("UNKNOWN");
-       }
-      di << "SelectMode = " << SelectModeString.ToCString() << "\n";
-
-    }
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC159bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 2) {
-    di << "ERROR : Usage : " << argv[0] << " Doc" << "\n";
-    return 1;
-  }
-  
-  Handle(TDocStd_Document) D;    
-  if (!DDocStd::GetDocument(argv[1],D)) return 1; 
-
-  Standard_Integer DocRefCount1 = D->GetRefCount();
-  di << "DocRefCount1 = " << DocRefCount1 << "\n";
-
-  Handle(TDocStd_Owner) Owner;
-  if (!D->Main().Root().FindAttribute(TDocStd_Owner::GetID(),Owner)) return 1; 
-
-  Handle(TDocStd_Document) OwnerD1 = Owner->GetDocument();    
-  if (OwnerD1.IsNull()) {
-    di << "DocOwner1 = NULL" << "\n";
-  } else {
-    di << "DocOwner1 = NOTNULL" << "\n";
-  }
-  Handle(TDocStd_Application) A;
-  if (!DDocStd::Find(A)) return 1;
-  A->Close(D); 
-
-  Handle(Draw_Drawable3D) DD = Draw::Get(argv[1],Standard_False);
-  dout.RemoveDrawable (DD);
-
-  Handle(TDocStd_Document) OwnerD2 = Owner->GetDocument();    
-  if (OwnerD2.IsNull()) {
-    di << "DocOwner2 = NULL" << "\n";
-  } else {
-    di << "DocOwner2 = NOTNULL" << "\n";
-  }
-
-  Standard_Integer DocRefCount2 = D->GetRefCount();
-  di << "DocRefCount2 = " << DocRefCount2 << "\n";
-
-  return 0;
-}
-
-static Standard_Integer OCC145bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " Shape MaxNbr" << "\n";
-    return 1;
-  }
-
-  TCollection_AsciiString aFileName = argv[1];
-  Standard_Integer aMaxNbr = atoi(argv[2]);
-
-  BRep_Builder aBld;
-  TopoDS_Shape aShape;
-
-  if (!BRepTools::Read(aShape, aFileName.ToCString(), aBld)) {
-    di << "ERROR :Could not read a shape!!!" << "\n";
-    return 1;
-  }
-
-  Standard_Integer i;
-  TopoDS_Wire      aWire   = TopoDS::Wire(aShape);
-  
-  for (i = 1; i <= aMaxNbr; i++) {
-    BRepBuilderAPI_MakeFace aMF(aWire);
-    if (!aMF.IsDone()) {
-      di << "ERROR : Could not make a face" << "\n";
-      return 1;
-    }
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC73_SelectionMode (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc < 3) {
-    di << "ERROR : Usage : " << argv[0] << " DOC entry [SelectionMode]" << "\n";
-    return 1;
-  }
-
-  Handle(TDocStd_Document) D;
-  //cout << "OCC73_SelectionMode  1" << endl;
-  if (!DDocStd::GetDocument(argv[1],D)) return 1;  
-  TDF_Label L;
-  //cout << "OCC73_SelectionMode  2" << endl;
-  if (!DDF::FindLabel(D->GetData(),argv[2],L)) return 1;  
-
-  Handle(TPrsStd_AISViewer) viewer;
-  //cout << "OCC73_SelectionMode  3" << endl;
-  if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-  Handle(TPrsStd_AISPresentation) prs;
-  //cout << "OCC73_SelectionMode  4" << endl;
-  if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-    if( argc == 4 ) {
-      prs->SetSelectionMode((Standard_Integer)atoi(argv[3]));
-      TPrsStd_AISViewer::Update(L);
-    }
-    else {
-      Standard_Integer SelectionMode = prs->SelectionMode();
-      //cout << "SelectionMode = " << SelectionMode << endl;
-      di<<SelectionMode;
-    }
-  }
-  //cout << "OCC73_SelectionMode  5" << endl;
-
-  return 0;
-}
-
-static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  if(argc != 4) {
-    di << "Usage : " << argv[0] << " name plane Length" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape S = DBRep::Get( argv[2] );
-  if ( S.IsNull() ) {
-    di << "Shape is empty" << "\n";
-    return 1;
-  }
-
-  TCollection_AsciiString name(argv[1]);
-  Standard_Real Length = atof(argv[3]);
-  
-  // Construction de l'AIS_PlaneTrihedron
-  Handle(AIS_PlaneTrihedron) theAISPlaneTri;
-
-  Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
-  if (IsBound) {
-    // on recupere la shape dans la map des objets displayes
-    Handle(AIS_InteractiveObject) aShape = 
-      Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
-      
-    // On verifie que l'AIS InteraciveObject est bien 
-    // un AIS_PlaneTrihedron
-    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
-      // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
-      theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape;
-
-      theAISPlaneTri->SetLength(Length);
-  
-      aContext->Redisplay(theAISPlaneTri, Standard_False);
-      aContext->UpdateCurrentViewer();
-    }
-  } else {
-    TopoDS_Face  FaceB=TopoDS::Face(S);
-  
-    // Construction du Plane
-    // recuperation des edges des faces.
-    TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
-  
-    TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
-    // declarations 
-    gp_Pnt A,B,C;
-  
-    // si il y a plusieurs edges
-    if (FaceExpB.More() ) {
-      FaceExpB.Next();
-      TopoDS_Edge EdgeC=TopoDS::Edge(FaceExpB.Current() );
-      BRepAdaptor_Curve theCurveB(EdgeB);
-      BRepAdaptor_Curve theCurveC(EdgeC);
-      A=theCurveC.Value(0.1);
-      B=theCurveC.Value(0.9);
-      C=theCurveB.Value(0.5);
-    }
-    else {
-      // FaceB a 1 unique edge courbe
-      BRepAdaptor_Curve theCurveB(EdgeB);
-      A=theCurveB.Value(0.1);
-      B=theCurveB.Value(0.9);
-      C=theCurveB.Value(0.5);
-    }
-    // Construction du Geom_Plane
-    GC_MakePlane MkPlane(A,B,C);
-    Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
-    
-    // on le display & bind
-    theAISPlaneTri= new AIS_PlaneTrihedron(theGeomPlane );
-    
-    theAISPlaneTri->SetLength(Length);
-    
-    GetMapOfAIS().Bind ( theAISPlaneTri, name);
-    aContext->Display(theAISPlaneTri );
-  }
-
-  Standard_Real getLength = theAISPlaneTri->GetLength();
-  di << "Length = " << Length << "\n";
-  di << "getLength = " << getLength << "\n";
-
-  if (getLength == Length) {
-    di << "OCC10: OK" << "\n";
-  } else {
-    di << "OCC10: ERROR" << "\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " shape mode; set selection mode" << "\n";
-    return 1;
-  }
-  
-  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
-
-  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-  
-  TCollection_AsciiString aName(argv[1]);
-  Handle(AIS_InteractiveObject) AISObj;
-
-  Standard_Integer SelectMode = atoi(argv[2]);
-  
-  if(!aMap.IsBound2(aName)) {
-    di << "Use 'vdisplay' before" << "\n";
-    return 1;
-  } else {
-    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
-    if(AISObj.IsNull()){
-      di << argv[1] << " : No interactive object" << "\n";
-      return 1;
-    } 
-    AISObj->SetSelectionMode(SelectMode);
-    if (!aContext->HasOpenedContext()) {
-      aContext->OpenLocalContext();
-    }
-    aContext->Erase(AISObj, updateviewer, PutInCollector);
-    aContext->UpdateCurrentViewer();
-    aContext->Display(AISObj, updateviewer);
-    aContext->UpdateCurrentViewer();
-  }
-  return 0;
-}
-
-static Standard_Integer OCC74bug_get (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-
-  if ( argc != 2) {
-    di << "ERROR : Usage : " << argv[0] << " shape; get selection mode" << "\n";
-    return 1;
-  }
-  
-  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
-
-  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-  
-  TCollection_AsciiString aName(argv[1]);
-  Handle(AIS_InteractiveObject) AISObj;
-
-  if(!aMap.IsBound2(aName)) {
-    di << "Use 'vdisplay' before" << "\n";
-    return 1;
-  } else {
-    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
-    if(AISObj.IsNull()){
-      di << argv[1] << " : No interactive object" << "\n";
-      return 1;
-    } 
-    Standard_Integer SelectMode = AISObj->SelectionMode();
-    di << SelectMode << "\n";
-  }
-
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <TDF_Data.hxx>
-#include <TNaming_Builder.hxx>
-#include <TNaming_NamedShape.hxx>
-
-static Standard_Integer OCC361bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  if ( nb != 2) {
-    di << "ERROR : Usage : " << a[0] << " Doc" << "\n";
-    di << "-1" << "\n";
-    return -1;
-  }
-
-  Handle(TDocStd_Document) D;    
-  if (!DDocStd::GetDocument(a[1],D)) {
-    di << "-2" << "\n";
-    return 1;  
-  }
-
-  BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
-  TopoDS_Shape aTBox = aBox.Shape();
-  aTBox.Orientation(TopAbs_FORWARD);
-
-  TDF_Label aTestLabel = D->GetData()->Root();
-  
-  TNaming_Builder aBuilder(aTestLabel);
-  aBuilder.Generated(aTBox);
-    
-  TopoDS_Shape aTBox1 = aTBox;
-  aTBox1.Orientation(TopAbs_REVERSED);
-  aTestLabel.ForgetAllAttributes();
-  aBuilder.Generated( aTBox1);
-
-  aTBox = aBuilder.NamedShape()->Get();
-  if(aTBox.Orientation() != TopAbs_REVERSED) {
-    di << "1" << "\n";
-  } else {
-    di << "0" << "\n";
-  }
-  return 0;
-}
-
-void QAAlcatel::Commands(Draw_Interpretor& theCommands) {
-  const char *group = "QAAlcatel";
-
-  theCommands.Add ("OCC328", "OCC328 shape mode", __FILE__, OCC328bug, group);
-
-  theCommands.Add ("OCC159", "OCC159 Doc", __FILE__, OCC159bug, group);
-  theCommands.Add ("OCC145", "OCC145 Shape MaxNbr", __FILE__, OCC145bug, group);
-
-  theCommands.Add ("OCC73_SelectionMode", "OCC73_SelectionMode DOC entry [SelectionMode]", __FILE__, OCC73_SelectionMode, group);
-
-  theCommands.Add ("OCC10", "OCC10 Shape MaxNbr", __FILE__, OCC10bug, group);
-
-  theCommands.Add ("OCC74_set", "OCC74_set shape mode;   set selection mode", __FILE__, OCC74bug_set, group);
-  theCommands.Add ("OCC74_get", "OCC74_get shape;   get selection mode", __FILE__, OCC74bug_get, group);
-
-  theCommands.Add("OCC361", "OCC361 Doc ", __FILE__, OCC361bug, group);
-
-  return;
-}
diff --git a/src/QABRGM/QABRGM.cdl b/src/QABRGM/QABRGM.cdl
deleted file mode 100755 (executable)
index 7196bb7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-03-20
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QABRGM
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
-    
diff --git a/src/QABRGM/QABRGM.cxx b/src/QABRGM/QABRGM.cxx
deleted file mode 100755 (executable)
index d8da2cf..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-// Created on: 2002-03-20
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QABRGM.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-void QABRGM::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QABRGM";
-
-  return;
-}
diff --git a/src/QABUC/FILES b/src/QABUC/FILES
deleted file mode 100755 (executable)
index 24501a6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-QABUC.cdl
-QABUC.cxx
-QABUC_CMPLRS.edl
diff --git a/src/QABUC/QABUC.cdl b/src/QABUC/QABUC.cdl
deleted file mode 100755 (executable)
index 6d41c2e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-06-17
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QABUC
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QABUC/QABUC.cxx b/src/QABUC/QABUC.cxx
deleted file mode 100755 (executable)
index 68d6789..0000000
+++ /dev/null
@@ -1,2328 +0,0 @@
-// Created on: 2002-06-17
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#include <QABUC.hxx>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include<Draw_Interpretor.hxx>
-#include<TopLoc_Location.hxx>
-#include<TopoDS_Face.hxx>
-#include<TopoDS.hxx>
-#include<DBRep.hxx>
-#include<Geom_Surface.hxx>
-#include<BRep_Tool.hxx>
-#include<GeomInt_IntSS.hxx>
-#include<BRepBuilderAPI_MakeEdge.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include<tcl.h>
-
-static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
-  if(argc!=4)
-  {
-    di << "Usage : " << a[0] << " result Shape1 Shape2" << "\n";
-    return -1;
-  }
-
-  TopLoc_Location L1;
-  TopLoc_Location L2;
-  TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
-  TopoDS_Face F2 = TopoDS::Face(DBRep::Get(a[3],TopAbs_FACE));
-  Handle(Geom_Surface) GSF1 = BRep_Tool::Surface(F1, L1);
-  Handle(Geom_Surface) GSF2 = BRep_Tool::Surface(F2, L2);
-  GeomInt_IntSS Inter;
-  Inter.Perform(GSF1,GSF2, BRep_Tool::Tolerance(F1));
-  if (!Inter.IsDone()) {
-    di << "Intersection not done" << "\n";
-    return 1;
-  }
-  Standard_Integer nbsol = Inter.NbLines();
-  if(!nbsol) {
-    di << "The number of solutions is zero!"   << "\n";
-    return 0;
-  }
-  Handle(Geom_Curve) Sol = Inter.Line(1);
-  if(!Sol.IsNull()) {
-    DBRep::Set(a[1], BRepBuilderAPI_MakeEdge(Sol));
-      return 0;
-    } else di << "The first solution is Null!"   << "\n";
-
-  di << "fini" << "\n";
-  return 0;
-}
-
-#include<ViewerTest.hxx>
-#include<AIS_InteractiveContext.hxx>
-#include<AIS_Shape.hxx>
-  
-static int BUC60569(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=2)
-  {
-    di << "Usage : " << argv[0] << " shape" << "\n";
-    return -1;
-  }
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  TopoDS_Shape theShape =  DBRep::Get(argv[1]);
-
-  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
-  myAISContext->Display( anAISShape, Standard_True );
-  myAISContext->OpenLocalContext(); 
-  myAISContext->ActivateStandardMode(TopAbs_FACE);
-  return 0;
-}
-
-static int BUC60614(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=2)
-  {
-    di << "Usage : "<< argv[0] << " shape" << "\n";
-    return -1;
-  }
-
-  //  di.Eval("vinit");
-
-  TopoDS_Shape theShape =  DBRep::Get(argv[1]);
-
-//  ViewerTest::GetAISContext(); 
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;    
-  }
-  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
-  myAISContext->Display( anAISShape, Standard_True );
-  myAISContext->OpenLocalContext(); 
-  myAISContext->ActivateStandardMode(TopAbs_COMPOUND);
-//  myAISContext->ActivateStandardMode(TopAbs_SOLID);
-//  di.Eval("vfit");
-//  cout << "vfini" << endl;
-  return 0;
-}
-
-#include<BRep_Builder.hxx>
-#include<BRepTools_ShapeSet.hxx>
-#include<BRepTools.hxx>
-#include<BRepAdaptor_HSurface.hxx>
-#include<TopOpeBRep_PointClassifier.hxx>
-#include<Precision.hxx>
-#ifdef WNT
-#include<stdio.h>
-#endif
-
-static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-//  char file1[100];
-  gp_Pnt2d uvSurf;
-  double U,V;
-  TopAbs_State state;
-  
-  if(argc < 2){
-    printf("Usage: %s  draw_format_face\n [name] [interactive (0|1)]",argv[0]);
-    return(-1);
-  }
-  
-  // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
-  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
-  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-  
-  Standard_Character  *file1 = new Standard_Character [strlen(DD)+strlen(argv[1])+2];
-  sprintf(file1,"%s/%s",DD,argv[1]);
-  
-  filebuf fic;
-  istream in(&fic);
-  if (!fic.open(file1,ios::in)) {
-    di << "Cannot open file for reading : " << file1 << "\n";
-    delete file1;
-    return(-1);
-  }
-
-  TopoDS_Shape theShape;
-  char typ[255];
-  in >> typ;
-  if (!in.fail()) {
-    if( !strcmp(typ, "DBRep_DrawableShape") ){
-      BRep_Builder B;
-      BRepTools_ShapeSet S(B);
-      S.Read(in);
-      S.Read(theShape,in);
-    }else{
-      di << "Wrong entity type in " << file1 << "\n";
-      delete file1;
-      return(-1);
-    }
-  }
-
-  const TopoDS_Face &face = TopoDS::Face (theShape);
-
-  if(argc > 2){
-    DBRep::Set(argv[2],face);
-  }
-
-  Standard_Boolean inter=Standard_False ;
-  
-  if(argc > 3){
-    inter= (atof(argv[3]) == 0) ? Standard_False : Standard_True ;
-  }
-
-  Standard_Real faceUMin,faceUMax,faceVMin,faceVMax;
-  
-  BRepTools::UVBounds (face, faceUMin,faceUMax,faceVMin,faceVMax);
-
-  di << "The bounds of the trimmed face:" << "\n";
-  di << faceUMin << " <= U <= " << faceUMax << "\n";
-  di << faceVMin << " <= V <= " << faceVMax << "\n";
-  
-  Handle(BRepAdaptor_HSurface) hsurfa = new BRepAdaptor_HSurface(face);
-  
-  TopOpeBRep_PointClassifier PClass;
-
-  di << "Now test the point classifier by inputting U,V values" << "\n";
-  di << "inside or outside the bounds displayed above" << "\n";
-  di << "Type stop to exit" << "\n";
-  
-  // Please register this:
-  // ***********************************************
-  // Note also that for periodic surfaces such as nimpod_1.topo,
-  // the U/V values may be +- 2pi compared to the actual face bounds
-  // (because U,V is probably coming from a Geom package routine).
-  // Hence IT WOULD BE USEFUL IF TopOpeBRep_PointClassifier COULD
-  // COPE WITH PERIODIC SURFACES, i.e. U,V +-Period giving same result.
-  // *************************************************
-  if(inter && (argc != 6)) {
-//    while(cin){
-      di << "Input U:   " << "\n";
-//      cin >> U;
-//      if(!cin) {
-       delete file1;
-       return(0);
-//      }
-      di << "Input V:   " << "\n";
-//      cin >> V;
-//      if(!cin) {
-       delete file1;
-       return(0);
-//      }
-      
-      uvSurf = gp_Pnt2d(U, V);
-      
-      //gp_Pnt2d uvSurf(0.14,5.1);  // outside!!!
-      //gp_Pnt2d uvSurf2(1.28,5.1); // inside
-    
-      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
-      if(state == TopAbs_IN || state == TopAbs_ON){
-       di << "U=" << U << " V=" << V << "  classified INSIDE" << "\n";
-      }else{
-       di << "U=" << U << " V=" << V << "  classified OUTSIDE" << "\n";
-      }
-//    }
-  } else {
-    if(argc != 6) {
-      uvSurf = gp_Pnt2d(0.14,5.1);
-      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
-      if(state == TopAbs_IN || state == TopAbs_ON){
-       di << "U=" << 0.14 << " V=" << 5.1 << "  classified INSIDE" << "\n";
-      }else{
-       di << "U=" << 0.14 << " V=" << 5.1 << "  classified OUTSIDE" << "\n";
-      }
-
-      uvSurf = gp_Pnt2d(1.28,5.1);
-      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
-      if(state == TopAbs_IN || state == TopAbs_ON){
-       di << "U=" << 1.28 << " V=" << 5.1 << "  classified INSIDE" << "\n";
-      }else{
-       di << "U=" << 1.28 << " V=" << 5.1 << "  classified OUTSIDE" << "\n";
-      }
-    } else {
-      uvSurf = gp_Pnt2d(atof(argv[4]),atof(argv[5]));
-      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
-      if(state == TopAbs_IN || state == TopAbs_ON){
-       di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << "  classified INSIDE" << "\n";
-      }else{
-       di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << "  classified OUTSIDE" << "\n";
-      }
-    }
-  }
-  return 0;
-}
-
-#if ! defined(WNT)
-void stringerror(int state)
-{
- printf("%s",((state&ios::eofbit) !=0)? " [eof]": "");
- printf("%s",((state&ios::failbit)!=0)? " [fail]":"");
- printf("%s",((state&ios::badbit) !=0)? " [bad]": "");
- printf("%s\n",(state==ios::goodbit)? " [ok]": "");
-}
-
-
-//#if defined(LIN)
-//#include <strstream>
-//#else
-//#include <strstream.h>
-//#endif
-#ifdef HAVE_IOSTREAM
-#include <iostream>
-#include <sstream>
-using namespace std;
-#elif defined (HAVE_IOSTREAM_H)
-#include <iostream.h>
-#include <strstream.h>
-#else
-#error "check config.h file or compilation options: either HAVE_IOSTREAM or HAVE_IOSTREAM_H should be defined"
-#endif
-static int UKI61075(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/) {
- double da,db;
- char buffer1[128];
-#ifndef USE_STL_STREAM
- ostrstream stringout1(buffer1,sizeof(buffer1));
- istrstream stringin1(buffer1,sizeof(buffer1));
-#else
- ostringstream stringout1(buffer1);
- istringstream stringin1(buffer1); 
-#endif
- char buffer2[128];
-#ifndef USE_STL_STREAM
- ostrstream stringout2(buffer2,sizeof(buffer2));
- istrstream stringin2(buffer2,sizeof(buffer2));
-#else
- ostringstream stringout2(buffer1);
- istringstream stringin2(buffer1); 
-#endif
-
- stringout1.precision(17);
- stringout2.precision(17);
-
- da=-(DBL_MAX);
- db=DBL_MAX;
- printf("Valeurs originales :\n\t%.17lg %.17lg\n",da,db);
-
- stringout1<<da<<' '<<db<<"\n";
-#ifndef USE_STL_STREAM
- buffer1[stringout1.pcount()]='\0';
-#else
- buffer1[stringout1.str().length()]= '\0' ;
-#endif
-
- printf("Valeurs ecrites dans le fichier :\n\t%s",buffer1);
-
- da=db=0.;
- stringin1>>da>>db;
- printf("Valeurs relues :\n\t%.17lg %.17lg",da,db);
- stringerror(stringin1.rdstate());
-
- stringout2<<da<<' '<<db<<"\n";
-#ifndef USE_STL_STREAM
- buffer2[stringout2.pcount()]='\0';
-#else
- buffer2[stringout2.str().length()]='\0';
-#endif
-
- printf("Valeurs reecrites :\n\t%s",buffer2);
-
- da=db=0.;
- stringin2>>da>>db;
- printf("Valeurs relues a nouveau :\n\t%.17lg %.17lg",da,db);
- stringerror(stringin2.rdstate());
- return(0);
-}
-#endif
-
-#include<BRepAlgoAPI_Section.hxx>
-#include<BRepAlgo_Section.hxx>
-
-#include<Geom_Plane.hxx>
-#include<DrawTrSurf.hxx>
-
-//static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane]";
-static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane] [BRepAlgoAPI/BRepAlgo = 1/0]";
-
-static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  
-  //if(argc<2) {
-  //  cerr << "Usage : " << argv[0] << St << endl;
-  //  return -1;
-  //}
-  if(argc < 2 || argc > 6) {
-    di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 6) {
-    Standard_Integer IsB = atoi(argv[5]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def04)
-//      di << "Error: There is not BRepAlgo_Section class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  
-  gp_Dir N;
-  if(!strcmp(argv[1],"trimsphere")) {
-//////////////////////////////////////////
-// Uncomment for trimmed sphere bug:
-//    filename = "trimsphere.topo";
-    N=gp_Dir( 0.0, -1.0, 0.0 );
-//////////////////////////////////////////
-  } else if(!strcmp(argv[1],"sphere")) {
-
-//////////////////////////////////////////
-// Uncomment for untrimmed sphere bug:
-
-//    filename="sphere.topo";
-    N=gp_Dir( 0.0, -0.75103523489975432, -0.66026212668838646 );
-    
-//////////////////////////////////////////
-  } else {
-    di << "Usage : " << argv[0] << St << "\n";
-    return -1;
-  }
-  
-  // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
-  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
-  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
-  Standard_Character  *filename = new Standard_Character [strlen(DD)+17];
-  sprintf(filename,"%s/%s.topo",DD,argv[1]);
-
-  filebuf fic;
-  istream in(&fic);
-  if (!fic.open(filename,ios::in)) {
-    di << "Cannot open file for reading : " << filename << "\n";
-    delete filename;
-    return -1;
-  }
-  
-  // Read in the shape
-  
-  BRep_Builder B;
-  BRepTools_ShapeSet S(B);
-  S.Read(in);
-  TopoDS_Shape theShape;
-  S.Read(theShape,in);
-  
-  // Create the plane
-  
-  gp_Pnt O( 2036.25, -97.5, -1460.499755859375 );
-  gp_Dir A( 1.0,  0.0, 0.0 );
-  
-  gp_Ax3 PLA( O, N, A );
-  gp_Pln Pl(PLA);
-  
-  // Perform the section
-  
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
-//#else
-//  BRepAlgo_Section Sec( theShape, Pl, Standard_False);
-//#endif
-
-  TopoDS_Shape res;
-  
-  try{
-    OCC_CATCH_SIGNALS
-//      Sec.Approximation(Standard_True);
-
-    //Sec.Build();
-    //if(!Sec.IsDone()){
-    //  cout << "Error performing intersection: not done." << endl;
-    //  delete filename;
-    //  return -1;
-    //}
-    //res = Sec.Shape();
-
-    if (IsBRepAlgoAPI) {
-      di << "BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False)" <<"\n";
-      BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
-      Sec.Build();
-      if(!Sec.IsDone()){
-       di << "Error performing intersection: not done." << "\n";
-       delete filename;
-       return -1;
-      }
-      res = Sec.Shape();
-    } else {
-      di << "BRepAlgo_Section Sec( theShape, Pl, Standard_False)" <<"\n";
-      BRepAlgo_Section Sec( theShape, Pl, Standard_False);
-      Sec.Build();
-      if(!Sec.IsDone()){
-       di << "Error performing intersection: not done." << "\n";
-       delete filename;
-       return -1;
-      }
-      res = Sec.Shape();
-    }
-    
-  }catch(Standard_Failure){
-    Handle(Standard_Failure) error = Standard_Failure::Caught();
-    di << "Error performing intersection: not done." << "\n";
-    delete filename;
-    return -1;
-  }
-  
-  if(argc>3) DBRep::Set(argv[3],theShape);
-
-  if(argc>2) DBRep::Set(argv[2],res);
-
-  if(argc>4) {
-    Handle(Geom_Geometry) result;
-    Handle(Geom_Plane) C = new Geom_Plane(Pl);
-    result=C;
-    DrawTrSurf::Set(argv[4],result);
-  }
-  
-  di << "Done" << "\n";
-
-  delete filename;
-  
-  return 0;
-}
-
-#include<TopoDS_Compound.hxx>
-
-static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " name"   << "\n";
-    return -1;
-  }
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  
-  // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
-  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
-  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
-  Standard_Character *Ch = new Standard_Character[strlen(argv[1])+3];
-
-  Standard_Character *FileName = new Standard_Character[strlen(DD)+13];
-  TopoDS_Shape free_1,free_2,free_3,free_4;
-  BRep_Builder B;
-  sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
-  BRepTools::Read(free_1,FileName,B);
-  sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
-  BRepTools::Read(free_2,FileName,B);
-  sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
-  BRepTools::Read(free_3,FileName,B);
-  sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
-  BRepTools::Read(free_4,FileName,B);
-  sprintf(Ch,"%s_%i",argv[1],1);
-  DBRep::Set(Ch,free_1);
-  di << Ch << " ";
-  sprintf(Ch,"%s_%i",argv[1],2);
-  DBRep::Set(Ch,free_2);
-  di << Ch << " ";
-  sprintf(Ch,"%s_%i",argv[1],3);
-  DBRep::Set(Ch,free_3);
-  di << Ch << " ";
-  sprintf(Ch,"%s_%i",argv[1],4);
-  DBRep::Set(Ch,free_4);
-  di << Ch << " ";
-  
-//  Handle(AIS_Shape) S1 = new AIS_Shape(free_1); 
-//  Handle(AIS_Shape) S2 = new AIS_Shape(free_2); 
-//  Handle(AIS_Shape) S3 = new AIS_Shape(free_3); 
-//  Handle(AIS_Shape) S4 = new AIS_Shape(free_4);
-  
-//  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-
-//  myAISContext->Display(S1); 
-//  myAISContext->Display(S2); 
-//  myAISContext->Display(S3); 
-//  myAISContext->Display(S4);
-
-//  di.Eval("vfit");
-  
-  TopoDS_Compound Com; 
-  BRep_Builder bui;
-  bui.MakeCompound(Com); 
-  bui.Add(Com,free_1); 
-  bui.Add(Com,free_2); 
-  bui.Add(Com,free_3); 
-  bui.Add(Com,free_4); 
-
-  sprintf(Ch,"%s_%c",argv[1],'c');
-  DBRep::Set(Ch,Com);
-  di << Ch << " ";
-
-  Handle(AIS_Shape) SC = new AIS_Shape(Com);
-  myAISContext->Display(SC); // nothing on the screen If I save the compound :
-
-  sprintf(FileName,"%s/%s",DD,"free.brep");
-
-  BRepTools::Write(Com,FileName); 
-
-  delete Ch;
-  delete FileName;
-  
-  return 0;
-}
-
-#include<BRepBuilderAPI_MakeVertex.hxx>
-#include<TCollection_ExtendedString.hxx>
-#include<AIS_LengthDimension.hxx>
-
-static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
-{
-  
-  Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
-  if(myAIScontext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-  myAIScontext->EraseAll();
-  
-  TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0,0,0)); 
-  TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10,10,0)); 
-  
-  Handle(AIS_Shape) Ve1 = new AIS_Shape(V1);
-  Handle(AIS_Shape) Ve2 = new AIS_Shape(V2);
-  
-  myAIScontext->Display(Ve1); 
-  myAIScontext->Display(Ve2); 
-  
-  Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1)); 
-  TCollection_ExtendedString Ext1("Dim1"); 
-  Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1); 
-  
-  myAIScontext->SetDisplayMode(Dim1, atof(a[1]));
-  myAIScontext->Display(Dim1);
-  return 0;
-}
-
-#include<TopoDS_Wire.hxx>
-
-static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
-{
-  if(argc!=2) {
-    di << "Usage : BUC60652 fase"   << "\n";
-    return 1;
-  }
-  TopoDS_Shape shape = DBRep::Get( argv[1] ); 
-  TopoDS_Face face = TopoDS::Face( shape ); 
-  TopoDS_Wire ow = BRepTools::OuterWire( face ); 
-  DBRep::Set( "w", ow ); 
-  return 0; 
-}
-
-#include <BRepAlgo_BooleanOperations.hxx>
-  
-static Standard_Integer defNbPntMax = 30;
-static Standard_Real defTol3d = 1.e-7;
-static Standard_Real defTol2d = 1.e-7;
-static Standard_Boolean defRelativeTol=Standard_True;
-Standard_Integer NbPntMax = defNbPntMax;
-Standard_Real Toler3d =defTol3d;
-Standard_Real Toler2d = defTol2d;
-Standard_Boolean RelativeTol= defRelativeTol;
-//              //== // ksection : operateur section appelant BRepAlgo_BooleanOperation
-//== // ksection : operateur section appelant BRepAlgo_BooleanOperations
-//=======================================================================
-Standard_Integer ksection(Draw_Interpretor& di, Standard_Integer n, const char ** a) {
-  if (n < 8) {
-    di << "Usage : " << a[0] << " resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol"   << "\n";
-    return -1;
-  }
-  // a[1]= resultat
-  // a[2]= shell1
-  // a[3]= shell2
-  // a[4]= NbPntMax
-  // a[5]= Toler3d
-  // a[6]= Toler2d
-  // a[7]= RelativeTol
-  TopoDS_Shape s1 = DBRep::Get(a[2],TopAbs_SHELL);
-  TopoDS_Shape s2 = DBRep::Get(a[3],TopAbs_SHELL);
-  if (s1.IsNull() || s2.IsNull()) return 1;
-  NbPntMax=atoi(a[4]);
-  Toler3d=atof(a[5]);
-  Toler2d=atof(a[6]);
-  RelativeTol=atoi(a[7]);
-
-  di << "BRepAlgo_BooleanOperations myalgo" << "\n";
-  BRepAlgo_BooleanOperations myalgo;
-
-  myalgo.Shapes(s1, s2);
-  myalgo.SetApproxParameters(NbPntMax,Toler3d,Toler2d,RelativeTol);
-  TopoDS_Shape res; res = myalgo.Section();
-  DBRep::Set(a[1],res);
-  return 0;
-}
-
-#include <Geom_Axis2Placement.hxx>
-#include <AIS_Trihedron.hxx>
-
-static Standard_Integer BUC60574(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
-{
-  
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-  
-  Handle(Geom_Axis2Placement) atrihedronAxis = new Geom_Axis2Placement(gp::XOY()); 
-  Handle(AIS_Trihedron) atri = new AIS_Trihedron(atrihedronAxis); 
-  gp_Trsf aTrsf; 
-  gp_Vec trans(5,5,5); 
-  aTrsf.SetTranslation(trans); 
-  TopLoc_Location aLoc(aTrsf); 
-  myAISContext->SetLocation(atri,aLoc); 
-  myAISContext->Display(atri,0,-1,Standard_True, Standard_True);
-  myAISContext->OpenLocalContext(Standard_False, 
-                                Standard_True,Standard_False,Standard_False); 
-  myAISContext->Load(atri,3,Standard_True);
-
-  return 0;
-}
-
-#include <TopoDS_Solid.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgo_Fuse.hxx>
-
-#include <V3d_Plane.hxx>
-#include <V3d_View.hxx>
-#include <gce_MakePln.hxx>
-
-static Standard_Integer BUC60698(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
-  if(argc > 2) {
-    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 2) {
-    Standard_Integer IsB = atoi(a[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-  TopoDS_Solid box = BRepPrimAPI_MakeBox(1,1,1).Solid();
-  TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(gp_Pnt(0.5,0.5,0.5),0.6).Shape();
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  TopoDS_Shape fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
-//#else
-//  TopoDS_Shape fuse = BRepAlgo_Fuse(box,sphere).Shape();
-//#endif
-
-  TopoDS_Shape fuse;
-  if (IsBRepAlgoAPI) {
-    di << "fuse = BRepAlgoAPI_Fuse(box,sphere).Shape()" <<"\n";
-    fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
-  } else {
-    di << "fuse = BRepAlgo_Fuse(box,sphere).Shape()" <<"\n";
-    fuse = BRepAlgo_Fuse(box,sphere).Shape();
-  }
-
-  Handle_AIS_Shape theAISShape = new AIS_Shape(fuse);
-  myAISContext->Display(theAISShape);
-  di.Eval("vfit");
-  gp_Pln thegpPln = gce_MakePln(gp_Pnt(0.5,0.5,0.5),gp_Dir(0,0,1));
-  Standard_Real A,B,C,D;
-  thegpPln.Coefficients(A,B,C,D);
-  Handle_V3d_Plane thePlane = new V3d_Plane(A,B,C,D);
-  myAISContext->CurrentViewer()->AddPlane (thePlane); // add to defined planes list
-  for (myAISContext->CurrentViewer()->InitActiveViews();
-       myAISContext->CurrentViewer()->MoreActiveViews ();
-       myAISContext->CurrentViewer()->NextActiveViews ()) {
-    try {
-      OCC_CATCH_SIGNALS
-      myAISContext->CurrentViewer()->ActiveView()->SetPlaneOn(thePlane);
-    }
-    catch(Standard_Failure) {
-      di << "SetPlaneOn catched 1" << "\n";
-    }
-#ifdef WNT
-    catch(...) {
-      di << "SetPlaneOn catched 1" << "\n";
-    }
-#endif
-  }//ActiveView loop
-  for (myAISContext->CurrentViewer()->InitDefinedViews();
-       myAISContext->CurrentViewer()->MoreDefinedViews ();
-       myAISContext->CurrentViewer()->NextDefinedViews ()) {
-    try {
-      OCC_CATCH_SIGNALS
-      myAISContext->CurrentViewer()->DefinedView()->SetPlaneOn(thePlane);
-    }
-    catch(Standard_Failure) {
-      di << "SetPlaneOn catched 1" << "\n";
-    }
-#ifdef WNT
-    catch(...) {
-      di << "SetPlaneOn catched 2" << "\n";
-    }
-#endif
-  }//DefinedView loop
-  myAISContext->UpdateCurrentViewer();
-  myAISContext->OpenLocalContext();
-  myAISContext->ActivateStandardMode(TopAbs_FACE);
-  return 0;
-}
-
-static Standard_Integer BUC60699(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
-{
-  
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-  TopoDS_Solid B1 = BRepPrimAPI_MakeBox (1,1,1).Solid();
-  TopAbs_ShapeEnum theType = B1.ShapeType();
-  if ( theType == TopAbs_SOLID ) {
-    di << "It is a solid."   << "\n";
-  } else {
-    di << "It is not solid."   << "\n";
-  }
-  myAISContext->Display(new AIS_Shape(B1)); 
-  myAISContext->OpenLocalContext();
-  TopAbs_ShapeEnum amode = TopAbs_SOLID;
-  myAISContext->ActivateStandardMode(amode);
-  di.Eval("vfit");
-  di.Eval("QAMoveTo 200 200");
-  di.Eval("QASelect 200 200");
-  myAISContext->InitSelected() ;
-  if ( myAISContext->MoreSelected() ) {
-    if (myAISContext->HasSelectedShape() ) {
-      di << "has selected shape : OK"   << "\n";
-    } else {
-      di << "has selected shape : bugged - Faulty "   << "\n";
-    }
-  }
-  return 0;
-}
-
-static Standard_Integer GER61394(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
-{
-  if(argc > 2) {
-    di << "Usage : " << argv[0] << " [1/0]" << "\n";
-    return -1;
-  }
-  
-  Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
-  if(myAIScontext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  
-  if((argc == 2) && (atof(argv[1]) == 0))
-    myV3dView->SetAntialiasingOff();
-  else
-    myV3dView->SetAntialiasingOn();
-  myV3dView->Update();
-  return 0;
-}
-
-
-#define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
-
-//=======================================================================
-//function : GetColorFromName
-//purpose  : get the Quantity_NameOfColor from a string
-//=======================================================================
-
-static Quantity_NameOfColor GetColorFromName( const char *name ) 
-{ 
-  Quantity_NameOfColor ret = DEFAULT_COLOR;
-  
-  Standard_Boolean Found = Standard_False;
-  Standard_CString colstring;
-  for(Standard_Integer i=0;i<=514 && !Found;i++)
-    {
-      colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
-      if (!strcasecmp(name,colstring)) {
-       ret = (Quantity_NameOfColor)i;
-       Found = Standard_True;
-      }
-    }
-  
-  return ret;
-}
-   
-static Standard_Integer setcolor (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
-{
-
-Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-if(myAISContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-
-switch (argc){
-
- case 2:
-   {
-     di <<"case 2 : This command will change the background color to " << argv[1]<< "\n";
-//   setcolor <name> 
-//   Change the background color of the view with a predefined name Graphic3d_NOC_<name>  
-
-     myV3dView -> SetBackgroundColor(GetColorFromName(argv[1]));
-     myV3dView -> Redraw();
-   break;
-   }
-
- case 3:
-   {
-     di <<"case 3 : This command will change the color of the objects to "<< argv[2]<< "\n";
-//   setcolor <object> <name> 
-//   Change the object color with a predefined name 
-
-     TopoDS_Shape aShape = DBRep::Get(argv[1]);
-     Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
-     myAISContext->SetColor(myShape,GetColorFromName(argv[2]),Standard_True);
-     myAISContext->Display(myShape,Standard_True);
-     myAISContext->UpdateCurrentViewer();
-//     return 0;
-   break;
-   }
- case 4:
-   {
-     di <<"case 4 : This command will change the background color to <r> <g> <b> :"<< argv[1] << argv[2] << argv[3] << "\n";
-
-//   setcolor <r> <g> <b> 
-//   Change the background color of the view with the color values <r>,<g>,<b> 
-//   A color value must be defined in the space [0.,1.] 
-
-     Standard_Real QuantityOfRed   = atoi(argv[1]);
-     Standard_Real QuantityOfGreen = atoi(argv[2]);
-     Standard_Real QuantityOfBlue  = atoi(argv[3]);
-     myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue);
-     myV3dView->Redraw();
-   break;
-   }
-
- case 5:
-   {
-    di <<"case 5 : This command will change the color of the objects to <r> <g> <b> : "<<argv[2]<< argv[3]<< argv[4]<< "\n";
-
-//  setcolor <object> <r> <g> <b> 
-//  change the object color with RGB values. 
-
-
-    Standard_Real QuantityOfRed   = atof(argv[2]);
-    Standard_Real QuantityOfGreen = atof(argv[3]);
-    Standard_Real QuantityOfBlue  = atof(argv[4]);
-
-    TopoDS_Shape aShape = DBRep::Get(argv[1]);
-    Handle(AIS_InteractiveObject) myShape =  new AIS_Shape (aShape);
-    myAISContext->SetColor(myShape,Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB),Standard_True);
-    myAISContext->Display(myShape,Standard_True);
-    myAISContext->UpdateCurrentViewer();
-//  myShape->SetColor(Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB));
-//  myShape->Redisplay();
-   break;
-   }
- }
-return 0;
-}
-
-static Standard_Integer BUC60726 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
-{
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " 0/1" << "\n";
-  }
-
-  if(atoi(argv[1]) == 0) {
-    myAISContext->CloseAllContexts();
-    BRepPrimAPI_MakeBox B(gp_Pnt(-400.,-400.,-100.),200.,150.,100.);
-    Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape());
-    myAISContext->Display(aBox);
-  } else if(atoi(argv[1]) == 1) {
-    myAISContext->CloseAllContexts();
-    myAISContext->OpenLocalContext();
-    myAISContext->ActivateStandardMode(TopAbs_EDGE);
-  } else if(atoi(argv[1]) == 2) {
-    myAISContext->CloseAllContexts();
-    myAISContext->OpenLocalContext();
-    myAISContext->ActivateStandardMode(TopAbs_FACE);
-  } else {
-    di << "Usage : " << argv[0] << " 0/1" << "\n";
-    return -1;
-  }
-  
-  return 0;
-}
-
-#include <BRepBndLib.hxx>
-#include <Bnd_HArray1OfBox.hxx>
-  
-static Standard_Integer BUC60729 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** /*argv*/ )
-{
-  Bnd_Box aMainBox;
-  TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1,1,1).Solid();
-
-  BRepBndLib::Add(aShape , aMainBox );
-
-  Standard_Integer siMaxNbrBox = 6;
-  Bnd_BoundSortBox m_BoundSortBox;
-  m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
-  TopExp_Explorer aExplorer(aShape,TopAbs_FACE);
-  Standard_Integer i;
-
-
-//  Bnd_Box __emptyBox; // Box is void !
-//  Handle_Bnd_HArray1OfBox __aSetOfBox = new Bnd_HArray1OfBox( 1, siMaxNbrBox, __emptyBox ); 
-
-  for (i=1,aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(),i++ ) 
-    { 
-      const TopoDS_Shape& aFace = aExplorer.Current();
-      Bnd_Box aBox;
-      BRepBndLib::Add( aFace, aBox );
-      m_BoundSortBox.Add( aBox, i );
-//      __aSetOfBox->SetValue( i, aBox ); 
-    } 
-//  m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
-  
-  return 0;
-}
-
-static Standard_Integer BUC60724(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
-{
-  TCollection_AsciiString as1("");
-  TCollection_AsciiString as2('\0');
-  if((as1.ToCString()!=NULL) || (as1.ToCString() != ""))
-    di << "Faulty : the first string is not zero string : " << as1.ToCString() << "\n";
-
-  if((as2.ToCString()!=NULL) || (as2.ToCString() != ""))
-    di << "Faulty : the second string is not zero string : " << as2.ToCString() << "\n";
-  
-  return 0;
-}
-
-#include <UnitsAPI.hxx>
-
-static Standard_Integer BUC60727(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
-{
-di <<"Program Test" << "\n";
-UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); //length is mm 
-di <<"AnyToLS (3,mm) = " << UnitsAPI::AnyToLS(3.,"mm") << "\n"; // result was WRONG. 
-
-   return 0;
-}
-
-#include <gp_Circ.hxx>
-#include <Geom_Circle.hxx>
-#include <GeomAPI.hxx>
-#include <Geom2d_CartesianPoint.hxx>
-#include <Geom2dGcc_QualifiedCurve.hxx>
-#include <Geom2dGcc_Circ2d2TanRad.hxx>
-#include <Geom2d_Circle.hxx>
-#include <ProjLib.hxx>
-
-static Standard_Integer BUC60792(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  gp_Pnt pt3d(0, 20, 150);
-  gp_Ax2 anAx2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0), gp_Dir(0, 0, 1));
-  gp_Circ circ(anAx2, 50.0); 
-  Handle_Geom_Circle gcir = new Geom_Circle(circ); 
-  Handle_Geom_Plane pln = new Geom_Plane(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0))); 
-  Handle_Geom2d_Curve gcir1 = GeomAPI::To2d(gcir, pln->Pln()); 
-  TopoDS_Shape sh1 = BRepBuilderAPI_MakeEdge(gcir1, pln).Shape(); 
-  Handle_AIS_Shape ais1 = new AIS_Shape(sh1); 
-  aContext->SetColor(ais1, Quantity_NOC_INDIANRED); 
-  aContext->Display(ais1); 
-  DBRep::Set("sh0",sh1);
-  gp_Pnt2d thepoint; 
-//  local_get_2Dpointfrom3Dpoint(pt3d, pln->Pln(), thepoint); 
-  thepoint = ProjLib::Project(pln->Pln(),pt3d);
-  Handle_Geom2d_CartesianPoint ThePoint = new Geom2d_CartesianPoint(thepoint); 
-  Geom2dAdaptor_Curve acur1(gcir1) ; 
-  Geom2dGcc_QualifiedCurve qcur1(acur1, GccEnt_outside) ; 
-  Geom2dGcc_Circ2d2TanRad cirtanrad(qcur1, ThePoint, 200.0, 0.0001); 
-  printf("\n No. of solutions = %d\n", cirtanrad.NbSolutions()); 
-  Handle_Geom2d_Circle gccc; 
-  if( cirtanrad.NbSolutions() ) { 
-    for( int i = 1; i<=cirtanrad.NbSolutions(); i++) { 
-      gp_Circ2d ccc = cirtanrad.ThisSolution(i); 
-      gccc = new Geom2d_Circle(ccc); 
-      TopoDS_Shape sh = BRepBuilderAPI_MakeEdge(gccc, pln).Shape();
-      Standard_Character aStr[5];
-      sprintf(aStr,"sh%d",i);
-      DBRep::Set(aStr,sh);
-      Handle_AIS_Shape ais = new AIS_Shape(sh); 
-      if( i ==1 ) 
-       aContext->SetColor(ais, Quantity_NOC_GREEN); 
-      if( i == 2) 
-       aContext->SetColor(ais, Quantity_NOC_HOTPINK); 
-      aContext->Display(ais); 
-      Standard_Real ParSol1, ParSol2, ParArg1, ParArg2; 
-      gp_Pnt2d PntSol1, PntSol2; 
-      cirtanrad.Tangency1(i, ParSol1, ParArg1, PntSol1);
-      printf("%f\t%f\t\t%f\t%f\n",ParSol1, ParArg1,PntSol1.X(),PntSol1.Y());
-      cirtanrad.Tangency2(i, ParSol2, ParArg2, PntSol2); 
-      printf("%f\t%f\t\t%f\t%f\n",ParSol2, ParArg2,PntSol2.X(),PntSol2.Y());
-    }
-  }
-  return 0;
-}
-
-#include <TColgp_Array2OfPnt.hxx>
-#include <Geom_BezierSurface.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <Geom_OffsetSurface.hxx>
-#include <BRepFilletAPI_MakeFillet2d.hxx>
-#include <GeomProjLib.hxx>
-#include <Geom_TrimmedCurve.hxx>
-
-static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
-{
-  if(argc == 4) {
-    TopLoc_Location L1;
-    TopoDS_Edge aEdge = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
-    TopoDS_Face aFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
-    Standard_Real f = 0.0, l = 0.0; 
-    Handle(Geom_Curve) GC = BRep_Tool::Curve(aEdge,f,l);
-    Handle(Geom_Surface) GS = BRep_Tool::Surface(aFace, L1);
-    GC = new Geom_TrimmedCurve(GC, f, l); 
-    Handle(Geom_Curve) projCurve = GeomProjLib::Project(GC,GS); 
-    BRepBuilderAPI_MakeWire *myWire; 
-    myWire = new BRepBuilderAPI_MakeWire(); 
-    myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge());
-    DBRep::Set(argv[1],myWire->Wire());
-    return  0;
-  }
-  
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  
-//step 1. creating a Bezier Surface and a patch 
-  TopoDS_Face FP; 
-  TopoDS_Shape FP1; 
-  TopoDS_Solid solid; 
-  Handle(AIS_Shape) ais1; 
-  Handle_AIS_Shape ais2; 
-  Handle(Geom_BezierSurface) BZ1;
-  TColgp_Array2OfPnt array1(1,3,1,3);
-  array1.SetValue(1,1,gp_Pnt(0,100,0));
-  array1.SetValue(1,2,gp_Pnt(200,100,0));
-  array1.SetValue(1,3,gp_Pnt(400,100,0)); 
-  array1.SetValue(2,1,gp_Pnt(0,200,100)); 
-  array1.SetValue(2,2,gp_Pnt(200,200,100)); 
-  array1.SetValue(2,3,gp_Pnt(400,200,100)); 
-  array1.SetValue(3,1,gp_Pnt(0,300,0)); 
-  array1.SetValue(3,2,gp_Pnt(200,300,0)); 
-  array1.SetValue(3,3,gp_Pnt(400,300,0)); 
-  BZ1 = new Geom_BezierSurface(array1);
-  BRepBuilderAPI_MakeFace bzf1( BZ1, Precision::Confusion() );
-  TopoDS_Face F1= bzf1.Face();
-  ais1 = new AIS_Shape(F1);
-  DBRep::Set("F1",F1);
-  aContext->SetMaterial(ais1,Graphic3d_NOM_ALUMINIUM,Standard_False);
-  aContext->Display(ais1);
-  BRep_Builder B;
-  TopoDS_Shell shell;
-  B.MakeShell(shell);
-  B.Add(shell, bzf1); 
-  B.MakeSolid(solid);
-  B.Add(solid,shell); 
-  gp_Dir D(0, 0, 1.0f); 
-  BRepBuilderAPI_MakeWire mkw; 
-  gp_Pnt p1 = gp_Pnt(150., 150.0, 260.);
-  gp_Pnt p2 = gp_Pnt(350., 150., 260.); 
-  BRepBuilderAPI_MakeEdge* E1 = new BRepBuilderAPI_MakeEdge(p1,p2); 
-  mkw.Add(*E1); 
-  p1 = gp_Pnt(350., 150., 260.); 
-  p2 = gp_Pnt(350., 250., 260.); 
-  BRepBuilderAPI_MakeEdge* E2 = new BRepBuilderAPI_MakeEdge(p1,p2); 
-  mkw.Add(*E2); 
-  p1 = gp_Pnt(350., 250., 260.); 
-  p2 = gp_Pnt(300., 250.0, 260.); 
-  BRepBuilderAPI_MakeEdge* E3 = new BRepBuilderAPI_MakeEdge(p1,p2);
-  mkw.Add(*E3); 
-  p1 = gp_Pnt(300., 250.0, 260.); 
-  p2 = gp_Pnt(200., 200.0, 260.); 
-  BRepBuilderAPI_MakeEdge* E4 = new BRepBuilderAPI_MakeEdge(p1,p2); 
-  mkw.Add(*E4); 
-  p1 = gp_Pnt(200., 200.0, 260.); 
-  p2 = gp_Pnt(150., 200.0, 260.); 
-  BRepBuilderAPI_MakeEdge* E5 = new BRepBuilderAPI_MakeEdge(p1,p2);
-  mkw.Add(*E5); 
-  p1 = gp_Pnt(150., 200.0, 260.); 
-  p2 = gp_Pnt(150., 150.0, 260.); 
-  BRepBuilderAPI_MakeEdge* E6 = new BRepBuilderAPI_MakeEdge(p1,p2);
-  mkw.Add(*E6); 
-  FP = BRepBuilderAPI_MakeFace(mkw.Wire()); 
-  ais2 = new AIS_Shape( FP ); 
-  aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False); 
-  aContext->Display( ais2 );
-
-  DBRep::Set("FP",FP);
-  
-//step 2. offseting the surface. 
-  Handle_Geom_OffsetSurface offsurf; 
-  offsurf = new Geom_OffsetSurface(BZ1, -100); 
-  BRepBuilderAPI_MakeFace bzf2( offsurf, Precision::Confusion() ); 
-  TopoDS_Face F2= bzf2.Face(); 
-  Handle_AIS_Shape ais22 = new AIS_Shape(F2); 
-  aContext->Display(ais22); 
-  DBRep::Set("F2",F2);
-  
-//step 3. filleting the patch. 
-//( I want to project wire of this patch on offseted surface above) 
-  BRepFilletAPI_MakeFillet2d fillet( FP ); 
-  TopExp_Explorer Ex; 
-  Ex.Init(FP, TopAbs_VERTEX); 
-  TopoDS_Vertex v1 = TopoDS::Vertex(Ex.Current()); 
-  fillet.AddFillet(v1, 20); 
-  printf("\nError is %d ", fillet.Status()); 
-  Ex.Next(); 
-  TopoDS_Vertex V2 = TopoDS::Vertex(Ex.Current()); 
-  fillet.AddFillet(V2, 20); 
-  printf("\nError is %d ", fillet.Status());
-  fillet.Build(); 
-  FP1 = fillet.Shape(); 
-  ais2 = new AIS_Shape( FP1 ); 
-  aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False); 
-  aContext->Display( ais2 ); 
-
-  DBRep::Set("FP1",FP1);
-  
-//step 4. Projecting the wire of this patch on offsetted surface. 
-//  TopExp_Explorer Ex; 
-  BRepBuilderAPI_MakeWire *myWire; 
-  myWire = new BRepBuilderAPI_MakeWire(); 
-  for (Ex.Init( FP1, TopAbs_EDGE); Ex.More(); Ex.Next()) 
-    { 
-      TopoDS_Edge e1 = TopoDS::Edge(Ex.Current()); 
-      Standard_Real f = 0.0, l = 0.0; 
-      Handle_Geom_Curve newBSplin = BRep_Tool::Curve(e1, f, l);
-      newBSplin = new Geom_TrimmedCurve(newBSplin, f, l); 
-      Handle(Geom_Curve) projCurve = GeomProjLib::Project(newBSplin,offsurf); 
-      myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge()); 
-    } 
-  Handle_AIS_Shape ais33 = new AIS_Shape( myWire->Wire() ); 
-  aContext->Display(ais33);
-
-  DBRep::Set("Wire",myWire->Wire());
-  
-  return 0;
-}
-
-#include<GeomAPI_ExtremaCurveCurve.hxx>
-
-static int BUC60825(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-
-{
-  if(argc < 3){
-    printf("Usage: %s edge1 edge2",argv[0]);
-    return(-1);
-  }
-        TopoDS_Edge E1 = TopoDS::Edge(DBRep::Get(argv[1])),
-       E2 = TopoDS::Edge(DBRep::Get(argv[2]));
-
-       Standard_Real fp , lp;
-
-       Handle(Geom_Curve) C1 = BRep_Tool::Curve(E1 , fp , lp),
-        C2 = BRep_Tool::Curve(E2 , fp , lp);
-
-       GeomAPI_ExtremaCurveCurve aExt(C1 , C2);
-
-       di << "NB RESULTS : " << aExt.NbExtrema() << "\n";
-
-       return 0;
-}
-
-#include <BRepBuilderAPI_MakePolygon.hxx>
-#include <BRepOffsetAPI_ThruSections.hxx>
-
-static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc > 2) {
-    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 2) {
-    Standard_Integer IsB = atoi(argv[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  double bottompoints1[12] = { 10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0};
-  double toppoints1[12] = { 0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10};
-  double bottompoints2[12] = { 0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00};
-  double toppoints2[12] = { 0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250};
-  BRepBuilderAPI_MakePolygon bottompolygon1, toppolygon1, bottompolygon2, toppolygon2;
-  gp_Pnt tmppnt;
-  for (int i=0;i<4;i++) {
-    tmppnt.SetCoord(bottompoints1[3*i], bottompoints1[3*i+1], bottompoints1[3*i+2]);
-    bottompolygon1.Add(tmppnt);
-    tmppnt.SetCoord(toppoints1[3*i], toppoints1[3*i+1], toppoints1[3*i+2]);
-    toppolygon1.Add(tmppnt);
-    tmppnt.SetCoord(bottompoints2[3*i], bottompoints2[3*i+1], bottompoints2[3*i+2]);
-    bottompolygon2.Add(tmppnt);
-    tmppnt.SetCoord(toppoints2[3*i], toppoints2[3*i+1], toppoints2[3*i+2]);
-    toppolygon2.Add(tmppnt);
-  }
-  bottompolygon1.Close();
-  DBRep::Set("B1",bottompolygon1.Shape());
-  toppolygon1.Close();
-  DBRep::Set("T1",toppolygon1.Shape());
-  bottompolygon2.Close();
-  DBRep::Set("B2",bottompolygon2.Shape());
-  toppolygon2.Close();
-  DBRep::Set("T2",toppolygon2.Shape());
-  BRepOffsetAPI_ThruSections loft1(Standard_True, Standard_True);
-  loft1.AddWire(bottompolygon1.Wire());
-  loft1.AddWire(toppolygon1.Wire());
-  loft1.Build();
-  BRepOffsetAPI_ThruSections loft2(Standard_True, Standard_True);
-  loft2.AddWire(bottompolygon2.Wire());
-  loft2.AddWire(toppolygon2.Wire());
-  loft2.Build();
-  if (loft1.Shape().IsNull() || loft2.Shape().IsNull())
-    return 1;
-  DBRep::Set("TS1",loft1.Shape());
-  DBRep::Set("TS2",loft2.Shape());
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
-//#else
-//  BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
-//#endif
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
-    BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
-    DBRep::Set("F",result.Shape());
-  } else {
-    di << "BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
-    BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
-    DBRep::Set("F",result.Shape());
-  }
-
-//  DBRep::Set("F",result.Shape());
-  return 0;
-}
-
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <GC_MakeTrimmedCone.hxx>
-
-static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  gp_Ax2  Cone_Ax;                                                                
-  double R1=8, R2=16, H1=20, H2=40, angle;                                       
-  gp_Pnt P0(0,0,0),                                                              
-  P1(0,0,20), P2(0,0,45);                                                        
-  angle = 2*M_PI;                                                                  
-  Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
-  TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
-  Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
-  aContext->Display(ais1);
-  aContext->SetColor(ais1, Quantity_NOC_BLUE1);
-  
-  Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2,R1, 0).Value();
-  TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
-  Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
-  aContext->Display(ais2);
-  aContext->SetColor(ais2, Quantity_NOC_RED);
-  return 0;
-}
-
-#if ! defined(WNT)
-//#include <fstream.h>
-#ifdef HAVE_FSTREAM
-# include <fstream>
-#elif defined (HAVE_FSTREAM_H)
-# include <fstream.h> 
-#endif
-//#include <Standard_Stream.hxx>
-//==========================================================================
-//function : CoordLoad
-//           chargement d une face dans l explorer.
-//==========================================================================
-static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{ 
-  char line[256];
-  char X[30], Y[30];
-  int fr;
-  TopoDS_Vertex V1,V2;
-  TopoDS_Edge Edge;
-  TopoDS_Wire Wire;
-  TopoDS_Face Face;
-
-  if (argc < 3) return 1;
-
-  ifstream file(argv[2], ios::in);
-  if(!file)
-    {
-      di<<"unable to open "<<argv[2]<<" for input"<<"\n";
-      return 2;
-    }
-  BRepBuilderAPI_MakeWire WB;
-
-  file.getline(line,80);
-  for(int i=0;i<30;i++) X[i]=Y[i]=0;
-  fr = sscanf(line,"%20c%20c",&X,&Y);
-  V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
-
-  for(;;)
-    {
-      file.getline(line,80);
-      if (!file) break;
-         for(int i=0;i<30;i++) X[i]=Y[i]=0;
-         fr = sscanf(line,"%20c%20c",&X,&Y);
-         V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
-         Edge = BRepBuilderAPI_MakeEdge(V1,V2);
-         WB.Add(Edge);
-         V1=V2;
-  }
-  
-  file.close();
-  if (WB.IsDone()) Wire = WB.Wire();
-  Face = BRepBuilderAPI_MakeFace(Wire);
-
-  DBRep::Set (argv[1],Face);
-  return 0;
-}
-#endif
-
-static Standard_Integer TestMem (Draw_Interpretor& /*di*/,
-                                Standard_Integer /*nb*/, 
-                                const char ** /*arg*/) 
-{
-  TCollection_ExtendedString aString(1024*1024, 'A');
-  return 0;
-}
-
-static Standard_Integer BUC60876_ (Draw_Interpretor& di,
-                                Standard_Integer argc, 
-                                const char ** argv) 
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }    
-  if((argc != 2) && (argc != 3)) {
-    di<< "usage : " << argv[0] << " shape [mode==1]" << "\n";
-    return -1;
-  }
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-  Handle(AIS_InteractiveObject) anIO = new AIS_Shape(aShape);
-//  Handle(AIS_InteractiveObject) anIOa = ViewerTest::GetAISShapeFromName(argv[1]);
-  anIO->SetHilightMode((argc == 3) ? atoi(argv[2]) : 1);
-  aContext->Display(anIO);
-  return 0;
-}
-
-//=======================================================================
-//function : buc60773
-//purpose  : 
-//=======================================================================
-
-#include<TCollection_HAsciiString.hxx>
-
-static Standard_Integer BUC60773 (Draw_Interpretor& /*di*/, Standard_Integer /*n*/, const char ** /*a*/)
-{
-  Handle(TCollection_HAsciiString) hAscii = new TCollection_HAsciiString();
-  Standard_CString aStr = hAscii->ToCString();
-  TCollection_AsciiString aAscii(aStr);  
-  
-  return 0;
-}
-
-#include<BRepPrimAPI_MakeCylinder.hxx>
-#include<BRepPrimAPI_MakeCone.hxx>
-
-static int TestCMD(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-
-{
-  if(argc > 2) {
-    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 2) {
-    Standard_Integer IsB = atoi(argv[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  //Cylindre 36.085182 20.0 8.431413 88.04671 20.0 38.931416 10.0
-
-  Standard_Real x11 = 36.085182;
-  Standard_Real y11 = 20.0;
-  Standard_Real z11 = 8.431413;
-  Standard_Real x12 = 88.04671;
-  Standard_Real y12 = 20.0;
-  Standard_Real z12 = 38.931416;
-  Standard_Real radius = 10.0;
-
-  gp_Pnt base1(x11, y11, z11);
-  gp_Dir vect1(x12-x11, y12-y11, z12-z11);
-  gp_Ax2 axis1(base1, vect1);
-  Standard_Real height1 = sqrt( ((x12-x11)*(x12-x11)) + ((y12-y11)*(y12-y11)) + ((z12-z11)*(z12-z11)) );
-  BRepPrimAPI_MakeCylinder cylinder(axis1, radius, height1);
-
-  TopoDS_Shape SCyl = cylinder.Shape();
-  DBRep::Set("cyl", SCyl);
-
-   
-  //Cone 70.7262 20.0 28.431412 105.36722 20.0 48.431416 6.0 3.0
-  Standard_Real x21 = 70.7262;
-  Standard_Real y21 = 20.0;
-  Standard_Real z21 = 28.431412;
-  Standard_Real x22 = 105.36722;
-  Standard_Real y22 = 20.0;
-  Standard_Real z22 = 48.431416;
-  Standard_Real radius1 = 6.0;
-  Standard_Real radius2 = 3.0;
-
-  gp_Pnt base2(x21, y21, z21);
-  gp_Dir vect2(x22-x21, y22-y21, z22-z21);
-  gp_Ax2 axis2(base2, vect2);
-  Standard_Real height2 = sqrt( ((x22-x21)*(x22-x21)) + ((y22-y21)*(y22-y21)) + ((z22-z21)*(z22-z21)) );
-  BRepPrimAPI_MakeCone cone(axis2, radius1, radius2, height2);
-
-  TopoDS_Shape SCon = cone.Shape();
-  DBRep::Set("con", SCon);
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
-//#else
-//  BRepAlgo_Fuse SFuse(SCyl, SCon);
-//#endif
-//
-//  if(! SFuse.IsDone() )
-//    cout<<"Error: Boolean fuse operation failed !"<<endl;
-//
-//  TopoDS_Shape fuse = SFuse.Shape();
-
-  TopoDS_Shape fuse;
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Fuse SFuse(SCyl, SCon)" <<"\n";
-    BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
-    if(! SFuse.IsDone() )
-      di<<"Error: Boolean fuse operation failed !"<<"\n";
-    fuse = SFuse.Shape();
-  } else {
-    di << "BRepAlgo_Fuse SFuse(SCyl, SCon)" <<"\n";
-    BRepAlgo_Fuse SFuse(SCyl, SCon);
-    if(! SFuse.IsDone() )
-      di<<"Error: Boolean fuse operation failed !"<<"\n";
-    fuse = SFuse.Shape();
-  }
-
-  DBRep::Set("fus", fuse);
-       
-  return 0;
-}
-
-#include <Dico_DictionaryOfInteger.hxx>
-#include <TColStd_HSequenceOfAsciiString.hxx>
-#include <TopExp.hxx>
-#include <TopoDS_Iterator.hxx>
-
-//---------------------------------------------------------------------------------------
-
-static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
-
-{  
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-  if(aShape.IsNull())
-  {
-    di<<"Invalid input shape"<<"\n";
-    return 1;
-  }
-  Handle(Dico_DictionaryOfInteger) aDico = new Dico_DictionaryOfInteger();
-  Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString;
-  Standard_CString aString;
-  Standard_Integer i=1,j=1,k=1,l=1,aa=1;
-  TopExp_Explorer expl;
-  Standard_Real f3d,l3d;
-  for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
-  {
-    // SURFACES
-    TopoDS_Face aFace = TopoDS::Face (expl.Current());
-    Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
-    aString = aSurface->DynamicType()->Name();
-
-    if(aDico->GetItem(aString,aa) != 0)
-    {
-      aDico->GetItem(aString,aa);
-      aDico->SetItem(aString,aa+1);
-    } else  {
-      aDico->SetItem(aString,1);
-      aSequence->Append(aString);
-      aa=1;
-      i++;
-    }
-  }
-  // PCURVES
-  for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
-  {
-    TopoDS_Face aFace = TopoDS::Face (expl.Current());
-    TopoDS_Iterator anIt(aFace);
-    TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
-    TopoDS_Iterator it (aWire); 
-    for (; it.More(); it.Next()) {
-      TopoDS_Edge Edge = TopoDS::Edge (it.Value());
-    Handle(Geom2d_Curve) aCurve2d = BRep_Tool::CurveOnSurface(Edge,aFace,f3d,l3d);
-    aString = aCurve2d->DynamicType()->Name();
-        if(aDico->GetItem(aString,aa) != 0)
-        {         
-          aDico->GetItem(aString,aa);
-          aDico->SetItem(aString,aa+1);
-        } else  {
-          aDico->SetItem(aString,1);
-          aSequence->Append(aString);
-          i++;
-          aa=1;
-        }
-    }
-  }
-  // 3d CURVES
-  TopExp_Explorer exp;
-  for (exp.Init(aShape,TopAbs_EDGE); exp.More(); exp.Next()) 
-  {
-      TopoDS_Edge Edge = TopoDS::Edge (exp.Current());
-      Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (Edge,f3d,l3d);
-      if(aCurve3d.IsNull())
-      {
-        l++;
-        goto aLabel;
-      }
-      aString = aCurve3d->DynamicType()->Name();
-        if(aDico->GetItem(aString,aa) != 0)
-        {
-          aDico->GetItem(aString,aa);
-          aDico->SetItem(aString,aa+1);
-        } else  {
-          aDico->SetItem(aString,1);
-          aSequence->Append(aString);
-          i++;
-          aa=1;
-        }
-    aLabel:;
-    }
-  // Output 
-  di<<"\n";
-  for(j=1;j<i;j++)
-    {
-      aDico->GetItem(aSequence->Value(j),aa);
-      di<<aa<<"   --   "<<aSequence->Value(j).ToCString()<<"\n";
-    }    
-
-  di<<"\n";
-  di<<"Degenerated edges :"<<"\n";
-  di<<l<<"   --    "<<"Degenerated edges "<<"\n";
-
-  return 0;
-
-}
-
-#include <BRepBuilderAPI_Transform.hxx>
-
-static Standard_Integer BUC60841(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
-{
-  if(argc > 2) {
-    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 2) {
-    Standard_Integer IsB = atoi(argv[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  gp_Ax2 Ax2 = gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0));
-  BRepPrimAPI_MakeCylinder cyl(Ax2, 260, 150);
-  //BRepPrimAPI_MakeCylinder cyl(gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0)), 260, 150);
-
-  TopoDS_Shape sh1 = cyl.Shape();
-  DBRep::Set("sh1",sh1);
-  gp_Trsf trsf1, trsf2;
-  trsf1.SetTranslation(gp_Pnt(0.000000,700.000000,-170.000000),
-                       gp_Pnt(0.000000,700.000000,-95.000000));
-  trsf2.SetRotation(gp_Ax1(gp_Pnt(0.000000,700.000000,-170.000000),
-                           gp_Dir(0.000000,0.000000,1.000000)), 0.436111);
-  BRepBuilderAPI_Transform trans1(sh1, trsf1);
-  TopoDS_Shape sh2 = trans1.Shape();
-  DBRep::Set("sh2",sh2);
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Fuse fuse1(sh1, sh2);
-//#else
-//  BRepAlgo_Fuse fuse1(sh1, sh2);
-//#endif
-//
-//  TopoDS_Shape fsh1 = fuse1.Shape();
-
-  TopoDS_Shape fsh1;
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Fuse fuse1(sh1, sh2)" <<"\n";
-    BRepAlgoAPI_Fuse fuse1(sh1, sh2);
-    fsh1 = fuse1.Shape();
-  } else {
-    di << "BRepAlgo_Fuse fuse1(sh1, sh2)" <<"\n";
-    BRepAlgo_Fuse fuse1(sh1, sh2);
-    fsh1 = fuse1.Shape();
-  }
-
-  DBRep::Set("fsh1",fsh1);
-  BRepBuilderAPI_Transform trans2(fsh1, trsf2);
-  TopoDS_Shape sh3 = trans2.Shape();
-  DBRep::Set("sh3",sh3);
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
-//#else
-//  BRepAlgo_Fuse fuse2(fsh1,sh3);
-//#endif
-//
-//  TopoDS_Shape fsh2 = fuse2.Shape();
-
-  TopoDS_Shape fsh2;
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Fuse fuse2(fsh1,sh3)" <<"\n";
-    BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
-    fsh2 = fuse2.Shape();
-  } else {
-    di << "BRepAlgo_Fuse fuse2(fsh1,sh3)" <<"\n";
-    BRepAlgo_Fuse fuse2(fsh1,sh3);
-    fsh2 = fuse2.Shape();
-  }
-
-  DBRep::Set("fsh2",fsh2);
-  Handle_AIS_Shape aisp1 = new AIS_Shape(fsh2);
-//  aContext->Display(aisp1);
-  return 0;
-}
-
-#include <ShapeBuild_Edge.hxx>
-
-static Standard_Integer BUC60874(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** argv )
-{
-  TopoDS_Edge e = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
-  ShapeBuild_Edge().BuildCurve3d(e);
-  DBRep::Set("ED",e);
-  return 0;
-}
-
-
-#include<TDF_Label.hxx>
-#include<TDataStd_TreeNode.hxx>
-
-#include<DDocStd.hxx>
-
-#include<DDF.hxx>
-
-#include<TDocStd_Modified.hxx>
-#include<TDF_ListIteratorOfDeltaList.hxx>
-#include<TDocStd_Document.hxx>
-#include<TDocStd_Application.hxx>
-#include<TDF_Delta.hxx>
-#include<TDataXtd_Constraint.hxx>
-#include<TPrsStd_AISPresentation.hxx>
-#include<TPrsStd_AISViewer.hxx>
-#include<TNaming_Builder.hxx>
-#include<TNaming_Naming.hxx>
-#include<TNaming_NamedShape.hxx>
-  
-static int BUC60817(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
-  
-  TDF_Label L1,L2;
-  Handle(TDataStd_TreeNode) TN1,TN2;
-
-  DDF::AddLabel(DF,"0:2",L1);
-  TN1 = TDataStd_TreeNode::Set(L1);
-
-  DDF::AddLabel(DF,"0:3",L2);
-  TN2 = TDataStd_TreeNode::Set(L2);
-
-  TN1->Append(TN2);
-  if(!(TN2->IsDescendant(TN1))) {di<<3;return 0;}
-  if((TN1->IsDescendant(TN2))) {di<<4;return 0;}
-
-  di<<0;
-  return 0;
-}
-
-static int BUC60831_1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<-1;
-    return 0;
-  }
-
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) {di<<-2;return 0;}
-  
-  TDF_Label L;
-  DDF::FindLabel(DF,"0:1",L,Standard_False);
-  Handle(TDocStd_Modified) MDF;
-  if (!L.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
-    MDF = new TDocStd_Modified();
-    L.Root().AddAttribute(MDF);
-  }
-
-  di<<!MDF->IsEmpty();
-  return 0;
-}
-
-static int BUC60831_2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=3) {
-    di << "Usage : " << argv[0] << " D Label" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
-  
-  TDF_Label L;
-  DDF::FindLabel(DF,argv[2],L,Standard_False);
-
-  TDocStd_Modified::Add(L);
-  
-  di<<0;
-  return 0;
-}
-
-static int BUC60836(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<1;
-    return 0;
-  }
-
-
-  Handle(TDF_Data) aDF;
-  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
-
-  Handle(TDocStd_Document) aDocument;
-  if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<3;return 0;}
-   
-  TDF_Label L;
-  Handle(TDataStd_TreeNode) TN;
-
-  aDocument->NewCommand();
-  DDF::AddLabel(aDF,"0:2",L);
-  TN = TDataStd_TreeNode::Set(L);
-
-  aDocument->NewCommand();
-  DDF::AddLabel(aDF,"0:3",L);
-  TN = TDataStd_TreeNode::Set(L);
-
-  aDocument->NewCommand();
-  DDF::AddLabel(aDF,"0:4",L);
-  TN = TDataStd_TreeNode::Set(L);
-  aDocument->NewCommand();
-
-  TDF_DeltaList Us,Rs;
-  Us = aDocument->GetUndos();
-  Rs = aDocument->GetUndos();
-
-  Standard_Integer i;
-  char Names[10][5]={"n1","n2","n3","n4","n5","n6","n7","n8","n9","n10"};  
-
-  TDF_ListIteratorOfDeltaList IDL;
-  for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
-    Handle(TDF_Delta) D = IDL.Value();
-    TCollection_ExtendedString S(Names[i-1]);
-    D->SetName(S);
-//    cout<<" U"<<i<<"="<<D->Name()<<endl;
-  }
-  
-  aDocument->Undo();
-  aDocument->Undo();
-  
-  Us = aDocument->GetUndos();
-  Rs = aDocument->GetRedos();
-
-  for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
-    Handle(TDF_Delta) D = IDL.Value();
-//    cout<<" U"<<i<<"="<<D->Name()<<endl;
-  }
-
-  TCollection_ExtendedString n2name ("n2");
-  for(IDL.Initialize(Rs),i=1;IDL.More();IDL.Next(),i++){
-    Handle(TDF_Delta) D = IDL.Value();
-    if ( i == 1 && ! D->Name().IsEqual (n2name) ) 
-    {
-      di << 4;
-      return 0;
-   }
-  }
-
-  di<<0;
-  return 0;
-}
-
-static int BUC60847(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=3) {
-    di << "Usage : " << argv[0] << " D Shape" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) aDF;
-  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
-  
-  TopoDS_Shape s = DBRep::Get(argv[2]);
-  if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
-  TDF_Label L;
-  DDF::AddLabel(aDF, "0:2", L);
-  TNaming_Builder SI (L);
-  SI.Generated(s);
-
-  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
-
-  TNaming_Naming aNN;
-  NS=aNN.Name(L,s,s);
-//  if (!NS->IsEmpty()) {di<<3;return 0;}
-  if (NS->IsEmpty()) {di<<4;return 0;}
-  di<<0;
-  return 0;
-}
-
-static int BUC60862(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=3) {
-    di << "Usage : " << argv[0] << " D Shape" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) aDF;
-  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
-  
-  TopoDS_Shape s = DBRep::Get(argv[2]);
-  if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
-  TDF_Label L;
-  DDF::AddLabel(aDF, "0:2", L);
-  TNaming_Builder SI (L);
-  SI.Generated(s);
-
-  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
-
-  TNaming_Naming aNN;
-  NS=aNN.Name(L,s,s);
-  if (NS->IsEmpty()) {di<<4;return 0;}
-  di<<0;
-  return 0;
-}
-
-static int BUC60867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if (argc == 2) {
-    TCollection_ExtendedString path (argv[1]); 
-    Handle(TDocStd_Application) A;
-    if (!DDocStd::Find(A)) {di<<1;return 0;}
-    Handle(TDocStd_Document) D;
-    Standard_Integer insession = A->IsInSession(path);
-    if (insession > 0) {  
-      di <<"document " << insession << "  is already in session" << "\n";
-      di<<2;
-      return 0;
-    }
-    PCDM_ReaderStatus Result = A->Open(path,D);
-    if(Result==PCDM_RS_OK){
-      di<<0;
-      return 0; 
-    }
-  }
-  di<<3;
-  return 0;
-}
-
-static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) aDF;
-  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
-  
-  TDF_Label L;
-  DDF::AddLabel(aDF, "0:2", L);
-  Handle(TPrsStd_AISPresentation) AISP = new TPrsStd_AISPresentation;
-
-  AISP->Set(L,TDataXtd_Constraint::GetID());
-
-  if (AISP->HasOwnMode()) {di<<3;return 0;}
-  AISP->SetMode(3);
-  Standard_Integer Mode = AISP->Mode();
-  if (Mode!=3) {di<<4;return 0;}
-  if (!AISP->HasOwnMode()) {di<<5;return 0;}
-  AISP->UnsetMode();
-  if (AISP->HasOwnMode()) {di<<6;return 0;}
-  di<<0;
-  return 0;
-}
-
-static int BUC60925(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<1;
-    return 0;
-  }
-
-  Handle(TDF_Data) aDF;
-  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
-  
-  TDF_Label L;
-  DDF::AddLabel(aDF, "0:2", L);
-  TDF_LabelMap LM;
-  LM.Add(L);
-  
-  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
-//  Handle(TNaming_Name) NN = new TNaming_Name;
-  TNaming_Name NN;
-
-  NN.Type(TNaming_IDENTITY);
-  NN.Append(NS);
-  Standard_Boolean Res = NN.Solve(L,LM);
-  
-  if (Res!=Standard_False) {di<<3;return 0;}
-  di<<0;
-  return 0;
-}
-
-static int BUC60932(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc!=2) {
-    di << "Usage : " << argv[0] << " D" << "\n";
-    di<<1;
-    return 0;
-  }
-
-
-  Handle(TDocStd_Document) aDocument;
-  if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<2;return 0;}
-   
-  if(!aDocument->InitDeltaCompaction()) {di<<3;return 0;}
-  if(!aDocument->PerformDeltaCompaction()) {di<<4;return 0;}
-
-  di<<0;
-  return 0;
-}
-
-//=======================================================================
-//function : AISWidth
-//purpose  : AISWidth (DOC,entry,[width])
-// abv: testing command for checking bug BUC60917 in TPrsStd_AISPresentation
-//=======================================================================
-
-static int AISWidth(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-
-  if (argc >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(argv[1],D)) {di<<(-1);return 0;}
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),argv[2],L)) {di<<(-2);return 0;}
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) {di<<(-3);return 0;}
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( argc == 4 ) {
-        prs->SetWidth(atof(argv[3]));
-        TPrsStd_AISViewer::Update(L);
-      }
-      else {
-       if (prs->HasOwnWidth()){ 
-//         cout << "Width = " << prs->Width() << endl;
-         di<<prs->Width();
-       }
-       else{
-         di << "AISWidth: Warning : Width wasn't set" << "\n";
-         di<<(-4);
-       }
-      }
-      return 0;
-    }
-  }
-  di << "AISWidth : Error"   << "\n";
-  di<<(-5);
-  return 0;
-}
-
-//=======================================================================
-//function : BUC60921 ( & BUC60954 )
-//purpose  : Test memory allocation of OCAF in Undo/Redo operations
-//=======================================================================
-
-static Standard_Integer BUC60921 (Draw_Interpretor& di,
-                                  Standard_Integer nb, 
-                                  const char ** arg) 
-{
-  if (nb >= 4) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) {di<<1;return 0;}
-    TDF_Label L;
-    DDF::AddLabel(D->GetData(),arg[2],L);
-
-    BRep_Builder B;
-    TopoDS_Shape S;
-    BRepTools::Read ( S, arg[3], B );
-    
-    TNaming_Builder tnBuild(L);
-    tnBuild.Generated(S);
-//    di << "File " << arg[3] << " added";
-    di<<0;
-    return 0;
-  }
-  di << "BUC60921 Doc label brep_file: directly read brep file and put shape to the label"   << "\n";
-  di<<2;
-  return 0;
-}
-
-#include<IGESControl_Reader.hxx>
-#include<BRepPrimAPI_MakeHalfSpace.hxx>
-
-static Standard_Integer BUC60951_(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
-  //if(argc!=2)
-  //  {
-  //    cerr << "Usage : " << a[0] << " file.igs" << endl;
-  //    return -1;
-  //  }
-  if(argc < 2 || argc > 3) {
-    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 3) {
-    Standard_Integer IsB = atoi(a[2]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  
-  Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext(); 
-
-  if(myContext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-
-//  IGESControlStd_Reader reader;
-  IGESControl_Reader reader;
-  reader.ReadFile(a[1]);
-  reader.TransferRoots();
-  TopoDS_Shape shape = reader.OneShape();
-  printf("\n iges1 shape type = %d", shape.ShapeType() );
-  TopTools_IndexedMapOfShape list;
-  TopExp::MapShapes(shape, TopAbs_FACE, list);
-  printf("\n No. of faces = %d", list.Extent());
-
-  TopoDS_Shell shell;
-  BRep_Builder builder;
-  builder.MakeShell(shell);
-  for(int i=1;i<=list.Extent(); i++) { 
-    TopoDS_Face face = TopoDS::Face(list.FindKey(i));
-    builder.Add(shell, face);
-  }
-
-  BRepPrimAPI_MakeHalfSpace half(shell, gp_Pnt(0, 0, 20));
-  TopoDS_Solid sol = half.Solid();
-  gp_Ax2 anAx2(gp_Pnt(-800.0, 0.0, 0), gp_Dir(0, 0, -1));
-  BRepPrimAPI_MakeCylinder cyl(anAx2, 50, 300);
-  TopoDS_Shape sh = cyl.Shape();
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  BRepAlgoAPI_Fuse fuse(sol, sh);
-//#else
-//  BRepAlgo_Fuse fuse(sol, sh);
-//#endif
-//
-//  sh = fuse.Shape();
-
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Fuse fuse(sol, sh)" <<"\n";
-    BRepAlgoAPI_Fuse fuse(sol, sh);
-    sh = fuse.Shape();
-  } else {
-    di << "BRepAlgo_Fuse fuse(sol, sh)" <<"\n";
-    BRepAlgo_Fuse fuse(sol, sh);
-    sh = fuse.Shape();
-  }
-
-  Handle(AIS_Shape) res = new AIS_Shape(sh);
-  myContext->Display( res );
-  return 0;
-}
-
-void QABUC::Commands(Draw_Interpretor& theCommands) {
-  const char *group = "QABUC";
-
-  theCommands.Add("BUC60623","BUC60623 result Shape1 Shape2",__FILE__,BUC60623,group);
-  theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group);
-  theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group);
-  theCommands.Add("BUC60609","BUC60609 shape [name] [interactive (0|1)]",__FILE__,BUC60609,group);
-#if ! defined(WNT)
-  theCommands.Add("UKI61075","UKI61075",__FILE__,UKI61075,group);
-#endif
-  theCommands.Add("BUC60585",St,__FILE__,BUC60585,group);
-  theCommands.Add("BUC60547","BUC60547 name",__FILE__,BUC60547,group);
-  theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group);
-  theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group);
-  theCommands.Add("ksection","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
-  theCommands.Add("BUC60682","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
-  theCommands.Add("BUC60669","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
-  theCommands.Add("PRO19626","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
-  theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
-
-  theCommands.Add("BUC60698","BUC60698 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60698,group);
-
-  theCommands.Add("BUC60699","BUC60699 ",__FILE__,BUC60699,group);
-  theCommands.Add("GER61394","GER61394 [1/0]",__FILE__,GER61394,group);
-  theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
-  theCommands.Add("setcolor","setcolor name/object name/r g b/object r g b",__FILE__,setcolor,group);
-
-  theCommands.Add("BUC60726","BUC60726 0/1",__FILE__,BUC60726,group);
-  theCommands.Add("BUC60729","BUC60729",__FILE__,BUC60729,group);
-  theCommands.Add("BUC60724","BUC60724",__FILE__,BUC60724,group);
-  theCommands.Add("BUC60727","BUC60727",__FILE__,BUC60727,group);
-  theCommands.Add("BUC60792","BUC60792",__FILE__,BUC60792,group);
-  theCommands.Add("BUC60811","BUC60811",__FILE__,BUC60811,group);
-
-  theCommands.Add("BUC60825","BUC60825",__FILE__,BUC60825,group);
-
-  theCommands.Add("OCC10006","OCC10006 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,OCC10006,group);
-
-  theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
-
-#if ! defined(WNT)
-  theCommands.Add("coordload","load coord from file",__FILE__,coordload);
-#endif
-
-  theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
-  theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);
-  theCommands.Add("BUC60876","BUC60876 shape",__FILE__,BUC60876_,group); 
-  theCommands.Add("BUC60773","BUC60773",__FILE__,BUC60773,group); 
-
-  theCommands.Add("TestCMD","TestCMD [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,TestCMD,group);
-
-  theCommands.Add("statface","statface face",__FILE__,statface,group);
-
-  theCommands.Add("BUC60841","BUC60841 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60841,group);
-
-  theCommands.Add("BUC60874","BUC60874",__FILE__,BUC60874,group);
-
-  theCommands.Add("BUC60817","BUC60817 D",__FILE__,BUC60817,group);
-  theCommands.Add("BUC60831_1","BUC60831_1 D",__FILE__,BUC60831_1,group);
-  theCommands.Add("BUC60831_2","BUC60831_2 D Label",__FILE__,BUC60831_2,group);
-  theCommands.Add("BUC60836","BUC60836 D",__FILE__,BUC60836,group);
-  theCommands.Add("BUC60847","BUC60847 D Shape",__FILE__,BUC60847,group);
-  theCommands.Add("BUC60862","BUC60862 D Shape",__FILE__,BUC60862,group);
-  theCommands.Add("BUC60867","BUC60867",__FILE__,BUC60867,group);
-  theCommands.Add("BUC60910","BUC60910 D",__FILE__,BUC60910,group);
-  theCommands.Add("BUC60925","BUC60925 D",__FILE__,BUC60925,group);
-  theCommands.Add("BUC60932","BUC60932 D",__FILE__,BUC60932,group);
-  theCommands.Add("AISWidth","AISWidth (DOC,entry,[width])",__FILE__,AISWidth,group);
-  theCommands.Add("BUC60921","BUC60921 Doc label brep_file",__FILE__,BUC60921,group);
-
-  theCommands.Add("BUC60951","BUC60951 file.igs [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60951_, group );
-
-}
diff --git a/src/QABUC/QABUC_CMPLRS.edl b/src/QABUC/QABUC_CMPLRS.edl
deleted file mode 100755 (executable)
index e3d8819..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
--- Created on: 2002-06-17
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-@ifnotdefined ( %QABUC_CMPLRS_EDL) then
-@set %QABUC_CMPLRS_EDL = "";
-
-  @uses "CSF.edl" ;
-
-  @string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE  %CMPLRS_CXX_Options ;
-
-
-@endif;
diff --git a/src/QABugs/FILES b/src/QABugs/FILES
new file mode 100644 (file)
index 0000000..b5b2391
--- /dev/null
@@ -0,0 +1,20 @@
+QABugs_1.cxx
+QABugs_2.cxx
+QABugs_3.cxx
+QABugs_4.cxx
+QABugs_5.cxx
+QABugs_6.cxx
+QABugs_7.cxx
+QABugs_8.cxx
+QABugs_9.cxx
+QABugs_10.cxx
+QABugs_11.cxx
+QABugs_12.cxx
+QABugs_13.cxx
+QABugs_14.cxx
+QABugs_15.cxx
+QABugs_16.cxx
+QABugs_17.cxx
+QABugs_18.cxx
+QABugs_19.cxx
+QABugs_CMPLRS.edl
diff --git a/src/QABugs/QABugs.cdl b/src/QABugs/QABugs.cdl
new file mode 100644 (file)
index 0000000..7902b3b
--- /dev/null
@@ -0,0 +1,55 @@
+-- Created on: 2012-03-23
+-- Created by: DBV
+-- Copyright (c) 2002-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+package QABugs
+uses
+    Draw,
+    TCollection, 
+    gp, 
+    PrsMgr, 
+    Prs3d,
+    Quantity,
+    SelectMgr,
+    AIS
+is 
+    class  MyText;
+    class  PresentableObject;
+    
+    Commands(DI : in out Interpretor from Draw);
+    Commands_1(DI : in out Interpretor from Draw);
+    Commands_2(DI : in out Interpretor from Draw);
+    Commands_3(DI : in out Interpretor from Draw);
+    Commands_4(DI : in out Interpretor from Draw);
+    Commands_5(DI : in out Interpretor from Draw);
+    Commands_6(DI : in out Interpretor from Draw);
+    Commands_7(DI : in out Interpretor from Draw);
+    Commands_8(DI : in out Interpretor from Draw);
+    Commands_9(DI : in out Interpretor from Draw);
+    Commands_10(DI : in out Interpretor from Draw);
+    Commands_11(DI : in out Interpretor from Draw);
+    Commands_12(DI : in out Interpretor from Draw);
+    Commands_13(DI : in out Interpretor from Draw);
+    Commands_14(DI : in out Interpretor from Draw);
+    Commands_15(DI : in out Interpretor from Draw);
+    Commands_16(DI : in out Interpretor from Draw);
+    Commands_17(DI : in out Interpretor from Draw);
+    Commands_18(DI : in out Interpretor from Draw);
+    Commands_19(DI : in out Interpretor from Draw);
+end;
\ No newline at end of file
diff --git a/src/QABugs/QABugs.cxx b/src/QABugs/QABugs.cxx
new file mode 100644 (file)
index 0000000..e6f3ec2
--- /dev/null
@@ -0,0 +1,45 @@
+// Created on: 2012-03-23
+// Created by: DBV
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <QABugs.hxx>
+
+void QABugs::Commands(Draw_Interpretor& theCommands) {
+  QABugs::Commands_1(theCommands);
+  QABugs::Commands_2(theCommands);
+  QABugs::Commands_3(theCommands);
+  QABugs::Commands_4(theCommands);
+  QABugs::Commands_5(theCommands);
+  QABugs::Commands_6(theCommands);
+  QABugs::Commands_7(theCommands);
+  QABugs::Commands_8(theCommands);
+  QABugs::Commands_9(theCommands);
+  QABugs::Commands_10(theCommands);
+  QABugs::Commands_11(theCommands);
+  QABugs::Commands_12(theCommands);
+  QABugs::Commands_13(theCommands);
+  QABugs::Commands_14(theCommands);
+  QABugs::Commands_15(theCommands);
+  QABugs::Commands_16(theCommands);
+  QABugs::Commands_17(theCommands);
+  QABugs::Commands_18(theCommands);
+  QABugs::Commands_19(theCommands);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_1.cxx b/src/QABugs/QABugs_1.cxx
new file mode 100644 (file)
index 0000000..586f977
--- /dev/null
@@ -0,0 +1,534 @@
+// Created on: 2002-05-21
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <TDocStd_Document.hxx>
+#include <TDocStd_Application.hxx>
+#include <DDocStd.hxx>
+#include <TDocStd_Owner.hxx>
+#include <TDF_Label.hxx>
+#include <DDF.hxx>
+#include <TPrsStd_AISViewer.hxx>
+#include <TPrsStd_AISPresentation.hxx>
+
+#include <Draw_Viewer.hxx>
+#include <Draw.hxx>
+
+#ifndef WNT
+extern Draw_Viewer dout;
+#else
+Standard_IMPORT Draw_Viewer dout;
+#endif
+
+#include <BRep_Builder.hxx>
+#include <BRepTools.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <TopoDS.hxx>
+
+#if ! defined(WNT)
+extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#else
+Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#endif
+
+static TColStd_MapOfInteger theactivatedmodes(8);
+
+#include <AIS_PlaneTrihedron.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Edge.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <GC_MakePlane.hxx>
+
+static Standard_Integer OCC328bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " shape mode" << "\n";
+    return 1;
+  }
+  
+  Standard_Integer ChoosingMode = -1;
+  if ( strcmp (argv [2], "VERTEX") == 0 ) {
+    ChoosingMode = 1;
+  }
+  if ( strcmp (argv [2], "EDGE") == 0 ) {
+    ChoosingMode = 2;
+  }
+  if ( strcmp (argv [2], "WIRE") == 0 ) {
+    ChoosingMode = 3;
+  }
+  if ( strcmp (argv [2], "FACE") == 0 ) {
+    ChoosingMode = 4;
+  }
+  if ( strcmp (argv [2], "SHELL") == 0 ) {
+    ChoosingMode = 5;
+  }
+  if ( strcmp (argv [2], "SOLID") == 0 ) {
+    ChoosingMode = 6;
+  }
+  if ( strcmp (argv [2], "COMPOUND") == 0 ) {
+    ChoosingMode = 7;
+  }
+  if ( ChoosingMode == -1 ) {
+    di << "ERROR : " << argv[1] << " : vrong value of a mode" << "\n";
+    return 1;
+  }
+
+  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
+
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  
+  TCollection_AsciiString aName(argv[1]);
+  Handle(AIS_InteractiveObject) AISObj;
+  
+  if(!aMap.IsBound2(aName)) {
+    di << "Use 'vdisplay' before" << "\n";
+    return 1;
+  } else {
+    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
+    if(AISObj.IsNull()){
+      di << argv[1] << " : No interactive object" << "\n";
+      return 1;
+    } 
+
+    if (!aContext->HasOpenedContext()) {
+      aContext->OpenLocalContext();
+    }
+
+    if(!theactivatedmodes.Contains(ChoosingMode)) {
+      aContext->ActivateStandardMode(AIS_Shape::SelectionType(ChoosingMode));
+      theactivatedmodes.Add(ChoosingMode);
+    }
+    aContext->Erase(AISObj, updateviewer, PutInCollector);
+    aContext->UpdateCurrentViewer();
+
+    aContext->Display(AISObj, updateviewer);
+    aContext->UpdateCurrentViewer();
+
+    const TColStd_ListOfInteger& aList = aContext->ActivatedStandardModes();
+    Standard_Integer SelectMode;
+    TCollection_AsciiString SelectModeString;
+    TColStd_ListIteratorOfListOfInteger itr(aList);
+    for (; itr.More(); itr.Next()) {
+      SelectMode = itr.Value();
+      //cout << "SelectMode = " << SelectMode << endl;
+
+      switch (SelectMode)
+       {
+       case 1:
+         SelectModeString.Copy("VERTEX");
+         break;
+       case 2:
+         SelectModeString.Copy("EDGE");
+         break;
+       case 3:
+         SelectModeString.Copy("WIRE");
+         break;
+       case 4:
+         SelectModeString.Copy("FACE");
+         break;
+       case 5:
+         SelectModeString.Copy("SHELL");
+         break;
+       case 6:
+         SelectModeString.Copy("SOLID");
+         break;
+       case 7:
+         SelectModeString.Copy("COMPOUND");
+         break;
+       default:
+         SelectModeString.Copy("UNKNOWN");
+       }
+      di << "SelectMode = " << SelectModeString.ToCString() << "\n";
+
+    }
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC159bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 2) {
+    di << "ERROR : Usage : " << argv[0] << " Doc" << "\n";
+    return 1;
+  }
+  
+  Handle(TDocStd_Document) D;    
+  if (!DDocStd::GetDocument(argv[1],D)) return 1; 
+
+  Standard_Integer DocRefCount1 = D->GetRefCount();
+  di << "DocRefCount1 = " << DocRefCount1 << "\n";
+
+  Handle(TDocStd_Owner) Owner;
+  if (!D->Main().Root().FindAttribute(TDocStd_Owner::GetID(),Owner)) return 1; 
+
+  Handle(TDocStd_Document) OwnerD1 = Owner->GetDocument();    
+  if (OwnerD1.IsNull()) {
+    di << "DocOwner1 = NULL" << "\n";
+  } else {
+    di << "DocOwner1 = NOTNULL" << "\n";
+  }
+  Handle(TDocStd_Application) A;
+  if (!DDocStd::Find(A)) return 1;
+  A->Close(D); 
+
+  Handle(Draw_Drawable3D) DD = Draw::Get(argv[1],Standard_False);
+  dout.RemoveDrawable (DD);
+
+  Handle(TDocStd_Document) OwnerD2 = Owner->GetDocument();    
+  if (OwnerD2.IsNull()) {
+    di << "DocOwner2 = NULL" << "\n";
+  } else {
+    di << "DocOwner2 = NOTNULL" << "\n";
+  }
+
+  Standard_Integer DocRefCount2 = D->GetRefCount();
+  di << "DocRefCount2 = " << DocRefCount2 << "\n";
+
+  return 0;
+}
+
+static Standard_Integer OCC145bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " Shape MaxNbr" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString aFileName = argv[1];
+  Standard_Integer aMaxNbr = atoi(argv[2]);
+
+  BRep_Builder aBld;
+  TopoDS_Shape aShape;
+
+  if (!BRepTools::Read(aShape, aFileName.ToCString(), aBld)) {
+    di << "ERROR :Could not read a shape!!!" << "\n";
+    return 1;
+  }
+
+  Standard_Integer i;
+  TopoDS_Wire      aWire   = TopoDS::Wire(aShape);
+  
+  for (i = 1; i <= aMaxNbr; i++) {
+    BRepBuilderAPI_MakeFace aMF(aWire);
+    if (!aMF.IsDone()) {
+      di << "ERROR : Could not make a face" << "\n";
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC73_SelectionMode (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc < 3) {
+    di << "ERROR : Usage : " << argv[0] << " DOC entry [SelectionMode]" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) D;
+  //cout << "OCC73_SelectionMode  1" << endl;
+  if (!DDocStd::GetDocument(argv[1],D)) return 1;  
+  TDF_Label L;
+  //cout << "OCC73_SelectionMode  2" << endl;
+  if (!DDF::FindLabel(D->GetData(),argv[2],L)) return 1;  
+
+  Handle(TPrsStd_AISViewer) viewer;
+  //cout << "OCC73_SelectionMode  3" << endl;
+  if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+  Handle(TPrsStd_AISPresentation) prs;
+  //cout << "OCC73_SelectionMode  4" << endl;
+  if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+    if( argc == 4 ) {
+      prs->SetSelectionMode((Standard_Integer)atoi(argv[3]));
+      TPrsStd_AISViewer::Update(L);
+    }
+    else {
+      Standard_Integer SelectionMode = prs->SelectionMode();
+      //cout << "SelectionMode = " << SelectionMode << endl;
+      di<<SelectionMode;
+    }
+  }
+  //cout << "OCC73_SelectionMode  5" << endl;
+
+  return 0;
+}
+
+static Standard_Integer OCC10bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  if(argc != 4) {
+    di << "Usage : " << argv[0] << " name plane Length" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape S = DBRep::Get( argv[2] );
+  if ( S.IsNull() ) {
+    di << "Shape is empty" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString name(argv[1]);
+  Standard_Real Length = atof(argv[3]);
+  
+  // Construction de l'AIS_PlaneTrihedron
+  Handle(AIS_PlaneTrihedron) theAISPlaneTri;
+
+  Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
+  if (IsBound) {
+    // on recupere la shape dans la map des objets displayes
+    Handle(AIS_InteractiveObject) aShape = 
+      Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+      
+    // On verifie que l'AIS InteraciveObject est bien 
+    // un AIS_PlaneTrihedron
+    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
+      // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
+      theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape;
+
+      theAISPlaneTri->SetLength(Length);
+  
+      aContext->Redisplay(theAISPlaneTri, Standard_False);
+      aContext->UpdateCurrentViewer();
+    }
+  } else {
+    TopoDS_Face  FaceB=TopoDS::Face(S);
+  
+    // Construction du Plane
+    // recuperation des edges des faces.
+    TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
+  
+    TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
+    // declarations 
+    gp_Pnt A,B,C;
+  
+    // si il y a plusieurs edges
+    if (FaceExpB.More() ) {
+      FaceExpB.Next();
+      TopoDS_Edge EdgeC=TopoDS::Edge(FaceExpB.Current() );
+      BRepAdaptor_Curve theCurveB(EdgeB);
+      BRepAdaptor_Curve theCurveC(EdgeC);
+      A=theCurveC.Value(0.1);
+      B=theCurveC.Value(0.9);
+      C=theCurveB.Value(0.5);
+    }
+    else {
+      // FaceB a 1 unique edge courbe
+      BRepAdaptor_Curve theCurveB(EdgeB);
+      A=theCurveB.Value(0.1);
+      B=theCurveB.Value(0.9);
+      C=theCurveB.Value(0.5);
+    }
+    // Construction du Geom_Plane
+    GC_MakePlane MkPlane(A,B,C);
+    Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
+    
+    // on le display & bind
+    theAISPlaneTri= new AIS_PlaneTrihedron(theGeomPlane );
+    
+    theAISPlaneTri->SetLength(Length);
+    
+    GetMapOfAIS().Bind ( theAISPlaneTri, name);
+    aContext->Display(theAISPlaneTri );
+  }
+
+  Standard_Real getLength = theAISPlaneTri->GetLength();
+  di << "Length = " << Length << "\n";
+  di << "getLength = " << getLength << "\n";
+
+  if (getLength == Length) {
+    di << "OCC10: OK" << "\n";
+  } else {
+    di << "OCC10: ERROR" << "\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC74bug_set (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " shape mode; set selection mode" << "\n";
+    return 1;
+  }
+  
+  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
+
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  
+  TCollection_AsciiString aName(argv[1]);
+  Handle(AIS_InteractiveObject) AISObj;
+
+  Standard_Integer SelectMode = atoi(argv[2]);
+  
+  if(!aMap.IsBound2(aName)) {
+    di << "Use 'vdisplay' before" << "\n";
+    return 1;
+  } else {
+    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
+    if(AISObj.IsNull()){
+      di << argv[1] << " : No interactive object" << "\n";
+      return 1;
+    } 
+    AISObj->SetSelectionMode(SelectMode);
+    if (!aContext->HasOpenedContext()) {
+      aContext->OpenLocalContext();
+    }
+    aContext->Erase(AISObj, updateviewer, PutInCollector);
+    aContext->UpdateCurrentViewer();
+    aContext->Display(AISObj, updateviewer);
+    aContext->UpdateCurrentViewer();
+  }
+  return 0;
+}
+
+static Standard_Integer OCC74bug_get (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+
+  if ( argc != 2) {
+    di << "ERROR : Usage : " << argv[0] << " shape; get selection mode" << "\n";
+    return 1;
+  }
+  
+  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
+
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  
+  TCollection_AsciiString aName(argv[1]);
+  Handle(AIS_InteractiveObject) AISObj;
+
+  if(!aMap.IsBound2(aName)) {
+    di << "Use 'vdisplay' before" << "\n";
+    return 1;
+  } else {
+    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
+    if(AISObj.IsNull()){
+      di << argv[1] << " : No interactive object" << "\n";
+      return 1;
+    } 
+    Standard_Integer SelectMode = AISObj->SelectionMode();
+    di << SelectMode << "\n";
+  }
+
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <TDF_Data.hxx>
+#include <TNaming_Builder.hxx>
+#include <TNaming_NamedShape.hxx>
+
+static Standard_Integer OCC361bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  if ( nb != 2) {
+    di << "ERROR : Usage : " << a[0] << " Doc" << "\n";
+    di << "-1" << "\n";
+    return -1;
+  }
+
+  Handle(TDocStd_Document) D;    
+  if (!DDocStd::GetDocument(a[1],D)) {
+    di << "-2" << "\n";
+    return 1;  
+  }
+
+  BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
+  TopoDS_Shape aTBox = aBox.Shape();
+  aTBox.Orientation(TopAbs_FORWARD);
+
+  TDF_Label aTestLabel = D->GetData()->Root();
+  
+  TNaming_Builder aBuilder(aTestLabel);
+  aBuilder.Generated(aTBox);
+    
+  TopoDS_Shape aTBox1 = aTBox;
+  aTBox1.Orientation(TopAbs_REVERSED);
+  aTestLabel.ForgetAllAttributes();
+  aBuilder.Generated( aTBox1);
+
+  aTBox = aBuilder.NamedShape()->Get();
+  if(aTBox.Orientation() != TopAbs_REVERSED) {
+    di << "1" << "\n";
+  } else {
+    di << "0" << "\n";
+  }
+  return 0;
+}
+
+void QABugs::Commands_1(Draw_Interpretor& theCommands) {
+  const char *group = "QABugs";
+
+  theCommands.Add ("OCC328", "OCC328 shape mode", __FILE__, OCC328bug, group);
+
+  theCommands.Add ("OCC159", "OCC159 Doc", __FILE__, OCC159bug, group);
+  theCommands.Add ("OCC145", "OCC145 Shape MaxNbr", __FILE__, OCC145bug, group);
+
+  theCommands.Add ("OCC73_SelectionMode", "OCC73_SelectionMode DOC entry [SelectionMode]", __FILE__, OCC73_SelectionMode, group);
+
+  theCommands.Add ("OCC10", "OCC10 Shape MaxNbr", __FILE__, OCC10bug, group);
+
+  theCommands.Add ("OCC74_set", "OCC74_set shape mode;   set selection mode", __FILE__, OCC74bug_set, group);
+  theCommands.Add ("OCC74_get", "OCC74_get shape;   get selection mode", __FILE__, OCC74bug_get, group);
+
+  theCommands.Add("OCC361", "OCC361 Doc ", __FILE__, OCC361bug, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_10.cxx b/src/QABugs/QABugs_10.cxx
new file mode 100644 (file)
index 0000000..b0ab73f
--- /dev/null
@@ -0,0 +1,1189 @@
+// Created on: 2002-05-28
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <BRepBuilderAPI_MakePolygon.hxx>
+#include <TopoDS_Face.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Ax1.hxx>
+#include <BRepPrimAPI_MakeRevol.hxx>
+
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgo_Fuse.hxx>
+
+#include <GProp_GProps.hxx>
+#include <BRepGProp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+#include <BRep_Tool.hxx>
+#include <Poly_Triangulation.hxx>
+#include <TopExp.hxx>
+#include <ChFi3d_FilletShape.hxx>
+#include <BRepFilletAPI_MakeFillet.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+static Standard_Integer OCC426 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc < 7 || argc > 8) {
+    di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 8) {
+    Standard_Integer IsB = atoi(argv[7]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  BRepBuilderAPI_MakePolygon W1;
+  W1.Add(gp_Pnt(10, 0, 0));
+  W1.Add(gp_Pnt(20, 0, 0));
+  W1.Add(gp_Pnt(20, 0, 10));
+  W1.Add(gp_Pnt(10, 0, 10));
+  W1.Add(gp_Pnt(10, 0, 0));
+
+  Standard_Boolean OnlyPlane1 = Standard_False;
+  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), OnlyPlane1);
+
+  gp_Pnt P1(0, 0, 0);
+  gp_Dir D1(0, 0, 30);
+  gp_Ax1 A1(P1,D1);
+  Standard_Real angle1 = 360 * (M_PI / 180.0);
+  TopoDS_Shape rs1 = BRepPrimAPI_MakeRevol(F1, A1, angle1);
+
+  BRepBuilderAPI_MakePolygon W2;
+  Standard_Real f1 =  7.0710678118654752440;
+  Standard_Real f2 = 14.1421356237309504880;
+  W2.Add(gp_Pnt(f1, f1, 10));
+  W2.Add(gp_Pnt(f2, f2, 10));
+  W2.Add(gp_Pnt(f2, f2, 20));
+  W2.Add(gp_Pnt(f1, f1, 20));
+  W2.Add(gp_Pnt(f1, f1, 10));
+
+  Standard_Boolean OnlyPlane2 = Standard_False;
+  TopoDS_Face F2 = BRepBuilderAPI_MakeFace(W2.Wire(), OnlyPlane2);
+
+  gp_Pnt P2(0, 0, 0);
+  gp_Dir D2(0, 0, 30);
+  gp_Ax1 A2(P2,D2);
+  Standard_Real angle2 = 270 * (M_PI / 180.0);
+  TopoDS_Shape rs2 = BRepPrimAPI_MakeRevol(F2, A2, angle2);
+
+  BRepBuilderAPI_MakePolygon W3;
+  W3.Add(gp_Pnt(10, 0, 20));
+  W3.Add(gp_Pnt(20, 0, 20));
+  W3.Add(gp_Pnt(20, 0, 30));
+  W3.Add(gp_Pnt(10, 0, 30));
+  W3.Add(gp_Pnt(10, 0, 20));
+
+  Standard_Boolean OnlyPlane3 = Standard_False;
+  TopoDS_Face F3 = BRepBuilderAPI_MakeFace(W3.Wire(), OnlyPlane3);
+
+  gp_Pnt P3(0, 0, 0);
+  gp_Dir D3(0, 0, 30);
+  gp_Ax1 A3(P3,D3);
+  Standard_Real angle3 = 360 * (M_PI / 180.0);
+  TopoDS_Shape rs3 = BRepPrimAPI_MakeRevol(F3, A3, angle3);
+
+  TopoDS_Shape fuse32, fuse321;
+  if (IsBRepAlgoAPI) {
+    di << "fuse32 = BRepAlgoAPI_Fuse(rs3, rs2)" <<"\n";
+    di << "fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1)" <<"\n";
+    fuse32 = BRepAlgoAPI_Fuse(rs3, rs2);
+    fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1);
+  } else {
+    di << "fuse32 = BRepAlgo_Fuse(rs3, rs2)" <<"\n";
+    di << "fuse321 = BRepAlgo_Fuse(fuse32, rs1)" <<"\n";
+    fuse32 = BRepAlgo_Fuse(rs3, rs2);
+    fuse321 = BRepAlgo_Fuse(fuse32, rs1);
+  }
+
+  //Give the mass claculation of the shpae "fuse321"
+  GProp_GProps G;
+  BRepGProp::VolumeProperties(fuse321, G);
+  di<<" "<<"\n";
+  di<<"Mass: "<<G.Mass()<<"\n"<<"\n";
+
+  di << "Trianglating Faces ....." <<"\n";
+  TopExp_Explorer ExpFace;
+
+  for (ExpFace.Init (fuse321,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
+    {
+      TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
+      TopologicalFace.Orientation (TopAbs_FORWARD) ;
+      BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
+      TopLoc_Location loc;
+      Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(TopologicalFace, loc);
+      if (facing.IsNull())
+       {
+         di << "Triangulation FAILED for this face" << "\n";
+         continue;
+       }
+      di << "No of Triangles = " << facing->NbTriangles() << "\n";
+    }
+  di<<"Triangulation of all Faces Completed. "<< "\n" << "\n";
+
+  TopTools_IndexedDataMapOfShapeListOfShape edgemap;
+  TopExp::MapShapesAndAncestors(fuse321, TopAbs_EDGE, TopAbs_SOLID, edgemap);
+  di << "No. of Edges: " << edgemap.Extent() << "\n";
+  ChFi3d_FilletShape FShape = ChFi3d_Rational;
+  BRepFilletAPI_MakeFillet blend(fuse321,FShape);
+  di << "Adding Edges ..... " << "\n";
+  for(int i = 1; i <= edgemap.Extent(); i++)
+    {
+      // cout << "Adding Edge : " << i << endl;
+      TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
+      if(!edg.IsNull()) blend.Add(1, edg);
+    }
+  di << "All Edges added !  Now Building the Blend ... " << "\n";
+  di<<" "<<"\n";
+  blend.Build();
+
+  //DBRep::Set ( argv[1], fuse321 );
+  DBRep::Set ( argv[1], blend );
+  DBRep::Set ( argv[2], rs1 );
+  DBRep::Set ( argv[3], rs2 );
+  DBRep::Set ( argv[4], rs3 );
+  DBRep::Set ( argv[5], fuse32 );
+  DBRep::Set ( argv[6], fuse321 );
+
+  return 0;
+}
+
+#include <Geom_SurfaceOfRevolution.hxx>
+//=======================================================================
+//function : isPeriodic
+//purpose  :
+//=======================================================================
+static Standard_Integer isPeriodic(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+    {
+    OCC_CATCH_SIGNALS
+      // 1. Verify amount of arguments of the command
+      if (argc < 2) { di << "isperiodic FAULTY. Use : isperiodic surfaceOfRevolution"; return 0;}
+      // 2. Retrieve surface
+      Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
+      if(aSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface"; return 0;}
+      Handle(Geom_SurfaceOfRevolution) aRevolSurf = Handle(Geom_SurfaceOfRevolution)::DownCast(aSurf);
+      if(aRevolSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface of revolution"; return 0;}
+      // 3. Verify whether entry surface is u-periodic and v-periodic
+      if(aRevolSurf->IsUPeriodic()) {di << "Surface is u-periodic \n";} else {di << "Surface is not u-periodic \n";}
+      if(aRevolSurf->IsVPeriodic()) {di << "Surface is v-periodic \n";} else {di << "Surface is not v-periodic \n";}
+    }
+  catch (Standard_Failure) {di << "isperiodic Exception \n" ;return 0;}
+
+  return 0;
+}
+
+#include <Precision.hxx>
+#include <Extrema_ExtPS.hxx>
+#include <GeomAdaptor_Surface.hxx>
+//=======================================================================
+//function : OCC486
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC486(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (argc < 2) { di << "OCC486 FAULTY. Use : OCC486 surf x y z du dv"; return 1;}
+      
+      Standard_Real du = 0;
+      Standard_Real dv = 0;
+
+      Handle(Geom_Surface) GS;
+      GS = DrawTrSurf::GetSurface(argv[1]);
+      if (GS.IsNull()) { di << "OCC486 FAULTY. Null surface /n";return 1;}
+      gp_Pnt P3D( atof(argv[2]),atof(argv[3]),atof(argv[4]) );
+
+      Standard_Real Tol = Precision::PConfusion();
+      Extrema_ExtPS myExtPS;
+      if (argc > 5) du = atof(argv[5]);
+      if (argc > 6) dv = atof(argv[6]);
+
+      Standard_Real uf, ul, vf, vl;
+      GS->Bounds(uf, ul, vf, vl);
+
+      GeomAdaptor_Surface aSurf(GS);
+      myExtPS.Initialize (aSurf, uf-du, ul+du, vf-dv, vl+dv, Tol, Tol );
+      myExtPS.Perform ( P3D );
+      Standard_Integer nPSurf = ( myExtPS.IsDone() ? myExtPS.NbExt() : 0 );
+
+      if ( nPSurf > 0 )
+       {
+
+         //Standard_Real distMin = myExtPS.Value ( 1 );
+         Standard_Real distMin = myExtPS.SquareDistance ( 1 );
+         Standard_Integer indMin=1;
+         for (Standard_Integer sol = 2; sol <= nPSurf ; sol++)
+           {
+             //Standard_Real dist = myExtPS.Value(sol);
+             Standard_Real dist = myExtPS.SquareDistance(sol);
+             if ( distMin > dist )
+               {
+                 distMin = dist;
+                 indMin = sol;
+               }
+           }
+//
+         distMin = sqrt(distMin);
+         Standard_Real S, T;
+         myExtPS.Point(indMin).Parameter ( S, T );
+         gp_Pnt aCheckPnt = aSurf.Value( S, T );
+         Standard_Real aCheckDist = P3D.Distance(aCheckPnt);
+         di << "Solution is : U = "<< S << "\t V = "<< T << "\n";
+         di << "Solution is : X = "<< aCheckPnt.X() << "\t Y = "<< aCheckPnt.Y() << "\t Z = "<< aCheckPnt.Z() << "\n";
+         di << "ExtremaDistance = " << distMin  << "\n";
+         di << "CheckDistance = " << aCheckDist << "\n";
+
+         if(fabs(distMin - aCheckDist) < Precision::Confusion()) return 0;
+         else return 1;
+       }
+      else return 1;
+    }
+  catch (Standard_Failure) {di << "OCC486 Exception \n" ;return 1;}
+  
+  return 0;
+}
+
+#include <GC_MakeArcOfCircle.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <Geom_Plane.hxx>
+#include <gp_Pln.hxx>
+#include <BRepPrimAPI_MakePrism.hxx>
+#include <BRepOffsetAPI_DraftAngle.hxx>
+//=======================================================================
+//function : OCC712
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC712 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if (argc != 3) {
+    di << "Usage : " << argv[0] << " draftAngle slabThick" << "\n";
+    return 1;
+  }
+  //NOTE: Case:1 - draftAngle = 15, slabThick = 30 --> Fails
+  //      Case:2   draftAngle = 10, slabThick = 30 --> Ok
+  //      Case:3   draftAngle = 10, slabThick = 40 --> Ok
+  //
+  //      --------------------------------------------------
+  Standard_Real draftAngle = atof(argv[1]);
+  Standard_Real slabThick = atof(argv[2]);
+
+  Standard_Real f1 = 75;
+  Standard_Real f2 = 35;
+
+  gp_Pnt p1(-f2,  f2, 0);
+  gp_Pnt p2(  0,  f1, 0);
+  gp_Pnt p3( f2,  f2, 0);
+  gp_Pnt p4( f1,   0, 0);
+  gp_Pnt p5( f2, -f2, 0);
+  gp_Pnt p6(  0, -f1, 0);
+  gp_Pnt p7(-f2, -f2, 0);
+  gp_Pnt p8(-f1,   0, 0);
+
+  GC_MakeArcOfCircle arc1(p1, p2, p3);
+  GC_MakeArcOfCircle arc2(p3, p4, p5);
+  GC_MakeArcOfCircle arc3(p5, p6, p7);
+  GC_MakeArcOfCircle arc4(p7, p8, p1);
+
+  TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
+  TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
+  TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
+  TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(arc4.Value());
+
+  BRepBuilderAPI_MakeWire MW;
+  MW.Add(e1);
+  MW.Add(e2);
+  MW.Add(e3);
+  MW.Add(e4);
+
+  if (!MW.IsDone())
+    {
+      di << "my Wire not done" << "\n";
+      return 1;
+    }
+  TopoDS_Wire W = MW.Wire();
+
+  TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
+  if ( F.IsNull())
+    {
+      di << " Error in Face creation " << "\n";
+      return 1;
+    }
+
+  Handle(Geom_Surface) surf = BRep_Tool::Surface(F);
+  Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(surf);
+  gp_Pln slabPln = P->Pln();
+
+  try
+    {
+    OCC_CATCH_SIGNALS
+      gp_Dir slabDir(0, 0, 1);
+      gp_Vec slabVect(slabDir);
+      slabVect *= slabThick;
+
+      BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
+      if ( ! slab.IsDone() )
+        {
+         di << " Error in Slab creation " << "\n";
+         return 1;
+        }
+
+      TopoDS_Shape slabShape = slab.Shape();
+      if (fabs(draftAngle) > 0.01)
+        {
+         Standard_Real angle = draftAngle*(M_PI / 180.0);
+         BRepOffsetAPI_DraftAngle draftSlab(slabShape);
+
+         TopoDS_Shape fShape = slab.FirstShape();
+         TopoDS_Shape lShape = slab.LastShape();
+
+         TopExp_Explorer ex;
+         for(ex.Init(slabShape, TopAbs_FACE); ex.More(); ex.Next())
+            {
+             TopoDS_Face aFace = TopoDS::Face(ex.Current());
+             if(aFace.IsSame(fShape) || aFace.IsSame(lShape)) continue;
+             draftSlab.Add(aFace, slabDir, angle, slabPln);
+             if (!draftSlab.AddDone())
+                {
+                 di << " Error in Add " << "\n";
+                 return 1;
+                }
+            }
+
+         di << "All Faces added. Building... " << "\n"; //cout.flush();
+         draftSlab.Build();
+         di << "Build done..." << "\n"; //cout.flush();
+         if (!draftSlab.IsDone())  //--------------> STEP:1
+            {
+             di << " Error in Build " << "\n";
+             return 1;
+            }
+         slabShape = draftSlab.Shape();
+         DBRep::Set(argv[1], slabShape);
+        }
+    }
+  catch ( Standard_Failure ) //--------------------> STEP:2
+    {
+      di << " Error in Draft Slab " << "\n";
+      return 1;
+    }
+  return 0;
+}
+
+//=======================================================================
+//  performTriangulation
+//=======================================================================
+
+Standard_Integer performTriangulation (TopoDS_Shape aShape, Draw_Interpretor& di)
+{
+  int failed=0, total=0;
+  TopExp_Explorer ExpFace;
+  Handle(Poly_Triangulation) facing;
+
+  for (ExpFace.Init(aShape,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
+    {
+      total++;
+      TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
+      TopologicalFace.Orientation (TopAbs_FORWARD) ;
+      BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
+      TopLoc_Location loc;
+      facing = BRep_Tool::Triangulation(TopologicalFace, loc);
+      di << "Face " << total << " - ";
+      if (facing.IsNull())
+        {
+         failed++;
+         di << "******************** FAILED during Triangulation " << "\n";
+        }
+      else
+        {
+         di << facing->NbTriangles() << " Triangles" <<"\n";
+        }
+    }
+  di<<"Triangulation of all Faces Completed: "<<"\n"<<"\n";
+  if (failed == 0) return 1;
+  di<<"***************************************************"<<"\n";
+  di<<"*******                                    ********"<<"\n";
+  di<<"***** Triangulation FAILED for " << failed << " of " << total << " Faces ******"<<"\n";
+  di<<"*******                                    ********"<<"\n";
+  di<<"***************************************************"<<"\n";
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepPrimAPI_MakeCone.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgo_Cut.hxx>
+//=======================================================================
+//function : OCC822_1
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC822_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+#if ! defined(BRepAlgo_def02)
+//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  int index = 1;
+
+  gp_Pnt P1(0, 0, 0);
+  gp_Dir D1(0, 0, 1);
+  gp_Ax2 A1(P1,D1);
+
+  BRepPrimAPI_MakeCylinder cylMakerIn(A1, 40, 110);
+  BRepPrimAPI_MakeCylinder cylMakerOut(A1, 50, 100);
+  TopoDS_Shape cylIn = cylMakerIn.Shape();
+  TopoDS_Shape cylOut = cylMakerOut.Shape();
+
+  gp_Pnt P2(0, 0, 0);
+  gp_Dir D2(0, 0, -1);
+  gp_Ax2 A2(P2,D2);
+
+  BRepPrimAPI_MakeCone conMakerIn(A2, 40, 60, 110);
+  BRepPrimAPI_MakeCone conMakerOut(A2, 50, 70, 100);
+  TopoDS_Shape conIn = conMakerIn.Shape();
+  TopoDS_Shape conOut = conMakerOut.Shape();
+
+  di << "All primitives created.....  Creating Boolean" << "\n";
+
+  TopoDS_Shape theIn, theOut, theRes;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "theIn = BRepAlgoAPI_Fuse(cylIn, conIn)" <<"\n";
+       di << "theOut = BRepAlgoAPI_Fuse(cylOut, conOut)" <<"\n";
+       di << "theRes = BRepAlgoAPI_Cut(theOut, theIn)" <<"\n";
+        theIn = BRepAlgoAPI_Fuse(cylIn, conIn);
+        theOut = BRepAlgoAPI_Fuse(cylOut, conOut);
+        theRes = BRepAlgoAPI_Cut(theOut, theIn);
+      } else {
+       di << "theIn = BRepAlgo_Fuse(cylIn, conIn)" <<"\n";
+       di << "theOut = BRepAlgo_Fuse(cylOut, conOut)" <<"\n";
+        theIn = BRepAlgo_Fuse(cylIn, conIn);
+        theOut = BRepAlgo_Fuse(cylOut, conOut);
+       di << "theRes = BRepAlgo_Cut(theOut, theIn)" <<"\n";
+        theRes = BRepAlgo_Cut(theOut, theIn);
+      }
+
+      if (index < argc) DBRep::Set(argv[index++], theIn);
+      if (index < argc) DBRep::Set(argv[index++], theOut);
+      if (index < argc) DBRep::Set(argv[index++], theRes);
+      di << "Booleans Created !    Triangulating !" <<"\n";
+
+      performTriangulation(theRes, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"***** Standard_Failure : Exception in Shoe Function *****"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"*********************************************************"<<"\n";
+      return 1;
+    }
+  return 0;
+
+}
+
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+//=======================================================================
+//  OCC822_2
+//=======================================================================
+
+static Standard_Integer OCC822_2 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  int index = 1;
+
+  gp_Dir xDir(1, 0, 0);
+  gp_Dir zDir(0, 0, 1);
+  gp_Pnt cen1(0, 0, 0);
+  gp_Ax2 cor1(cen1, zDir, xDir);
+  BRepPrimAPI_MakeBox boxMaker(cor1, 100, 100, 100);
+  TopoDS_Shape box = boxMaker.Shape();
+  if (index < argc) DBRep::Set(argv[index++], box);
+
+  BRepPrimAPI_MakeSphere sphereMaker(gp_Pnt(100.0, 50.0, 50.0), 25.0);
+  TopoDS_Shape sph = sphereMaker.Shape();
+  if (index < argc) DBRep::Set(argv[index++], sph);
+
+  di << "All primitives created.....  Creating Cut Objects" << "\n";
+
+  TopoDS_Shape fuse;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "fuse = BRepAlgoAPI_Fuse(box, sph)" <<"\n";
+       fuse = BRepAlgoAPI_Fuse(box, sph);
+      } else {
+       di << "fuse = BRepAlgo_Fuse(box, sph)" <<"\n";
+       fuse = BRepAlgo_Fuse(box, sph);
+      }
+      if (index < argc) DBRep::Set(argv[index++], fuse);
+      di << "Object Created !   Now Triangulating !" ;
+
+      performTriangulation(fuse, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"***** Standard_Failure : Exception in HSP Function ******"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"*********************************************************"<<"\n";
+      return 1;
+    }
+
+  return 0;
+}
+
+//=======================================================================
+//  OCC823
+//=======================================================================
+
+static Standard_Integer OCC823 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  int index = 1;
+  Standard_Real size = 0.001;
+
+  gp_Pnt P1(40, 50, 0);
+  gp_Dir D1(100, 0, 0);
+  gp_Ax2 A1(P1,D1);
+  BRepPrimAPI_MakeCylinder mkCyl1(A1, 20, 100);
+  TopoDS_Shape cyl1 = mkCyl1.Shape();
+  if (index < argc) DBRep::Set(argv[index++], cyl1);
+
+  gp_Pnt P2(100, 50, size);
+  gp_Dir D2(0, size, 80);
+  gp_Ax2 A2(P2,D2);
+  BRepPrimAPI_MakeCylinder mkCyl2(A2, 20, 80);
+  TopoDS_Shape cyl2 = mkCyl2.Shape();
+  if (index < argc) DBRep::Set(argv[index++], cyl2);
+
+  di << "All primitives created.....  Creating Boolean" << "\n";
+
+  TopoDS_Shape fuse;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "fuse = BRepAlgoAPI_Fuse(cyl2, cyl1)" <<"\n";
+       fuse = BRepAlgoAPI_Fuse(cyl2, cyl1);
+      } else {
+       di << "fuse = BRepAlgo_Fuse(cyl2, cyl1)" <<"\n";
+       fuse = BRepAlgo_Fuse(cyl2, cyl1);
+      }
+      if (index < argc) DBRep::Set(argv[index++], fuse);
+      di << "Fuse Created !    Triangulating !" <<"\n";
+
+      performTriangulation(fuse, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"***** Standard_Failure : Exception in TEE Function ******"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"*********************************************************"<<"\n";
+      return 1;
+    }
+  return 0;
+}
+
+//=======================================================================
+//  OCC824
+//=======================================================================
+
+static Standard_Integer OCC824 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  int index = 1;
+
+  gp_Pnt P1(100, 0, 0);
+  gp_Dir D1(-1, 0, 0);
+  gp_Ax2 A1(P1,D1);
+  BRepPrimAPI_MakeCylinder mkCyl(A1, 20, 100);
+  TopoDS_Shape cyl = mkCyl.Shape();
+  if (index < argc) DBRep::Set(argv[index++], cyl);
+
+  BRepPrimAPI_MakeSphere sphere(P1, 20.0);
+  TopoDS_Shape sph = sphere.Shape();
+  if (index < argc) DBRep::Set(argv[index++], sph);
+
+  di << "All primitives created.....  Creating Boolean" << "\n";
+
+  TopoDS_Shape fuse;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "fuse = BRepAlgoAPI_Fuse(cyl, sph)" <<"\n";
+       fuse = BRepAlgoAPI_Fuse(cyl, sph);
+      } else {
+       di << "fuse = BRepAlgo_Fuse(cyl, sph)" <<"\n";
+       fuse = BRepAlgo_Fuse(cyl, sph);
+      }
+      di << "Fuse Created !    Triangulating !" <<"\n";
+      if (index < argc) DBRep::Set(argv[index++], fuse);
+
+      performTriangulation(fuse, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"***** Standard_Failure : Exception in YOU Function ******"<<"\n";
+      di<<"*****                                              ******"<<"\n";
+      di<<"*********************************************************"<<"\n";
+      return 1;
+    }
+  return 0;
+}
+
+#include <TColgp_Array2OfPnt.hxx>
+#include <GeomConvert.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <BRepPrimAPI_MakeHalfSpace.hxx>
+
+//=======================================================================
+//  OCC825
+//=======================================================================
+
+static Standard_Integer OCC825 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 6 || argc > 7) {
+    di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 7) {
+    Standard_Integer IsB = atoi(argv[6]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def02)
+//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  int index = 1;
+
+  Standard_Real size = 50;
+  TColgp_Array2OfPnt poles(1, 2, 1, 2);
+
+  poles(1, 1).SetCoord(-size, 0, -size);
+  poles(1, 2).SetCoord(-size, 0,  size);
+  poles(2, 1).SetCoord( size, 0, -size);
+  poles(2, 2).SetCoord( size, 0,  size);
+
+  Handle(Geom_BezierSurface) BezSurf = new Geom_BezierSurface(poles);
+  Handle(Geom_BSplineSurface) BSpSurf = GeomConvert::SurfaceToBSplineSurface(BezSurf);
+  BRepBuilderAPI_MakeFace faceMaker(BSpSurf, Precision::Confusion());
+  TopoDS_Face face = faceMaker.Face();
+
+  gp_Pnt pnt(0, size, 0);
+  BRepPrimAPI_MakeHalfSpace *hSpace = new BRepPrimAPI_MakeHalfSpace(face,pnt);
+  TopoDS_Shape hsp = hSpace->Solid();
+  if (index < argc) DBRep::Set(argv[index++], hsp);
+
+  BRepPrimAPI_MakeSphere sphere1(gp_Pnt(0.0, 0.0, 0.0), 25.0);
+  TopoDS_Shape sph1 = sphere1.Shape();
+  if (index < argc) DBRep::Set(argv[index++], sph1);
+
+  BRepPrimAPI_MakeSphere sphere2(gp_Pnt(0.0, 0.00001, 0.0), 25.0);
+  TopoDS_Shape sph2 = sphere2.Shape();
+  if (index < argc) DBRep::Set(argv[index++], sph2);
+
+  di << "All primitives created.....  Creating Cut Objects" << "\n";
+
+  TopoDS_Shape cut1, cut2;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "cut1 = BRepAlgoAPI_Cut(sph1, hsp)" << "\n";
+       cut1 = BRepAlgoAPI_Cut(sph1, hsp);
+      } else {
+       di << "cut1 = BRepAlgo_Cut(sph1, hsp)" << "\n";
+       cut1 = BRepAlgo_Cut(sph1, hsp);
+      }
+      if (index < argc) DBRep::Set(argv[index++], cut1);
+      di << "CUT 1 Created !   " ;
+
+      if (IsBRepAlgoAPI) {
+       di << "cut2 = BRepAlgoAPI_Cut(sph2, hsp)" << "\n";
+       cut2 = BRepAlgoAPI_Cut(sph2, hsp);
+      } else {
+       di << "cut2 = BRepAlgo_Cut(sph2, hsp)" << "\n";
+       cut2 = BRepAlgo_Cut(sph2, hsp);
+      }
+      if (index < argc) DBRep::Set(argv[index++], cut2);
+      di << "CUT 2 Created !" << "\n" << "\n";
+
+      GProp_GProps G;
+      BRepGProp::VolumeProperties(cut1, G);
+      di<<"CUT 1 Mass = "<<G.Mass()<< "\n" << "\n";
+      BRepGProp::VolumeProperties(cut2, G);
+      di<<"CUT 2 Mass = "<<G.Mass()<< "\n" << "\n";
+
+      di << "Trianglating Faces of CUT 1 ....." << "\n";
+      performTriangulation(cut1, di);
+
+      di << "Trianglating Faces of CUT 2 ....." << "\n";
+      performTriangulation(cut2, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"***** Standard_Failure : Exception in HSP Function ******"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"*********************************************************"<< "\n";
+      return 1;
+    }
+
+  di<<"*************************************************************"<< "\n";
+  di<<" CUT 1 and CUT 2 gives entirely different results during"<< "\n";
+  di<<" mass computation and face triangulation, eventhough the"<< "\n";
+  di<<" two spheres are located more or less at the same position."<< "\n";
+  di<<"*************************************************************"<< "\n";
+
+  return 0;
+}
+
+//=======================================================================
+//  OCC826
+//=======================================================================
+
+static Standard_Integer OCC826 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  int index = 1;
+
+  Standard_Real x1 = 181.82808;
+  Standard_Real x2 = 202.39390;
+  Standard_Real y1 = 31.011970;
+  Standard_Real y2 = 123.06856;
+
+  BRepBuilderAPI_MakePolygon W1;
+  W1.Add(gp_Pnt(x1, y1, 0));
+  W1.Add(gp_Pnt(x2, y1, 0));
+  W1.Add(gp_Pnt(x2, y2, 0));
+  W1.Add(gp_Pnt(x1, y2, 0));
+  W1.Add(gp_Pnt(x1, y1, 0));
+
+  Standard_Boolean myFalse = Standard_False;
+  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
+
+  gp_Pnt P1(0, 0, 0);
+  gp_Dir D1(0, 30, 0);
+  gp_Ax1 A1(P1,D1);
+  Standard_Real angle1 = 360 * (M_PI / 180.0);
+  TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
+  if (index < argc) DBRep::Set(argv[index++], rev);
+
+  BRepPrimAPI_MakeSphere sphere(gp_Pnt(166.373, 77.0402, 96.0555), 23.218586);
+  TopoDS_Shape sph = sphere.Shape();
+  if (index < argc) DBRep::Set(argv[index++], sph);
+
+  di << "All primitives created.....  Creating Boolean" << "\n";
+
+  TopoDS_Shape fuse;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "fuse = BRepAlgoAPI_Fuse(rev, sph)" << "\n";
+       fuse = BRepAlgoAPI_Fuse(rev, sph);
+      } else {
+       di << "fuse = BRepAlgo_Fuse(rev, sph)" << "\n";
+       fuse = BRepAlgo_Fuse(rev, sph);
+      }
+      if (index < argc) DBRep::Set(argv[index++], fuse);
+      di << "Fuse Created !   Triangulating !" << "\n";
+      performTriangulation(fuse, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"***** Standard_Failure : Exception in SPH Function ******"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"*********************************************************"<< "\n";
+      return 1;
+    }
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeTorus.hxx>
+//=======================================================================
+//  OCC827
+//=======================================================================
+
+static Standard_Integer OCC827 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc < 6 || argc > 7) {
+    di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 7) {
+    Standard_Integer IsB = atoi(argv[6]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  int index = 1;
+
+  BRepBuilderAPI_MakePolygon W1;
+  W1.Add(gp_Pnt(10, 0, 0));
+  W1.Add(gp_Pnt(20, 0, 0));
+  W1.Add(gp_Pnt(20, 0, 50));
+  W1.Add(gp_Pnt(10, 0, 50));
+  W1.Add(gp_Pnt(10, 0, 0));
+
+  Standard_Boolean myFalse = Standard_False;
+  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
+
+  gp_Pnt P1(0, 0, 0);
+  gp_Dir D1(0, 0, 30);
+  gp_Ax1 A1(P1,D1);
+  Standard_Real angle1 = 360 * (M_PI / 180.0);
+  TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
+  if (index < argc) DBRep::Set(argv[index++], rev);
+
+  gp_Pnt P2(0, 0, 50);
+  gp_Dir D2(0, 0, 30);
+  gp_Ax2 A2(P2,D2);
+  Standard_Real majRad = 15;
+  Standard_Real minRad = 5;
+  BRepPrimAPI_MakeTorus Torus1(A2, majRad, minRad);
+  TopoDS_Shape tor1 = Torus1.Shape();
+  if (index < argc) DBRep::Set(argv[index++], tor1);
+
+  gp_Pnt P3(0, 0, 10);
+  gp_Dir D3(0, 0, 30);
+  gp_Ax2 A3(P3,D3);
+  BRepPrimAPI_MakeTorus Torus2(A3, majRad, minRad);
+  TopoDS_Shape tor2 = Torus2.Shape();
+  if (index < argc) DBRep::Set(argv[index++], tor2);
+
+  di << "All primitives created.....  Creating Boolean" << "\n";
+
+  TopoDS_Shape fuse1, fuse2;
+  try
+    {
+    OCC_CATCH_SIGNALS
+      if (IsBRepAlgoAPI) {
+       di << "Fuse1 = BRepAlgoAPI_Fuse(tor1, rev)" << "\n";
+       fuse1 = BRepAlgoAPI_Fuse(tor1, rev);
+      } else {
+       di << "Fuse1 = BRepAlgo_Fuse(tor1, rev)" << "\n";
+       fuse1 = BRepAlgo_Fuse(tor1, rev);
+      }
+      if (index < argc) DBRep::Set(argv[index++], fuse1);
+      di << "Fuse1 Created !    Creating Fuse 2" << "\n";
+      if (IsBRepAlgoAPI) {
+       di << "Fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1)" << "\n";
+       fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1);
+      } else {
+       di << "Fuse2 = BRepAlgo_Fuse(tor2, fuse1)" << "\n";
+       fuse2 = BRepAlgo_Fuse(tor2, fuse1);
+      }
+      if (index < argc) DBRep::Set(argv[index++], fuse2);
+      di << "Fuse2 Created !    Triangulating !" << "\n";
+
+      performTriangulation(fuse2, di);
+    }
+  catch ( Standard_Failure )
+    {
+      di<<"*********************************************************"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"***** Standard_Failure : Exception in REV Function ******"<< "\n";
+      di<<"*****                                              ******"<< "\n";
+      di<<"*********************************************************"<< "\n";
+      return 1;
+    }
+  return 0;
+}
+
+//=======================================================================
+//  performBlend
+//=======================================================================
+
+int performBlend (TopoDS_Shape aShape, Standard_Real rad, TopoDS_Shape& bShape, Draw_Interpretor& di)
+{
+  Standard_Integer status = 0;
+  TopoDS_Shape newShape;
+  TopTools_IndexedDataMapOfShapeListOfShape edgemap;
+  TopExp::MapShapesAndAncestors(aShape,TopAbs_EDGE,TopAbs_SOLID,edgemap);
+  di << "Blending All Edges: No. of Edges: " << edgemap.Extent() << "\n";
+  ChFi3d_FilletShape FShape = ChFi3d_Rational;
+  BRepFilletAPI_MakeFillet blend(aShape,FShape);
+  for(int i = 1; i <= edgemap.Extent(); i++)
+    {
+      TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
+      if(!edg.IsNull()) blend.Add(rad, edg);
+    }
+
+  try
+    {
+    OCC_CATCH_SIGNALS
+      blend.Build();
+      if(!blend.HasResult() || blend.Shape().IsNull()) {
+        status = 1;
+      }
+    }
+  catch ( Standard_Failure )
+    {
+      status = 1;
+    }
+  if(status) {
+      di<<"*******************************************************"<< "\n";
+      di<<"******                                          *******"<< "\n";
+      di<<"****** Blending Failed (Radius = " << rad << ") *******"<< "\n";
+      di<<"******                                          *******"<< "\n";
+      di<<"*******************************************************"<< "\n";
+      return 1;
+  } else {
+    di<<"Blending successfully performed on all Edges: "<< "\n" << "\n";
+  }
+  bShape = blend.Shape();
+  return 0;
+}
+
+#include <GC_MakeSegment.hxx>
+//=======================================================================
+//  OCC828
+//=======================================================================
+
+static Standard_Integer OCC828 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
+{
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " shape" << "\n";
+  }
+  int index = 1;
+
+  Standard_Real slabThick = 111;
+
+  gp_Pnt p11(-27.598139, -7.0408573, 0.0);
+  gp_Pnt p12(-28.483755, -17.487625, 0.0);
+  gp_Pnt p13(-19.555504, -22.983587, 0.0);
+  GC_MakeArcOfCircle arc1(p11, p12, p13);
+
+  gp_Pnt p21(12.125083, -22.983587, 0.0);
+  gp_Pnt p22(21.1572, -17.27554, 0.0);
+  gp_Pnt p23(19.878168, -6.6677585, 0.0);
+  GC_MakeArcOfCircle arc2(p21, p22, p23);
+
+  gp_Pnt p31(3.265825, 13.724955, 0.0);
+  gp_Pnt p32(-4.7233953, 17.406338, 0.0);
+  gp_Pnt p33(-12.529893, 13.351856, 0.0);
+  GC_MakeArcOfCircle arc3(p31, p32, p33);
+
+  GC_MakeSegment ln1(p13, p21);
+  GC_MakeSegment ln2(p23, p31);
+  GC_MakeSegment ln3(p33, p11);
+
+  TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
+  TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
+  TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
+
+  TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(ln1.Value());
+  TopoDS_Edge e5 = BRepBuilderAPI_MakeEdge(ln2.Value());
+  TopoDS_Edge e6 = BRepBuilderAPI_MakeEdge(ln3.Value());
+
+  BRepBuilderAPI_MakeWire MW;
+  MW.Add(e1);
+  MW.Add(e4);
+  MW.Add(e2);
+  MW.Add(e5);
+  MW.Add(e3);
+  MW.Add(e6);
+
+  if (!MW.IsDone())
+    {
+      di << "my Wire not done" << "\n";
+      return 1;
+    }
+
+  TopoDS_Wire W = MW.Wire();
+  TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
+  if ( F.IsNull())
+    {
+      di << " Error in Face creation " << "\n";
+      return 1;
+    }
+
+  try
+    {
+    OCC_CATCH_SIGNALS
+      gp_Dir slabDir(0, 0, 1);
+      gp_Vec slabVect(slabDir);
+      slabVect *= slabThick;
+
+      BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
+      if ( ! slab.IsDone() )
+        {
+         di << " Error in Slab creation " << "\n";
+         return 1;
+        }
+      if (index < argc) DBRep::Set(argv[index++], slab.Shape());
+
+//       cout << "Slab Successfully Created !   Now Blending ..." << endl;
+//       TopoDS_Shape aShape;
+//       int ret = performBlend(slab.Shape(), radius, aShape);
+//       if (ret) return 1;
+//       if (index < argc) DBRep::Set(argv[index++], aShape);
+
+//       cout << "Blending Successfully Done !   Now Triangulating ..." << endl;
+//       performTriangulation(aShape);
+    }
+  catch ( Standard_Failure )
+    {
+      di << " Error in Draft Slab " << "\n";
+      return 1;
+    }
+  return 0;
+}
+
+void QABugs::Commands_10(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC426", "OCC426 shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC426, group);
+
+  theCommands.Add("isperiodic", "Use : isperiodic surfaceOfRevolution", __FILE__, isPeriodic, group);
+  theCommands.Add("OCC486", "Use : OCC486 surf x y z du dv ", __FILE__, OCC486, group);
+  theCommands.Add("OCC712", "OCC712 draftAngle slabThick", __FILE__, OCC712, group);
+  theCommands.Add("OCC822_1", "OCC822_1 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_1, group);
+  theCommands.Add("OCC822_2", "OCC822_2 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_2, group);
+  theCommands.Add("OCC823", "OCC823 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC823, group);
+  theCommands.Add("OCC824", "OCC824 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC824, group);
+  theCommands.Add("OCC825", "OCC825 name1 name2 name3 name4 name5 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC825, group);
+  theCommands.Add("OCC826", "OCC826 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC826, group);
+  theCommands.Add("OCC827", "OCC827 name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC827, group);
+  theCommands.Add("OCC828", "OCC828 redius shape result ", __FILE__,OCC828, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_11.cxx b/src/QABugs/QABugs_11.cxx
new file mode 100644 (file)
index 0000000..c3c954a
--- /dev/null
@@ -0,0 +1,5443 @@
+// Created on: 2002-03-20
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <stdio.h>
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Geom_Axis2Placement.hxx>
+#include <gp.hxx>
+#include <gp_Trsf.hxx>
+#include <AIS_Trihedron.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <Graphic3d_MaterialAspect.hxx>
+#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+#include <TopoDS_Solid.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <BRepPrimAPI_MakeCone.hxx>
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <IGESToBRep_Reader.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <GCPnts_UniformDeflection.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <IGESToBRep.hxx>
+#include <V3d_Viewer.hxx>
+#include <BRepAdaptor_CompCurve.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Overflow.hxx>
+#include <Standard_Underflow.hxx>
+#include <Standard_DivideByZero.hxx>
+#include <OSD_SIGSEGV.hxx>
+#include <OSD_Exception_ACCESS_VIOLATION.hxx>
+#include <OSD_Exception_STACK_OVERFLOW.hxx>
+#include <OSD.hxx>
+#include <STEPCAFControl_Writer.hxx>
+#include <STEPControl_StepModelType.hxx>
+#include <Interface_Static.hxx>
+#include <IFSelect_ReturnStatus.hxx>
+#include <Standard_Failure.hxx>
+#include <TColgp_HArray1OfPnt2d.hxx>
+#include <Geom2dAPI_Interpolate.hxx>
+#include <Geom2d_BSplineCurve.hxx>
+#include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
+#include <Geom2d_BezierCurve.hxx>
+#include <BRep_Tool.hxx>
+#include <GeomProjLib.hxx>
+#include <Geom2dAPI_InterCurveCurve.hxx>
+#include <IntRes2d_IntersectionSegment.hxx>
+#include <TDataStd_RealArray.hxx>
+#include <TDF_CopyLabel.hxx>
+#include <NCollection_Vector.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
+#include <BRepBuilderAPI_MakePolygon.hxx>
+#include <gp_GTrsf.hxx>
+#include <Poly_Triangulation.hxx>
+#include <IGESControl_Reader.hxx>
+#include <IGESData_IGESModel.hxx>
+#include <IGESData_IGESEntity.hxx>
+#include <V3d_View.hxx>
+
+#include <tcl.h>
+
+#if ! defined(WNT)
+extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#else
+Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#endif
+
+static Standard_Integer  OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] ;
+    return 1;
+  }
+
+  Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
+
+  gp_Trsf trsf1;
+  trsf1.SetTranslation(gp_Vec(100, 100, 0));
+  aTrihedronAxis->Transform(trsf1);
+  Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
+  myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
+  myTrihedron->SetSize(100);
+  myAISContext->Display(myTrihedron, Standard_True);
+
+//  TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
+  TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
+  Handle(AIS_Shape) AS = new AIS_Shape(shape1);
+  AS->SetDisplayMode(1);
+  Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
+  AS->SetMaterial(mat);
+  AS->SetColor(Quantity_NOC_RED);
+  myAISContext->Display(AS);
+
+  gp_Trsf TouchTrsf;
+  TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
+
+  myAISContext->ResetLocation(AS);
+  myAISContext->SetLocation(AS , TouchTrsf) ;
+  myAISContext->Redisplay(AS, Standard_True);
+
+ return 0;
+}
+
+  // Remove as bad version of QAAddOrRemoveSelected from QADraw
+//static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+//{
+//  if( argc != 3) {
+//    di<<"Usage : " << argv[0] << " shape islocal\n";
+//    return 1;
+//  }
+//  //get AIS_Shape:
+//  Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
+//
+// //   ViewerTest_DoubleMapOfInteractiveAndName& aMap =
+// //                          ViewerTest::GetDataMapOfAIS ();
+//  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+//
+//  TCollection_AsciiString aName(argv[1]);
+//  Handle(AIS_InteractiveObject) AISObj;
+//
+//  if(aMap.IsBound2(aName)) {
+//    AISObj = aMap.Find2(aName);
+//    if(AISObj.IsNull()){
+//      di<<"No interactive object \n";
+//      return 1;
+//    }
+//
+//    Standard_Integer aNum = -1;
+//
+//    if(atoi(argv[2])) {
+//      aNum = anAISCtx->OpenLocalContext();
+//    }
+//
+//    if(anAISCtx->HasOpenedContext()){
+//      anAISCtx->InitSelected();
+//      anAISCtx->AddOrRemoveSelected(AISObj);
+//    }
+//    else {
+//      anAISCtx->InitCurrent();
+//      anAISCtx->AddOrRemoveCurrentObject(AISObj);
+//    }
+//
+//    if(aNum >= 0) {
+// //      anAISCtx->CloseLocalContext(aNum);
+//    }
+//
+//    return 0;
+//  }
+//  //select this shape:
+//  else {
+//    di<<"Use 'vdisplay' before";
+//    return 1;
+//  }
+//}
+
+static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
+{
+  if(argc > 1){
+    di<<"Usage: OCC136\n";
+    return 1;
+  }
+
+  //create some primitives:
+  // Two basic points:
+  Standard_Real Size=100;
+  gp_Pnt P0(0,0,0), P1(Size,Size,Size);
+  //box
+  TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
+  //sphere
+  TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
+  //cone
+  gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
+  TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
+  //cylinder
+  anAx2.SetLocation(gp_Pnt(Size,0,0));
+  anAx2.SetDirection(gp_Dir(-1,-1,1));
+  TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
+
+  Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
+  if(anAISCtx.IsNull()){
+    di<<"Null interactive context. Use 'vinit' at first.\n";
+    return 1;
+  }
+
+  if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
+  anAISCtx->EraseAll();
+
+  //load primitives to context
+  Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
+  anAISCtx->Display(aSh1);
+
+  Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
+  anAISCtx->Display(aSh2);
+
+  Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
+  anAISCtx->Display(aSh3);
+
+  Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
+  anAISCtx->Display(aSh4);
+
+  //set selected
+  anAISCtx->InitCurrent();
+  anAISCtx->AddOrRemoveCurrentObject(aSh1);
+  anAISCtx->AddOrRemoveCurrentObject(aSh2);
+  anAISCtx->AddOrRemoveCurrentObject(aSh3);
+  anAISCtx->AddOrRemoveCurrentObject(aSh4);
+
+  //remove all this objects from context
+  anAISCtx->Clear(aSh1, Standard_False);
+  anAISCtx->Clear(aSh2, Standard_False);
+  anAISCtx->Clear(aSh3, Standard_False);
+  anAISCtx->Clear(aSh4, Standard_False);
+  return 0;
+}
+
+static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc < 2){
+    printf("Usage: %s  iges_input [name]\n",argv[0]);
+    return(1);
+  }
+  Standard_Character *Ch;
+
+  if(argc > 2) {
+    Ch = new Standard_Character[strlen(argv[2])+3];
+  }
+  IGESToBRep_Reader IR;
+  IR.LoadFile (argv[1]);
+  IR.Clear();
+  IR.TransferRoots();
+  TopoDS_Shape aTopShape = IR.OneShape();
+  TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
+  Standard_Integer i=0;
+  for( ; ex.More(); ex.Next()){
+    const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
+    BRepAdaptor_Curve aCurve(E);
+    GCPnts_UniformDeflection plin(aCurve, 0.1);
+    di << "Num points = " << plin.NbPoints() << "\n";
+    if(argc > 2) {
+      i++;
+      sprintf(Ch,"%s_%i",argv[2],1);
+      DBRep::Set(Ch,E);
+    }
+  }
+  return (1);
+}
+
+static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
+{
+  if(argc!=2)
+    {
+      di << "Usage : " << a[0] << " file.igs" << "\n";
+      return -1;
+    }
+
+  Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
+
+  if(myContext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+
+  // MKV 30.03.05
+#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
+  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#else
+  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#endif
+
+  Standard_Character  *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
+  sprintf(file1,"%s/%s",DD,a[1]);
+
+  IGESToBRep_Reader reader;
+  Standard_Integer status = reader.LoadFile(file1);
+  if( !status ) {
+    IGESToBRep::Init();
+      reader.TransferRoots();
+      TopoDS_Shape shape = reader.OneShape();
+
+      Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
+
+      Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
+
+      if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
+       importedShape->SetDisplayMode(AIS_WireFrame);
+      else importedShape->SetDisplayMode(AIS_Shaded);
+      myContext->Display(importedShape);
+    }
+
+  printf("\n End of my  IGES to 3D-viewer *****************>\n");
+  return 0;
+}
+
+
+//====================================================
+//
+// Following code is inserted from
+// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
+// ( 75455 Apr 16 18:59)
+//
+//====================================================
+
+//OCC105
+#include <BRepTools_WireExplorer.hxx>
+#include <BRep_Tool.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+#include <TopExp.hxx>
+
+//
+// usage : OCC105 shape
+//
+// comments:
+//GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
+
+//Value Pnt = -338.556216693211 -394.465571897208 0
+//should be
+//Value Pnt = -307.47165394 -340.18073533 0
+
+static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2){
+    di<<"Usage : OCC105 shape\n";
+    return 1;
+  }
+//  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
+  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
+  Standard_Real l = 0.5; //atof(argv[2]);
+  // Find the first vertex of the wire
+  BRepTools_WireExplorer wire_exp(myTopoDSWire);
+  TopoDS_Vertex vlast;
+  {
+    TopoDS_Vertex vw1, vw2;
+    TopExp::Vertices(myTopoDSWire,vw1,vw2);
+    TopoDS_Vertex ve1, ve2;
+    TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
+    TopExp::Vertices(edge,ve1,ve2);
+    if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
+      vlast = vw1;
+    else {
+//      assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
+      vlast = vw2;
+    }
+  }
+  for ( ; wire_exp.More(); wire_exp.Next())
+    {
+      di << "\n\n New Edge \n"   << "\n";
+      Standard_Real newufirst, newulast;
+      TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
+      Standard_Real ufirst, ulast;
+      Handle(Geom_Curve) acurve;
+      TopoDS_Vertex ve1, ve2;
+      TopExp::Vertices(edge,ve1,ve2);
+      if (ve1.IsSame(vlast))
+       {
+          acurve = BRep_Tool::Curve(edge, ufirst, ulast);
+          newufirst = ufirst;
+          newulast  = ulast;
+          vlast = ve2;
+       }
+      else
+       {
+//          assert(ve2.IsSame(vlast));
+//          assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
+          acurve = BRep_Tool::Curve( edge, ufirst, ulast );
+          newufirst = acurve->ReversedParameter( ufirst );
+          newulast  = acurve->ReversedParameter( ulast );
+          acurve = acurve->Reversed( );
+          vlast = ve1;
+       }
+
+      GeomAdaptor_Curve   curve;
+      GCPnts_UniformAbscissa  algo;
+      curve.Load(acurve);
+      algo.Initialize( curve, l, newufirst, newulast );
+      if (!algo.IsDone())
+        di << "Not Done!!!"   << "\n";
+      for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
+        Standard_Real t = algo.Parameter(Index);
+        gp_Pnt      pt3 = curve.Value(t);
+        di << "Parameter t = " << t   << "\n";
+        di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z()  << "\n";
+      }
+    }
+  return 0;
+
+}
+
+#include <TColStd_SequenceOfTransient.hxx>
+#include <GeomFill_Pipe.hxx>
+static int pipe_OCC9 (Draw_Interpretor& di,
+                     Standard_Integer n, const char ** a)
+{
+  if (n < 6) {
+    di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
+    return 1;
+  }
+
+  TColStd_SequenceOfTransient aCurveSeq;
+  Standard_Integer i;
+  for (i=2 ; i<=4; i++) {
+    Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
+    if (aC.IsNull()) {
+      di << a[i] << " is not a curve" << "\n";
+      return 1;
+    }
+    aCurveSeq.Append(aC);
+  }
+
+  GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
+                     Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
+                     Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
+                     atof (a[5]) );
+
+  if (n == 7) {
+    aPipe.Perform(atof (a[6]), Standard_True);
+  } else {
+    aPipe.Perform(Standard_True/*, Standard_True*/);
+  }
+
+  Handle(Geom_Surface) aSurf = aPipe.Surface();
+
+  DrawTrSurf::Set(a[1], aSurf);
+  return 0;
+}
+
+//======================================================================
+// OCC125
+// usage : OCC125 shell
+//======================================================================
+#include <ShapeFix_Shell.hxx>
+
+Standard_Integer  OCC125(Draw_Interpretor& di ,
+                        Standard_Integer n,
+                        const char ** a)
+{
+  if (n!=2) {
+    di<<" Use OCC125 shell";
+    return 1;
+  }
+
+  TopoDS_Shape S = DBRep::Get(a[1]);
+
+  if (S.IsNull()) {
+    di<<" Null shape is not allowed";
+    return 1;
+  }
+
+  TopAbs_ShapeEnum aT;
+  aT=S.ShapeType();
+  if (aT!=TopAbs_SHELL) {
+    di<<" Shape Type must be SHELL";
+    return 1;
+  }
+
+  const TopoDS_Shell& aShell = TopoDS::Shell(S);
+  //
+  Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
+
+  isAccountMultiConex=Standard_True;
+  bNonManifold=Standard_False;
+
+  Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
+  bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
+
+  di<<"bResult="<<(Standard_Integer)bResult;
+
+  TopoDS_Shape aShape;
+  aShape=aFix->Shape();
+
+  TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
+  aRName=aName;
+  aRName=aRName+aDef;
+  DBRep::Set (aRName.ToCString(), aShape);
+  di<<aRName.ToCString();
+  //
+  return 0;
+}
+
+#include <BRepLib_FindSurface.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+Standard_Integer  OCC157(Draw_Interpretor& di,
+                        Standard_Integer n,
+                        const char ** a)
+//static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
+{
+  if (n<3) {
+    di << "bad number of arguments" <<"\n";
+    return 1;
+  }
+
+  // try to read a shape:
+  TopoDS_Shape inputShape=DBRep::Get(a[2]);
+  if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
+    di << "Invalid input shape"<< "\n";
+    return 1;
+  }
+  Standard_Real toler = atof(a[3]);
+  TopoDS_Wire aWire = TopoDS::Wire(inputShape);
+  BRepLib_FindSurface FS(aWire, toler, Standard_True);
+  if(FS.Found()) {
+    di<<"OCC157: OK; Planar surface is found"<<"\n";
+    Handle(Geom_Surface) aSurf = FS.Surface();
+    BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
+    if(aMakeFace.IsDone()) {
+      TopoDS_Face aFace = aMakeFace.Face();
+      DBRep::Set(a[1],aFace);
+    }
+  }
+  else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
+  return 0;
+
+}
+
+// #include <MyCommandsCMD.h>
+#include <ShapeFix_Shape.hxx>
+#include <BRepOffset_MakeOffset.hxx>
+#include <BRepOffsetAPI_MakeOffset.hxx>
+#include <BRepOffset_Mode.hxx>
+#include <GeomAbs_JoinType.hxx>
+#include <AIS_Shape.hxx>
+
+#include <BRepTools.hxx>
+
+Standard_Integer  OCC165(Draw_Interpretor& di ,
+                        Standard_Integer n,
+                        const char ** a)
+
+
+//=======================================================================
+
+// static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
+
+// void MyOffsets_Commands(Draw_Interpretor& theCommands)
+// {
+//     theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
+// }
+
+//=======================================================================
+
+// static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+ {
+   if (n > 2)
+     {
+       di <<"Usage : " << a[0] << " [file]"<<"\n";
+       return 1;
+     }
+       di.Eval ("axo");
+
+#define _OFFSET_TELCO_
+#ifdef _OFFSET_TELCO_
+
+       Standard_CString file = a[1];
+
+       BRep_Builder aBuilder;
+       TopoDS_Shape theShape;
+       //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
+       BRepTools::Read(theShape, file, aBuilder);
+       DBRep::Set("shape", theShape);
+
+       TopoDS_Wire theWire = TopoDS::Wire(theShape);
+
+       Standard_Real anOffset = 1.5;
+
+#else
+
+       Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
+               yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
+               zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
+
+       BRepBuilderAPI_MakePolygon theSquare;
+       TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
+       theSquare.Add(theA);
+       TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
+       theSquare.Add(theB);
+       TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
+       theSquare.Add(theC);
+       TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
+       theSquare.Add(theD);
+
+       theSquare.Close();
+       TopoDS_Wire theWire = theSquare.Wire();
+
+       Standard_Real anOffset = 10;
+
+
+#endif /* _OFFSET_TELCO_ */
+
+
+       TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
+       DBRep::Set("face", theFace);
+
+
+       Standard_Real anAlt = 0.;
+       GeomAbs_JoinType theJoin = GeomAbs_Intersection;
+//GeomAbs_Intersection; //GeomAbs_Arc;
+       BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
+       aMakeOffset.AddWire(theWire);
+
+       aMakeOffset.Perform(anOffset, anAlt);
+
+       TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
+       DBRep::Set("offset", theOffsetShapePos);
+       return 0;
+//     return TCL_OK;
+}
+
+#include<BRepAlgoAPI_Cut.hxx>
+#include<BRepAlgo_Cut.hxx>
+
+#include<BRepPrimAPI_MakeHalfSpace.hxx>
+#include<Handle_Geom_CartesianPoint.hxx>
+#include<Geom_CartesianPoint.hxx>
+#include<AIS_Point.hxx>
+
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+
+static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
+
+{
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+
+    gp_Pnt pt1_(250.,250.,0.);
+    gp_Pnt pt2_(-250.,250.,0.);
+    gp_Pnt pt3_(-250.,-250.,0.);
+    gp_Pnt pt4_(250.,-250.,0.);
+    BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
+    BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
+    BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
+    BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
+
+    BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
+    BRepBuilderAPI_MakeFace face_(wire_);
+    TopoDS_Face sh_ = face_.Face();
+
+    int up = 1;
+
+    gp_Pnt g_pnt;
+    if(up)
+        g_pnt = gp_Pnt(0,0,-100);
+    else
+          g_pnt = gp_Pnt(0,0,100);
+
+    myAISContext->EraseAll(Standard_False);
+        Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
+        Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
+    myAISContext->Display(AISPoint);
+
+    BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
+    TopoDS_Solid sol1_ = half_.Solid();
+//         Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
+//         AISHalf->SetColor(Quantity_NOC_GREEN);
+//     myAISContext->Display(AISHalf);
+
+  DBRep::Set("Face",sol1_);
+
+    gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
+
+    Standard_Real x=0., y=0., z=-80.;
+
+    BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
+//         Handle(AIS_Shape) AISBox = new AIS_Shape(box);
+//         AISBox->SetColor(Quantity_NOC_BLUE1);
+//     myAISContext->Display(AISBox);
+
+ DBRep::Set("Box",box.Shape());
+
+//     BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
+//         //BRepAlgoAPI_Cut cut(  box.Shape(), sol1_ );
+//     TopoDS_Shape sh1_ = cut.Shape();
+//         Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
+//         AISCut->SetColor(Quantity_NOC_RED);
+//     myAISContext->Display(AISCut);
+
+//  DBRep::Set("Cut",sh1_);
+
+  return 0;
+
+}
+#include<GProp_GProps.hxx>
+#include<BRepGProp.hxx>
+
+static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
+
+{
+  if (argc =! 2)
+  {
+    di <<"Usage : " << argv[0] << " file"<<"\n";
+    return 1;
+  }
+  Standard_CString file = argv[1];
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+TopoDS_Shape sh;
+BRep_Builder builder;
+//BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
+BRepTools::Read(sh, file, builder);
+
+TopoDS_Wire wire;
+builder.MakeWire(wire);
+TopoDS_Edge ed;
+TopoDS_Vertex vt1, vt2;
+TopExp_Explorer wex(sh, TopAbs_EDGE);
+for(;wex.More();wex.Next())
+{
+    ed = TopoDS::Edge(wex.Current());
+    TopExp::Vertices(ed, vt1, vt2);
+    builder.UpdateVertex(vt1, 0.01);
+    builder.UpdateVertex(vt2, 0.01);
+    builder.UpdateEdge(ed, 0.01);
+    builder.Add(wire, ed);
+
+
+    GProp_GProps lprop;
+    BRepGProp::LinearProperties(ed, lprop);
+    printf("\n length = %f", lprop.Mass());
+}
+ DBRep::Set("Wire",wire);
+// Handle(AIS_Shape) res = new AIS_Shape( wire );
+// aContext->SetColor( res, Quantity_NOC_RED );
+// aContext->Display( res );
+
+// BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
+// off.Perform(0.5, 0);
+
+// printf("\n IsDone = %d", off.IsDone());
+// sh = off.Shape();
+// res = new AIS_Shape( sh );
+// aContext->SetColor( res, Quantity_NOC_GREEN );
+// aContext->Display( res );
+
+  return 0;
+
+}
+
+static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0];
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
+  Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
+  myAISContext->Display(anAISBox, 1);
+  anAISBox->SetSelectionMode(-1);
+  Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
+  myAISContext->CloseLocalContext(myLocContInd);
+  Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
+  if(aSelMode != -1)
+    return 1;
+
+  return 0;
+}
+
+#include <TDocStd_Document.hxx>
+#include <DDocStd.hxx>
+#include <PCDM_StoreStatus.hxx>
+#include <TDocStd_Application.hxx>
+
+static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  if (nb != 2) {
+    di << "Usage: " << a[0] << " Doc" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) D;
+  if (!DDocStd::GetDocument(a[1],D)) return 1;
+
+  Handle(TDocStd_Application) A;
+  if (!DDocStd::Find(A)) return 1;
+
+  TCollection_ExtendedString theStatusMessage;
+  if (!D->IsSaved()) {
+    di << "this document has never been saved" << "\n";
+    return 0;
+  }
+  PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
+  if (theStatus != PCDM_SS_OK ) {
+    switch ( theStatus ) {
+    case PCDM_SS_DriverFailure: {
+      di << " Could not store , no driver found to make it " <<"\n" ;
+      break ;
+    }
+    case PCDM_SS_WriteFailure: {
+      di << " Write access failure " << "\n" ;
+      break;
+    }
+    case PCDM_SS_Failure: {
+      di << " Write failure " << "\n" ;
+    }
+    }
+    return 1;
+  }
+  return 0;
+}
+
+static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  if (nb != 3) {
+    di << "Usage: " << a[0] << " Doc Path" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) D;
+  if (!DDocStd::GetDocument(a[1],D)) return 1;
+
+  TCollection_ExtendedString path (a[2]);
+  Handle(TDocStd_Application) A;
+  if (!DDocStd::Find(A)) return 1;
+
+  TCollection_ExtendedString theStatusMessage;
+  PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
+  if (theStatus != PCDM_SS_OK ) {
+    switch ( theStatus ) {
+    case PCDM_SS_DriverFailure: {
+      di << " Could not store , no driver found to make it " <<"\n" ;
+      break ;
+    }
+    case PCDM_SS_WriteFailure: {
+      di << " Write access failure " << "\n" ;
+      break;
+    }
+    case PCDM_SS_Failure: {
+      di << " Write failure " << "\n" ;
+    }
+    }
+    return 1;
+  }
+
+  return 0;
+}
+
+#include <BRepClass3d_SolidClassifier.hxx>
+
+Standard_Integer OCC299bug (Draw_Interpretor& di,
+                           Standard_Integer n,
+                           const char ** a)
+{
+  char sbf[512];
+
+  if (n < 3) {
+    di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
+    return -1;
+  }
+
+  TopoDS_Shape aS = DBRep::Get(a[1]);
+  if (aS.IsNull()) {
+    sprintf(sbf, " Null Shape is not allowed here\n");
+    di<<sbf;
+    return 1;
+  }
+
+  if (aS.ShapeType()!=TopAbs_SOLID) {
+    sprintf(sbf, " Shape type must be SOLID\n");
+    di<<sbf;
+    return 1;
+  }
+  //
+  Standard_Real aTol=1.e-7;
+  TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
+  TopAbs_State aState = TopAbs_UNKNOWN;
+  gp_Pnt aP(8., 9., 10.);
+
+  if (!DrawTrSurf::GetPoint(a[2], aP) ) {
+    sprintf(sbf, " Null Point is not allowed here\n");
+    di<<sbf;
+    return 1;
+  }
+
+  aTol=1.e-7;
+  if (n==4) {
+    aTol=atof(a[3]);
+  }
+  //
+  BRepClass3d_SolidClassifier aSC(aS);
+  aSC.Perform(aP,aTol);
+  //
+  aState = aSC.State();
+  //
+  sprintf(sbf, "The point is "); di<<sbf;
+  //
+  switch (aState) {
+  case TopAbs_IN:
+    sprintf(sbf, sIN.ToCString());
+    break;
+  case TopAbs_OUT:
+    sprintf(sbf, sOUT.ToCString());
+    break;
+  case TopAbs_ON:
+    sprintf(sbf, sON.ToCString());
+    break;
+  case TopAbs_UNKNOWN:
+    sprintf(sbf, sUNKNOWN.ToCString());
+    break;
+  default:
+    sprintf(sbf, sUNKNOWN.ToCString());
+    break;
+  }
+  di<<sbf;
+       //
+  sprintf(sbf, " shape\n");
+  di<<sbf;
+
+  return 0;
+}
+
+#include <OSD_Process.hxx>
+#include <OSD_Path.hxx>
+
+static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  if (nb != 1) {
+    di << "Usage: " << a[0] << "\n";
+    return 1;
+  }
+  OSD_Process p;
+  OSD_Path d = p.CurrentDirectory();
+  TCollection_AsciiString s;
+  d.SystemName(s);
+  di << "*" <<  s.ToCString() << "*" << "\n";
+  d.UpTrek();
+  d.SystemName(s);
+  di <<  "*" <<  s.ToCString() <<  "*" <<"\n";
+  return 0;
+}
+
+static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  if (nb != 1) {
+    di << "Usage: " << a[0] << "\n";
+    return 1;
+  }
+  OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
+  di << p.Trek().ToCString() << "\n";
+  p.UpTrek();
+  di << p.Trek().ToCString() << "\n";
+  return 0;
+}
+
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgo_Fuse.hxx>
+#include <BRepAlgo_Common.hxx>
+
+static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
+{
+  //if (nb != 1) {
+  //  cout << "Usage: " << a[0] << endl;
+  //  return 1;
+  //}
+  if(nb < 1 || nb > 2) {
+    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (nb == 2) {
+    Standard_Integer IsB = atoi(a[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+    }
+  }
+
+  BRepPrimAPI_MakeBox box1( 100, 100, 100 );
+  BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
+
+  TopoDS_Shape shape1 = box1.Shape();
+  TopoDS_Shape shape2 = box2.Shape();
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
+//  TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
+//#else
+//  TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
+//  TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
+//#endif
+  TopoDS_Shape fuse,comm;
+  if (IsBRepAlgoAPI) {
+    di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
+    di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
+    fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
+    comm = BRepAlgoAPI_Common( shape1, shape2 );
+  } else {
+    di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
+    fuse = BRepAlgo_Fuse( shape1, shape2 );
+    di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
+    comm = BRepAlgo_Common( shape1, shape2 );
+  }
+
+  return 0;
+}
+
+#include <ShapeAnalysis_Edge.hxx>
+
+static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
+{
+  if( n < 3) {
+    di<<"-1"<<"\n";
+    di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
+    return 1;
+  }
+  TopoDS_Shape Sh1 = DBRep::Get(a[1]);
+  TopoDS_Shape Sh2 = DBRep::Get(a[2]);
+  if(Sh1.IsNull() || Sh2.IsNull()) {
+    di<<"-2"<<"\n";
+    di<<"Invalid arguments"<<"\n";
+    return 1;
+  }
+  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
+  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
+  if(e1.IsNull() || e2.IsNull()) {
+    di<<"-3"<<"\n";
+    di<<"Invalid type of arguments"<<"\n";
+    return 1;
+  }
+  Standard_Real aTol = Precision::Confusion();
+  Standard_Real aDistDomain = 0.0;
+  Standard_Integer k = 3;
+  if(k < n)
+    aTol = atof(a[k++]);
+  if(k < n)
+    aDistDomain = atof(a[k++]);
+
+  ShapeAnalysis_Edge sae;
+  if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
+    if(aDistDomain ==0.0) {
+      di<<"1"<<"\n";
+      di<<"Edges is overlaping comletly"<<"\n";
+    } else {
+      di<<"2"<<"\n";
+      di<<"Edges is overlaped"<<"\n";
+      di<<"with tolerance = "<<aTol<<"\n";
+      di<<"on segment length = "<<aDistDomain<<"\n";
+    }
+  } else {
+    di<<"3"<<"\n";
+    di<<"Edges is not overlaped"<<"\n";
+  }
+  return 0;
+}
+
+
+#include <DDocStd_DrawDocument.hxx>
+#include <TDataStd_Name.hxx>
+#include <Draw.hxx>
+#include <XCAFDoc_ShapeTool.hxx>
+#include <XCAFDoc_DocumentTool.hxx>
+#include <TDF_LabelSequence.hxx>
+#include <TPrsStd_AISPresentation.hxx>
+#include <TDF_Data.hxx>
+#include <TDF_Label.hxx>
+#include <XCAFPrs_Driver.hxx>
+
+//------------------------------------------------------------------------------------------
+// name    : OCC363
+// Purpose :
+//------------------------------------------------------------------------------------------
+static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verufy amount of arguments
+    if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
+
+    // 2. Retrieve DDocStd application
+    Handle(TDocStd_Application) App;
+    if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
+
+    // 3. Open document
+    TCollection_ExtendedString name(argv[2]);
+    Handle(TDocStd_Document) Doc;
+    if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
+    Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
+    TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
+    Draw::Set(argv[1],DD);
+
+    // 4. Create prsentations
+    Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
+    TDF_LabelSequence seq;
+    shapes->GetFreeShapes ( seq );
+    Handle(TPrsStd_AISPresentation) prs;
+    for ( Standard_Integer i=1; i <= seq.Length(); i++ )
+      if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
+        prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
+  }
+  catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
+
+  di << "OCC363 OK\n";
+  return 0;
+}
+
+// Must use OCC299
+////======================================================================================
+//// Function : OCC372
+//// Purpose  :
+////======================================================================================
+//static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+//{
+//  try
+//  {
+//    OCC_CATCH_SIGNALS
+//    // 1. Verufy amount of arguments
+//    if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
+//
+//    // 2. Read solid
+//    BRep_Builder B;
+//    TopoDS_Shape Ref;
+//    BRepTools::Read(Ref, argv[1], B);
+//
+//    // 3. Calculate location of aP3d in relation to the solid
+//    gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
+//    BRepClass3d_SolidClassifier SC(Ref);
+//    SC.Perform(aP3d, 1e-7);
+//
+//    // 4. Check returned state. The point must be inside the solid.
+//    TopAbs_State aState=SC.State();
+//    switch (aState)
+//    {
+//    case TopAbs_OUT:
+//      di<<"OCC372 FAULTY. aState = TopAbs_OUT";
+//      return 0;
+//    case TopAbs_ON:
+//      di<<"OCC372 FAULTY. aState = TopAbs_ON";
+//     return 0;
+//    case TopAbs_IN:
+//      di<<"OCC372 OK. aState = TopAbs_IN" ;
+//      return 0;
+//    default:
+//      di<<"OCC372 FAULTY. aState = UNKNOWN";
+//      return 0;
+//    }
+//  }
+//  catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
+//
+//  return 0;
+//}
+
+#include <BRepTopAdaptor_FClass2d.hxx>
+
+//======================================================================================
+// Function : OCC377
+// Purpose  :
+//======================================================================================
+static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verify validity of arguments
+    if ( argc < 1 ) {di << "Error OCC377. Use  OCC377 file x y precuv \n";return 0;}
+
+    // 2. Initialize parameters
+    gp_Pnt2d p2d;
+    p2d.SetX ( atof(argv[2]) );
+    p2d.SetY ( atof(argv[3]) );
+    Standard_Real precuv = atof (argv[4] );
+
+    // 3. Read shape
+    BRep_Builder B;
+    TopoDS_Shape Shape;
+    BRepTools::Read ( Shape, argv[1], B );
+
+    // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
+    TopExp_Explorer exp;
+    Standard_Integer i=1;
+    for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
+    {
+      // 4.1. Verify whether enrtry point is on wire
+      const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
+      TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
+
+      TopAbs_Orientation orWire = wir.Orientation();
+      newFace.Orientation(TopAbs_FORWARD);
+      B.Add(newFace,wir);
+
+      BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
+      TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
+      //di << "Wire " << i << ": Infinite point is " <<
+      //  ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
+
+      TCollection_AsciiString TmpString;
+      stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
+      di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
+
+      stat1 = FClass2d1.Perform(p2d);
+      //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
+      //  ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
+
+      TmpString.Clear();
+      stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
+      di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
+
+      // 4.2. Verify whether enrtry point is on reversed wire
+      newFace = TopoDS::Face(Shape.EmptyCopied());
+      newFace.Orientation(TopAbs_FORWARD);
+      orWire = TopAbs::Reverse(orWire);
+      B.Add(newFace,wir.Oriented(orWire));
+      BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
+      TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
+      //di << "Reversed Wire " << i << ": Infinite point is " <<
+      //  ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
+
+      TmpString.Clear();
+      stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
+      di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
+
+      stat2 = FClass2d2.Perform(p2d);
+      //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
+      //  ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
+
+      TmpString.Clear();
+      stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
+      di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
+
+      // 4.3. Compare results (they must be same)
+      if(stat1 ==stat2) di << "OCC377 OK" << "\n";
+      else {di << "OCC377 FAULTY" << "\n"; return 0;}
+    }
+  }
+  catch(Standard_Failure)
+  {
+    di << "OCC377 Exception";
+  }
+
+  return 0;
+}
+
+#include <ShapeUpgrade_ShapeDivideAngle.hxx>
+#include <ShapeBuild_ReShape.hxx>
+
+//=======================================================================
+//function : OCC22
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verify arguments of the command
+    if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
+
+    Standard_Boolean aConsiderLocation;
+    if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
+    else aConsiderLocation = Standard_True;
+
+    // 2. Iniitialize aShapeUpgrade
+    ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
+    // precision
+    aShapeUpgrade.SetPrecision (Precision::Confusion());
+    // tolerance
+    aShapeUpgrade.SetMaxTolerance(0.1);
+    // subshapes to be divided
+    TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
+    if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
+    aShapeUpgrade.Init(aSubShapesToBeDivided);
+    // context
+    Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
+    aShapeUpgrade.SetContext(aReshape);
+    if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
+
+    // 3. Perform splitting
+    if (aShapeUpgrade.Perform (Standard_False))         di << "Upgrade_SplitRevolution_Done \n";
+    else if (aShapeUpgrade.Status (ShapeExtend_OK))     di << "Upgrade_SplitRevolution_OK \n";
+    else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
+
+    // 4. Perform rebuilding shape
+    // 4.1. Retrieve Shape
+    TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
+    if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
+    // 4.2 Rebuid retrieved shape
+    TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
+    // 4.3. Create result Draw shape
+    DBRep::Set(argv[1], aResultShape);
+  }
+  catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
+
+  return 0;
+}
+
+
+#include <ShapeProcess_OperLibrary.hxx>
+#include <ShapeProcess_ShapeContext.hxx>
+#include <ShapeProcess.hxx>
+
+#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
+#include <BRepMesh_IncrementalMesh.hxx>
+
+//=======================================================================
+//function : OCC24
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verify amount of arguments of the command
+    if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
+
+    // 2. Retrieve parameters
+    // initial shape
+    TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
+    if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
+    // compound of subshapes
+    TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
+    if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
+    // name of resource file
+    const char* aResourceFile = argv[4];
+    // name of sequence from resource file to be executed
+    const char* aSequenceName = argv[5];
+
+    // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
+    ShapeProcess_OperLibrary::Init();
+    Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
+    aShapeContext->SetDetalisation (TopAbs_EDGE);
+    ShapeProcess::Perform (aShapeContext, aSequenceName);
+
+    // 4. Rebuild initil shape in accordance with performed operation
+    Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
+    TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
+    for (; anIter.More(); anIter.Next())
+      aReshape->Replace(anIter.Key(), anIter.Value());
+    TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
+
+    // 5 Create resultant Draw shape
+    DBRep::Set(argv[1], aResultShape);
+
+  }
+  catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC369
+//purpose  : Verify whether exception occurs during building mesh
+//=======================================================================
+static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verify amount of arguments of the command
+    if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
+
+    // 2. Retrieve shape
+    TopoDS_Shape aShape = DBRep::Get(argv[1]);
+    if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
+
+    // 3. Build mesh
+    BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
+
+  }
+  catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
+
+  di << "OCC369 OK \n";
+  return 0;
+}
+
+#include <math_Vector.hxx>
+#include <math_Matrix.hxx>
+static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 9){
+    di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
+    return 1;
+  }
+  Standard_Integer LowerVector = atoi(argv[1]);
+  Standard_Integer UpperVector = atoi(argv[2]);
+  Standard_Real InitialValueVector = atof(argv[3]);
+  Standard_Integer LowerRowMatrix = atoi(argv[4]);
+  Standard_Integer UpperRowMatrix = atoi(argv[5]);
+  Standard_Integer LowerColMatrix = atoi(argv[6]);
+  Standard_Integer UpperColMatrix = atoi(argv[7]);
+  Standard_Real InitialValueMatrix = atof(argv[8]);
+
+  math_Vector Vector1(LowerVector, UpperVector);
+  math_Vector Vector2(LowerVector, UpperVector);
+
+  math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
+  math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
+
+  //Vector.Dump(cout);
+  //cout<<endl;
+
+  //Matrix.Dump(cout);
+  //cout<<endl;
+
+  Vector1.Multiply(Vector, Matrix);
+
+  //Vector1.Dump(cout);
+  Standard_SStream aSStream1;
+  Vector1.Dump(aSStream1);
+  di << aSStream1;
+  di<<"\n";
+
+  Vector2.TMultiply(Vector, Matrix);
+
+  //Vector2.Dump(cout);
+  Standard_SStream aSStream2;
+  Vector2.Dump(aSStream2);
+  di << aSStream2;
+  di<<"\n";
+
+  return 0;
+}
+
+#include <GeomPlate_BuildPlateSurface.hxx>
+//=======================================================================
+//function : OCC525
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    GeomPlate_BuildPlateSurface aBuilder;
+    aBuilder.Perform();
+  }
+  catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
+  //catch (...) { di << "OCC525 Exception \n" ;return 0; }
+
+  di << "OCC525 OK \n";
+  return 0;
+}
+
+#include <Viewer2dTest.hxx>
+#include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx>
+
+#include <AIS2D_InteractiveContext.hxx>
+#include <V2d_View.hxx>
+#include <AIS2D_InteractiveObject.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+
+#if ! defined(WNT)
+extern Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
+#else
+Standard_EXPORT Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
+#endif
+
+//=======================================================================
+//function :  OCC543
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC543 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  if(aContext.IsNull()) {
+    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  if(argc != 2){
+    di<<"Usage : " << argv[0] << " name\n";
+    return -1;
+  }
+  Handle(V2d_View) V = Viewer2dTest::CurrentView();
+
+  TCollection_AsciiString name = argv[1];
+
+  if (!GetMapOfAIS2D().IsBound2(name)) {
+//    di << "There is not an object with name " << name.ToCString() << "\n";
+//    return -1;
+  }
+
+  Handle(AIS2D_InteractiveObject) aShape = GetMapOfAIS2D().Find2(name);
+  Standard_Integer PickedIndex = aShape->PickedIndex();
+  di << "PickedIndex = " << PickedIndex << "\n";
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeWedge.hxx>
+#include <gce_MakeRotation.hxx>
+#include <gce_MakeTranslation.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+#include <BRepPrimAPI_MakeWedge.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgo_Fuse.hxx>
+#include <BRepAlgo_Cut.hxx>
+//=======================================================================
+//function :  OCC578
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  //if (argc!=4) {
+  //  di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
+  //  return 1;
+  //}
+  if(argc < 4 || argc > 5) {
+    di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 5) {
+    Standard_Integer IsB = atoi(argv[4]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
+//      return 1;
+    }
+  }
+
+  gp_Pnt P0(0,0,0.0);
+  double xperiod = 1.0;
+  double yperiod = 1.0;
+  double sub_thick = 0.5;
+
+  // mask_substrate
+  //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
+  TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
+
+  // --------------------------------------------------------------------
+
+  // wedge
+  //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
+       //                                    0.1,  0.1  , 0.4, 0.4 );
+  TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
+                                             0.1,  0.1  , 0.4, 0.4 ).Shape();
+
+  gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
+                                    gp_Dir(1.0,0.0,0.0),
+                                    1.570795 );
+
+  gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
+                                         gp_Pnt( 0.25, 0.25, 0.5)
+                                         );
+
+  rotate.PreMultiply( translate );
+
+  TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
+
+  if (wedge1a.IsNull()) {
+    di<<" Null shape1 is not allowed\n";
+    return 1;
+  }
+  DBRep::Set(argv[1], wedge1a);
+
+  // --------------------------------------------------------------------
+
+  // wedge top
+  //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
+       //                                    0.1,  0.1  , 0.4, 0.4 );
+  TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
+                                             0.1,  0.1  , 0.4, 0.4 ).Shape();
+
+  gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
+                                     gp_Dir(1.0,0.0,0.0),
+                                     1.570795 * 3.0 );
+
+  gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
+                                          gp_Pnt( 0.25, 0.25, 0.5)
+                                          );
+
+  rotate2.PreMultiply( translate2 );
+
+  TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
+
+  if (wedge2a.IsNull()) {
+    di<<" Null shape2 is not allowed\n";
+    return 1;
+  }
+  DBRep::Set(argv[2], wedge2a);
+
+
+  // combine wedges
+//#if ! defined(BRepAlgoAPI_def01)
+//  TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
+//#else
+//  TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
+//#endif
+  TopoDS_Shape wedge_common;
+  if (IsBRepAlgoAPI) {
+    di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
+    wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
+  } else {
+    di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
+    wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
+  }
+
+  // remove wedge area from substrate
+//#if ! defined(BRepAlgoAPI_def01)
+//  TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
+//#else
+//  TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
+//#endif
+  TopoDS_Shape sub_etch1;
+  if (IsBRepAlgoAPI) {
+    di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
+    sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
+  } else {
+    di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
+    sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
+  }
+
+  if (sub_etch1.IsNull()) {
+    di<<" Null shape3 is not allowed\n";
+    return 1;
+  }
+  DBRep::Set(argv[3], sub_etch1);
+
+  return 0;
+}
+
+#include <Graphic2d_DisplayList.hxx>
+#include <Graphic2d_View.hxx>
+
+//=======================================================================
+//function :  OCC627
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  if(aContext.IsNull()) {
+    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  if(argc != 1){
+    di<<"Usage : " << argv[0] << "\n";
+    return -1;
+  }
+
+  Handle(V2d_View) V = Viewer2dTest::CurrentView();
+  Handle(Graphic2d_View) View = V->View();
+  Handle(Graphic2d_DisplayList) DisplayList = View->DisplayList();
+  Standard_Integer Length = DisplayList->Length();
+  di << "Length = " << Length << "\n";
+
+  return 0;
+}
+
+#include <Standard_GUID.hxx>
+//=======================================================================
+//function :  OCC669
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 2){
+    di<<"Usage : " << argv[0] << " GUID\n";
+    return -1;
+  }
+  Standard_GUID guid(argv[1]);
+  //guid.ShallowDump(cout);
+  Standard_SStream aSStream;
+  guid.ShallowDump(aSStream);
+  di << aSStream;
+  di<<"\n";
+  return 0;
+}
+
+#include <XCAFDoc.hxx>
+//=======================================================================
+//function :  OCC738_ShapeRef
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 1){
+    di<<"Usage : " << argv[0] << "\n";
+    return -1;
+  }
+  const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
+  //guid.ShallowDump(cout);
+  Standard_SStream aSStream;
+  guid.ShallowDump(aSStream);
+  di << aSStream;
+  return 0;
+}
+
+//=======================================================================
+//function :  OCC738_Assembly
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 1){
+    di<<"Usage : " << argv[0] << "\n";
+    return -1;
+  }
+  const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
+  //guid.ShallowDump(cout);
+  Standard_SStream aSStream;
+  guid.ShallowDump(aSStream);
+  di << aSStream;
+  return 0;
+}
+
+#if defined(DDataStd_def01)
+#include <DDataStd_DrawPresentation.hxx>
+//=======================================================================
+//function :  OCC739_DrawPresentation
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 1){
+    di<<"Usage : " << argv[0] << "\n";
+    return -1;
+  }
+  const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
+  //guid.ShallowDump(cout);
+  Standard_SStream aSStream;
+  guid.ShallowDump(aSStream);
+  di << aSStream;
+  return 0;
+}
+#endif
+
+//=======================================================================
+//function :  OCC708
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+
+  if ( argc != 2) {
+    di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
+    return 1;
+  }
+  
+  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
+
+  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
+  
+  TCollection_AsciiString aName(argv[1]);
+  Handle(AIS_InteractiveObject) AISObj;
+
+  if(!aMap.IsBound2(aName)) {
+    di << "Use 'vdisplay' before" << "\n";
+    return 1;
+  } else {
+    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
+    if(AISObj.IsNull()){
+      di << argv[1] << " : No interactive object" << "\n";
+      return 1;
+    } 
+    AISObj->UnsetTransformation();
+    if (!aContext->HasOpenedContext()) {
+      aContext->OpenLocalContext();
+    }
+    aContext->Erase(AISObj, updateviewer, PutInCollector);
+    aContext->UpdateCurrentViewer();
+    aContext->Display(AISObj, updateviewer);
+    aContext->UpdateCurrentViewer();
+  }
+  return 0;
+}
+
+//=======================================================================
+//function :  OCC670
+//purpose  :
+//=======================================================================
+#include <TColStd_Array2OfInteger.hxx>
+static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 1){
+    di<<"Usage : " << argv[0] << "\n";
+    return -1;
+  }
+  TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
+  Array2OfInteger.SetValue(5,5,55);
+  return 0;
+}
+
+#include <GeomAPI_ProjectPointOnSurf.hxx>
+//=======================================================================
+//function :  OCC867
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc!=7)  
+  {
+    di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
+    return 1;   
+  }
+  
+  gp_Pnt aPoint3d;        
+  DrawTrSurf::GetPoint(argv[1],aPoint3d);
+  Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
+  Standard_Real             Umin=atof(argv[3]);
+  Standard_Real             Usup=atof(argv[4]);
+  Standard_Real             Vmin=atof(argv[5]);
+  Standard_Real             Vsup=atof(argv[6]);
+  if (aSurface.IsNull()) {
+    di << argv[2] << " Null surface \n" ;
+    return 1;
+  }
+  
+  GeomAPI_ProjectPointOnSurf PonSurf;
+  PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
+  PonSurf.Perform(aPoint3d);
+
+  return 0; 
+}
+
+//=======================================================================
+//function :  OCC909
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc!=3)  
+  {
+    di<<"Usage : " << argv[0] << " wire face\n";
+    return 1;   
+  }
+  
+  TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
+  TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
+  if (awire.IsNull() || aface.IsNull()) {
+    di << "Null object" << "\n";
+    return 1;
+  }
+
+  Standard_Integer count = 0;
+  TopExp_Explorer TE(awire, TopAbs_VERTEX);
+  if ( TE.More()) {
+    BRepTools_WireExplorer WE;
+    for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
+      TopoDS_Edge E = WE.Current();
+      count++;
+    }
+  }
+  di << "Count = " << count << "\n";
+
+  return 0; 
+}
+
+//=======================================================================
+//function :  OCC921
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc =! 2)
+  {
+    di <<"Usage : " << argv[0] << " face"<<"\n";
+    return 1;
+  }
+  Standard_Real u1, u2, v1, v2;
+  TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
+  if (F.IsNull())
+    return 1;
+  BRepTools::UVBounds(F, u1, u2, v1, v2);
+  di << "Bounds: " << u1 << "   " << u2 << "   " << v1 << "   " << v2 << "\n";
+  return 0;
+}
+
+#include <Expr_NamedUnknown.hxx>
+#include <Expr_GeneralExpression.hxx>
+#include <Expr_Exponential.hxx>
+//=======================================================================
+//function :  OCC902
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc =! 2)
+  {
+    di <<"Usage : " << argv[0] << " expression"<<"\n";
+    return 1;
+  }
+
+ TCollection_AsciiString  myStr(argv[1]);
+
+ Handle (Expr_NamedUnknown)      myNamed = new Expr_NamedUnknown(myStr);
+ Handle (Expr_Exponential)       oldExpr = new Expr_Exponential(myNamed); 
+ Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
+
+ TCollection_AsciiString  res        = newExpr->String();
+ Standard_CString         resStr     = res.ToCString();
+ TCollection_AsciiString  res_old    = oldExpr->String();
+ Standard_CString         res_oldStr = res_old.ToCString();
+
+ di << "X = " << argv[1] << "\n";
+ di << "Y = " << res_oldStr << "\n";
+ di << "Y' = " << resStr  << "\n";
+
+ return 0;
+}
+
+#include <DDF.hxx>
+#include <TPrsStd_AISViewer.hxx>
+#include <TDF_Label.hxx>
+#include <TPrsStd_AISPresentation.hxx>
+//=======================================================================
+//function : OCC1029_AISTransparency 
+//purpose  : OCC1029_AISTransparency  (DOC,entry,[real])
+//=======================================================================
+
+static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
+                                            Standard_Integer nb, 
+                                            const char ** arg) 
+{
+  if (nb >= 3 ) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetTransparency(atof(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else {
+         di << "Transparency = " << prs->Transparency() << "\n";
+      }
+      return 0;
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+//=======================================================================
+//function : OCC1030_AISColor 
+//purpose  : OCC1030_AISColor (DOC,entry,[color])
+//=======================================================================
+
+static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
+                                     Standard_Integer nb, 
+                                     const char ** arg) 
+{
+  if (nb >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetColor((Quantity_NameOfColor)atoi(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else
+         di << "Color = " << prs->Color() << "\n";
+      return 0; 
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+//=======================================================================
+//function : OCC1031_AISMaterial
+//purpose  : OCC1031_AISMaterial (DOC,entry,[material])
+//=======================================================================
+
+static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
+                                        Standard_Integer nb,
+                                        const char ** arg)
+{
+  if (nb >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else {
+         di << "Material = " << prs->Material() << "\n";
+      }
+      return 0;
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+//=======================================================================
+//function : OCC1032_AISWidth
+//purpose  : OCC1032_AISWidth (DOC,entry,[width])
+//=======================================================================
+
+static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
+                                     Standard_Integer nb, 
+                                     const char ** arg) 
+{
+  if (nb >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetWidth(atof(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else {
+         di << "Width = " << prs->Width() << "\n";
+      }
+      return 0;
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+//=======================================================================
+//function : OCC1033_AISMode
+//purpose  : OCC1033_AISMode (DOC,entry,[mode])
+//=======================================================================
+
+static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
+                                    Standard_Integer nb, 
+                                    const char ** arg) 
+{
+  if (nb >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetMode(atoi(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else {
+         di << "Mode = " << prs->Mode() << "\n";
+      }
+      return 0;
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+//=======================================================================
+//function : OCC1034_AISSelectionMode
+//purpose  : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
+//=======================================================================
+
+static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
+                                             Standard_Integer nb, 
+                                             const char ** arg) 
+{
+  if (nb >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( nb == 4 ) {
+       prs->SetSelectionMode(atoi(arg[3]));
+       TPrsStd_AISViewer::Update(L);
+      }
+      else {
+         di << "SelectionMode = " << prs->SelectionMode() << "\n";
+      }
+      return 0;
+    }
+  }
+  di << arg[0] << " : Error" << "\n";
+  return 1;
+}
+
+#include<BRepAlgoAPI_Cut.hxx>
+#include<BRepAlgo_Cut.hxx>
+//=======================================================================
+//function :  OCC1487
+//purpose  :
+//=======================================================================
+static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  //if(argc != 5) {
+  //  cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
+  //  return -1;
+  //}
+  if(argc < 5 || argc > 6) {
+    di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 6) {
+    Standard_Integer IsB = atoi(argv[5]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
+//      return 1;
+    }
+  }
+
+  Standard_Integer CaseNumber = atoi(argv[1]);
+
+  //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
+  gp_Dir myDir(1,0,0);
+  gp_Pnt myPnt(0,-50,140);
+  gp_Ax2 myAx2(myPnt, myDir);
+  BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
+
+  TopoDS_Shape cyl1 = o_mc1.Shape();
+
+  TopoDS_Shape cyl2;
+  TopoDS_Shape o_cut_shape;
+  if (CaseNumber == 1) {
+    //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(21.65064, -50.0, 127.5),gp_Dir(-sin(M_PI/3), 0.0, 0.5)), 5, 150);
+    gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
+    gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
+    gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
+    BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
+
+    cyl2 = o_mc2.Shape();
+//#if ! defined(BRepAlgoAPI_def01)
+//    o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
+//#else
+//    o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
+//#endif
+    if (IsBRepAlgoAPI) {
+      di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
+      o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
+    } else {
+      di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
+      o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
+    }
+  } else {
+    //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(978.34936, -50.0, 127.5),gp_Dir(sin(M_PI/3), 0.0, 0.5)), 5, 150);
+    gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
+    gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
+    gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
+    BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
+
+    cyl2 = o_mc2.Shape();
+//#if ! defined(BRepAlgoAPI_def01)
+//    o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
+//#else
+//    o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
+//#endif
+    if (IsBRepAlgoAPI) {
+      di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
+      o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
+    } else {
+      di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
+      o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
+    }
+  }
+
+  DBRep::Set(argv[2],cyl1);
+  DBRep::Set(argv[3],cyl2);
+  DBRep::Set(argv[4],o_cut_shape);
+
+  return 0;
+}
+
+#include<TopTools_ListIteratorOfListOfShape.hxx>
+#include<BRepFilletAPI_MakeFillet.hxx>
+//=======================================================================
+//function :  OCC1077
+//purpose  :
+//=======================================================================
+TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
+{
+  Standard_Real t3d = 1.e-4;
+  Standard_Real t2d = 1.e-5;
+  Standard_Real ta  = 1.e-2;
+  Standard_Real fl  = 1.e-3;
+  Standard_Real tapp_angle = 1.e-2;
+  GeomAbs_Shape blend_cont = GeomAbs_C1;
+
+  TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
+
+//#ifdef OCC40 
+//  Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
+//#endif 
+  TopTools_ListIteratorOfListOfShape its;
+
+  TopoDS_Compound result;
+  BRep_Builder B;
+  B.MakeCompound(result);
+
+  TopExp_Explorer ex;
+  for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
+    {
+      const TopoDS_Shape& cutsol = ex.Current();
+
+      BRepFilletAPI_MakeFillet fill(cutsol);
+      fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
+      fill.SetContinuity(blend_cont, tapp_angle);
+//#ifdef OCC40
+//      its = build->Section();
+//#else //OCC40DEV
+      its = aBoolenaOperation.SectionEdges();
+//#endif
+      while (its.More())
+       {
+         TopoDS_Edge E = TopoDS::Edge(its.Value());
+         fill.Add(aRadius, E);
+         its.Next();
+       }
+
+      fill.Build();
+      if (fill.IsDone())
+       {
+         B.Add(result, fill.Shape());
+       }
+      else
+       {
+         B.Add(result, cutsol);
+       }
+    }
+  return result;
+}
+
+TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
+{
+  //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
+  BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
+  return OCC1077_boolbl(aCut,aRadius);
+}
+
+//TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
+//{
+//  return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
+//}
+
+TopoDS_Shape OCC1077_Bug()
+{
+  TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
+  TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
+
+  TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
+  TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
+                                                             gp_Dir(0, 0, 1)), 3, 20).Shape();
+  TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
+                                                             gp_Dir(1, 0, 0)), 3, 20).Shape();
+  TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
+                                                             gp_Dir(0, 1, 0)), 3, 20).Shape();
+  TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
+  Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
+  fixer->Perform();
+  theTmp1 = fixer->Shape();
+  TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
+  fixer->Init(theTmp2);
+  fixer->Perform();
+  theTmp2 = fixer->Shape();
+  TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
+  fixer->Init(theResult);
+  fixer->Perform();
+  theResult = fixer->Shape();
+  return theResult;
+}
+
+static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc < 1 || argc > 2) {
+    di << "Usage : " << argv[0] << " result" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape S = OCC1077_Bug();
+  DBRep::Set(argv[1],S);
+
+  return 0;
+}
+
+//////////////////////////////////////////////////////////////
+/*!
+ * Compute uniform distribution of points using GCPnts_UniformAbscissa
+ */
+//////////////////////////////////////////////////////////////
+static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 4)
+  {
+    di << "Usage : " << argv[0] << " name shape step" << "\n";
+    return 1;
+  }
+  const char *name = argv[1];
+  Adaptor3d_Curve *adapCurve=NULL;
+  Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
+  if (!curve.IsNull())
+    adapCurve = new GeomAdaptor_Curve(curve);
+  else
+  {
+    TopoDS_Shape wire = DBRep::Get(argv[2]);
+    if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
+    {
+      di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
+      return 1;
+    }
+    adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
+  }
+  double step = atof(argv[3]);
+  GCPnts_UniformAbscissa aUni(*adapCurve, step);
+  int res;
+  if (!aUni.IsDone())
+  {
+    di << argv[0] <<" : fail"<<"\n";
+    res = 1;
+  }
+  else
+  {
+    int i, np = aUni.NbPoints();
+    for (i=0; i < np; i++)
+    {
+      double par = aUni.Parameter(i+1);
+      gp_Pnt p = adapCurve->Value(par);
+      char n[20], *pname=n;
+      sprintf(n,"%s_%d",name,i+1);
+      DrawTrSurf::Set(pname,p);
+      di<<pname<<" ";
+    }
+    res = 0;
+  }
+  delete adapCurve;
+  return res;
+}
+
+static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 3)
+  {
+    di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
+    return 1;
+  }
+
+  Standard_Integer nb = atoi(argv[1]);
+  Standard_Integer sz = atoi(argv[2]);
+  Standard_Real val = 10;
+  math_Vector **pv = new math_Vector *[nb];
+
+  di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
+  Standard_Integer i;
+  for (i=0; i < nb; i++) {
+    pv[i] = new math_Vector (1, sz, val);
+    if ((i % (nb/10)) == 0) {
+      di<<" "<<i;
+      //cout.flush();
+      di<<"\n";
+    }
+  }
+  di<<" done"<<"\n";
+  di<<"deleting them ..."<<"\n";
+  for (i=0; i < nb; i++) {
+    delete pv[i];
+    if ((i % (nb/10)) == 0) {
+      di<<" "<<i;
+      //cout.flush();
+      di<<"\n";
+    }
+  }
+  di<<" done"<<"\n";
+
+  delete [] pv;
+
+  return 0;
+}
+
+static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2)
+  {
+    di << "Usage : " << argv[0] << " wire" << "\n";
+    return 1;
+  }
+  TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
+  if (shape.IsNull())
+    return 1;
+  TopoDS_Wire wire = TopoDS::Wire(shape);
+  // create curve parameterised by curvilinear distance
+  BRepAdaptor_CompCurve curve(wire,Standard_True);
+  Standard_Real length = curve.LastParameter();
+  Standard_Real need_length = length/2;
+  gp_Pnt pnt;
+  curve.D0(need_length,pnt);
+  // create check_curve parameterised in a general way
+  BRepAdaptor_CompCurve check_curve(wire);
+  Standard_Real check_par =
+    GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
+  gp_Pnt check_pnt;
+  check_curve.D0(check_par,check_pnt);
+  // check that points are coinsiding
+  Standard_Real error_dist = pnt.Distance(check_pnt);
+  if (error_dist > Precision::Confusion()) {
+    //cout.precision(3);
+    di<<"error_dist = "<<error_dist<<
+      "  ( "<<error_dist/need_length*100<<" %)"<<"\n";
+    return 0;
+  }
+  di<<"OK"<<"\n";
+  return 0;
+}
+
+static char sarr[2000];
+static int si=1;
+static int StackOverflow(int i = -1)
+{
+  char arr[2000];
+  if (si == 1) {
+    si = 0;
+    memcpy(arr,sarr,2000);
+    arr[1999]=0;
+    int n = strlen(arr), s=0;
+    while (n--)
+      s += StackOverflow(i-1);
+    return i + s + StackOverflow(i-1);
+  }
+  else if (i != 0) {
+    return i + StackOverflow(i-1);
+  }
+  si = 1;
+  return i;
+}
+
+#ifdef WNT
+// this code does not work with optimize mode on Windows
+#pragma optimize( "", off )
+#endif
+static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1)
+    {
+      di << "Usage : " << argv[0] << "\n";
+      return 1;
+    }
+  Standard_Boolean Succes;
+  
+  Succes = Standard_True;
+  //OSD::SetSignal();
+
+  {//==== Test Divide ByZero (Integer) ========================================
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Integer) Divide By Zero...";
+      //cout.flush();
+      di << "\n";
+      Standard_Integer res, a =4, b = 0 ;
+      res = a / b;
+      di << " 4 / 0 = " << res << "  Does not Caught... KO"<< "\n";
+      Succes = Standard_False;
+    }
+#if defined(SOLARIS) || defined(WNT)
+    catch(Standard_DivideByZero)
+#else
+    catch(Standard_NumericError)
+#endif
+    {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+#ifndef NO_CXX_EXCEPTION
+    // this case tests if (...) supersedes (Standard_*),
+    // the normal behaviour is not
+    catch(...) {
+      di<<" unknown exception... (But) Ok"<<"\n";
+    }
+#endif
+  }
+
+  {//==== Test Divide ByZero (Real) ===========================================
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Real) Divide By Zero...";
+      //cout.flush();
+      di << "\n";
+      Standard_Real res, a= 4.0, b=0.0;
+      res = a / b;
+      di << " 4.0 / 0.0 = " << res << "  Does not Caught... KO"<< "\n";
+      Succes = Standard_False;
+    }
+#if defined(SOLARIS) || defined(WNT)
+    catch(Standard_DivideByZero)
+#else
+    catch(Standard_NumericError)
+#endif
+    {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+  {//==== Test Overflow (Integer) =============================================
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Integer) Overflow...";
+      //cout.flush();
+      di << "\n";
+      Standard_Integer res, i=IntegerLast();
+      res = i + 1;
+      //++++ cout << " -- "<<res<<"="<<i<<"+1   Does not Caught... KO"<< endl;
+      //++++ Succes = Standard_False;
+      di << " "<<res<<"="<<i<<"+1  Does not Caught... (But) Ok"<< "\n";
+    }
+    catch(Standard_Overflow) {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+  {//==== Test Overflow (Real) ================================================ 
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Real) Overflow...";
+      //cout.flush();
+      di << "\n";
+      Standard_Real res, r=RealLast();
+      res = r * r;
+      
+      sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
+
+      di << "-- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... KO"<< "\n";
+      Succes = Standard_False;
+    }
+#if defined(SOLARIS) || defined(WNT)
+    catch(Standard_Overflow)
+#else
+    catch(Standard_NumericError)
+#endif
+    {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+  {//==== Test Underflow (Real) ===============================================
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Real) Underflow";
+      //cout.flush();
+      di << "\n";
+      Standard_Real res, r=1.0e-308;
+      res = r * r;
+      //res = res + 1.;
+      //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... KO"<<endl;
+      //++++ Succes = Standard_False;
+      di<<" -- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... (But) Ok"<<"\n";
+    }
+#if defined(SOLARIS) || defined(WNT)
+    catch(Standard_Underflow)
+#else
+    catch(Standard_NumericError)
+#endif
+    {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+  {//==== Test Invalid Operation (Real) ===============================================
+    try{
+      OCC_CATCH_SIGNALS
+      di << "(Real) Invalid Operation...";
+      //cout.flush();
+      di << "\n";
+      Standard_Real res, r=-1;
+      res = sqrt(r);
+      di<<" "<<res<<"=sqrt("<<r<<")  Does not Caught... KO"<<"\n";
+      Succes = Standard_False;
+    }
+    catch(Standard_NumericError) {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+  {//==== Test Access Violation ===============================================
+    try {
+      OCC_CATCH_SIGNALS
+      di << "Segmentation Fault...";
+      //cout.flush();
+      di << "\n";
+      int* pint=NULL;
+      *pint = 4;
+      di << "  Does not Caught... KO"<<"\n";
+      Succes = Standard_False;
+    }
+#ifdef WNT
+    catch(OSD_Exception_ACCESS_VIOLATION)
+#else
+    catch(OSD_SIGSEGV)
+#endif
+    {
+      di << " Ok"<< "\n";
+    } catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+
+#ifdef WNT
+  {//==== Test Stack Overflow ===============================================
+    try {
+      OCC_CATCH_SIGNALS
+      di << "Stack Overflow...";
+      //cout.flush();
+      di << "\n";
+      StackOverflow();
+      di << "  Does not Caught... KO"<<"\n";
+      Succes = Standard_False;
+    }
+    catch(OSD_Exception_STACK_OVERFLOW) {
+      di << " Ok"<< "\n";
+    }
+    catch(Standard_Failure) {
+      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
+      di << " Caught (";
+      di << Standard_Failure::Caught()->GetMessageString();
+      di << ")... KO" << "\n";
+      Succes = Standard_False;
+    }
+  }
+#endif
+
+ if(Succes) {
+   di << "TestExcept: Successfull completion" << "\n";
+ } else {
+   di << "TestExcept: failure" << "\n";
+ }
+
+  return 0;
+}
+#ifdef WNT
+#pragma optimize( "", on )
+#endif
+
+static TopoDS_Compound AddTestStructure(int nCount_)
+{
+  BRep_Builder B;
+  int nCount=nCount_;
+  TopoDS_Compound C;
+  B.MakeCompound(C);
+  BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
+  for (int i=0; i<nCount; i++) {
+    for (int j=0; j<nCount; j++) {
+      gp_Trsf trsf;
+      trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
+      TopLoc_Location topLoc(trsf);
+      TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
+      B.Add(C, tempShape);
+    }
+  }
+  return C;
+}
+
+static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  int nCount = 10;
+
+  if (argc > 2)
+    {
+      di << "Usage : " << argv[0] << " [nCount]" << "\n";
+      return 1;
+    }
+
+  if (argc > 1)
+    nCount = atoi(argv[1]);
+  STEPCAFControl_Writer writer;
+  Handle_TDocStd_Document document;
+  document = new TDocStd_Document("Pace Test-StepExporter-");
+  Handle_XCAFDoc_ShapeTool shapeTool;
+  shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
+  shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
+  STEPControl_StepModelType mode = STEPControl_AsIs;
+  if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
+    di << "Failed to set assembly mode for step data\n" << "\n";
+    return 0;
+  }
+  try {
+    OCC_CATCH_SIGNALS
+    if( writer.Transfer(document, mode)) {
+      IFSelect_ReturnStatus stat =
+       writer.Write("TestExportStructure.step");
+    }
+  }
+  catch(OSD_Exception_STACK_OVERFLOW) {
+    di << "Failed : STACK OVERFLOW\n" << "\n";
+  }
+  catch (Standard_Failure) {
+    di << "Failed :\n" << "\n";
+    //cout << Standard_Failure::Caught() << endl;
+    di << Standard_Failure::Caught()->GetMessageString();
+  }
+  di << argv[0] << " : Finish" << "\n";
+  
+  return 0;
+}
+
+static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1)
+    {
+      di << "Usage : " << argv[0] << "\n";
+      return 1;
+    }
+  
+  // 1. Create an array of points
+  Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
+  ap->SetValue(1,gp_Pnt2d(100.0,0.0));
+  ap->SetValue(2,gp_Pnt2d(100.0,100.0));
+  ap->SetValue(3,gp_Pnt2d(0.0,100.0));
+  ap->SetValue(4,gp_Pnt2d(0.0,0.0));
+  ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
+
+  // 2. Create a periodic bspline through these 5 points
+  Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
+  intp.Perform();
+  Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
+
+  // 3. Increase degree of curve from 3 to 8
+  bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
+  Standard_CString CString1 = "BSplineCurve";
+  DrawTrSurf::Set(CString1,bspline1);
+
+  // 4. Convers BSpline curve to Bezier segments
+  Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
+
+  // 5. Test the result of conversion
+  TCollection_AsciiString aRName;
+  for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
+    Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
+    aRName="segment_";
+    aRName=aRName+TCollection_AsciiString(i);
+    Standard_CString aRNameStr = aRName.ToCString();
+    DrawTrSurf::Set(aRNameStr,arc);
+    di << aRNameStr << " ";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 4)
+  {
+    di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
+    return 1;
+  }
+  TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
+  if (theEdge1.IsNull()) {
+    di << "Invalid input shape " << argv[1] << "\n";
+    return 1;
+  }
+  TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
+  if (theEdge2.IsNull()) {
+    di << "Invalid input shape " << argv[2] << "\n";
+    return 1;
+  }
+  TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
+  if (theFace.IsNull()) {
+    di << "Invalid input shape " << argv[3] << "\n";
+    return 1;
+  }
+
+  Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
+
+  Standard_Real aConfusion = Precision::Confusion();
+  Standard_Real aP1first, aP1last, aP2first, aP2last;
+
+  Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
+  Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
+  Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
+  Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
+
+  Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
+
+  Standard_Integer NbPoints = anInter.NbPoints();
+
+  di << "NbPoints = " << NbPoints << "\n" ;
+
+  if (NbPoints > 0) {
+    Standard_Integer i;
+    for (i=1; i<=NbPoints; i++) {
+      gp_Pnt2d aPi = anInter.Point(i);
+      di << "Point.X(" << i << ") = " << aPi.X() << "   " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
+    }
+  }
+
+  Standard_Integer NbSegments = anInter.NbSegments();
+
+  di << "\nNbSegments = " << NbSegments << "\n" ;
+
+  if (NbSegments > 0) {
+    IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
+
+    gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
+    gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
+  
+    Standard_Real aDist = aP1.Distance(aP2);
+  
+    di << "aP1.X() = " << aP1.X() << "   " << "aP1.Y() = " << aP1.Y() << "\n" ;
+    di << "aP2.X() = " << aP2.X() << "   " << "aP2.Y() = " << aP2.Y() << "\n" ;
+
+    di << "Distance = " << aDist << "\n" ;
+
+    di << "Confusion = " << aConfusion << "\n" ;
+
+    if (aDist > aConfusion) {
+      di << "\n" << argv[0] << " Faulty" << "\n" ;
+    } else {
+      di << "\n" << argv[0] << " OK" << "\n" ;
+    }
+  } else {
+    di << "\n" << argv[0] << " OK" << "\n" ;
+  }
+
+  return 0;
+}
+static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 3)
+  {
+    di << "Usage : " << argv[0] << " lower upper" << "\n";
+    return 1;
+  }
+
+  Standard_Integer LOWER = atoi(argv[1]);
+  Standard_Integer UPPER = atoi(argv[2]);
+
+  //! 0. Create an empty document with several test labels
+  Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
+  doc->SetUndoLimit(100);
+  TDF_Label main_label = doc->Main();
+  TDF_Label label1 = main_label.FindChild(1, Standard_True);
+  TDF_Label label2 = main_label.FindChild(2, Standard_True);
+  
+  //! 1. Set/Get OCAF attribute
+  doc->OpenCommand();
+  TDataStd_RealArray::Set(label1, LOWER, UPPER);
+  Handle(TDataStd_RealArray) array;
+  if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) && 
+      array->Lower() == LOWER && array->Upper() == UPPER)
+    cout<<"1: OK"<<endl;
+  else
+  {
+    cout<<"1: Failed.."<<endl;
+    return 1;
+  }
+  doc->CommitCommand();
+
+  //! 2. Set/Get value
+  doc->OpenCommand();
+  Standard_Integer i;
+  for (i = LOWER; i <= UPPER; i++)
+    array->SetValue(i, i);
+  for (i = LOWER; i <= UPPER; i++)
+  {  
+    if (array->Value(i) != i)
+    {
+      cout<<"2: Failed.."<<endl;
+      return 2;
+    }
+  }
+  cout<<"2: OK"<<endl;
+  doc->CommitCommand();
+
+  //! 3. Re-init the array
+  doc->OpenCommand();
+  array->Init(LOWER + 2, UPPER + 4);
+  if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
+  {
+    cout<<"3: Failed.."<<endl;
+    return 3;
+  }
+  for (i = LOWER + 2; i <= UPPER + 4; i++)
+    array->SetValue(i, i);
+  for (i = LOWER + 2; i <= UPPER + 4; i++)
+  {  
+    if (array->Value(i) != i)
+    {
+      cout<<"3: Failed.."<<endl;
+      return 3;
+    }
+  }
+  cout<<"3: OK"<<endl;
+  doc->CommitCommand();
+
+  //! 4. Change array
+  doc->OpenCommand();
+  Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
+  for (i = LOWER + 5; i <= UPPER + 5; i++)
+    arr->SetValue(i, i);
+  array->ChangeArray(arr);
+  for (i = LOWER + 5; i <= UPPER + 5; i++)
+  {  
+    if (array->Value(i) != i)
+    {
+      cout<<"4: Failed.."<<endl;
+      return 4;
+    }
+  }
+  cout<<"4: OK"<<endl;
+  doc->CommitCommand();
+
+  //! 5. Copy the array
+  doc->OpenCommand();
+  TDF_CopyLabel copier(label1, label2);
+  copier.Perform();
+  if (!copier.IsDone())
+  {
+    cout<<"5: Failed.."<<endl;
+    return 5;
+  }
+  Handle(TDataStd_RealArray) array2;
+  if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
+  {
+    cout<<"5: Failed.."<<endl;
+    return 5;
+  }
+  for (i = LOWER + 5; i <= UPPER + 5; i++)
+  {  
+    if (array->Value(i) != i)
+    {
+      cout<<"5: Failed.."<<endl;
+      return 5;
+    }
+  }
+  cout<<"5: OK"<<endl;
+  doc->CommitCommand();
+
+  //! 6. Undo/Redo
+  //! 6.a: undoes the 5th action: the copied array should disappear
+  doc->Undo();
+  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
+      label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
+  {
+    cout<<"6.a: Failed.."<<endl;
+    return 6;
+  }
+  //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
+  doc->Undo();
+  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
+      array->Lower() != LOWER + 2 ||
+      array->Upper() != UPPER + 4)
+  {
+    cout<<"6.b: Failed.."<<endl;
+    return 6;
+  }
+  for (i = LOWER + 2; i <= UPPER + 4; i++)
+  {
+    if (array->Value(i) != i)
+    {
+      cout<<"6.b: Failed.."<<endl;
+      return 6;
+    }
+  }
+  //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
+  doc->Undo();
+  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
+      array->Lower() != LOWER ||
+      array->Upper() != UPPER)
+  {
+    cout<<"6.c: Failed.."<<endl;
+    return 6;
+  }
+  for (i = LOWER; i <= UPPER; i++)
+  {
+    if (array->Value(i) != i)
+    {
+      cout<<"6.c: Failed.."<<endl;
+      return 6;
+    }
+  }
+  //! 6.d: undoes and redoes the 2nd action: no change is expected.
+  doc->Undo();
+  doc->Redo();
+  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
+      array->Lower() != LOWER ||
+      array->Upper() != UPPER)
+  {
+    cout<<"6.d: Failed.."<<endl;
+    return 6;
+  }
+  for (i = LOWER; i <= UPPER; i++)
+  {
+    if (array->Value(i) != i)
+    {
+      cout<<"6.d: Failed.."<<endl;
+      return 6;
+    }
+  }
+  cout<<"6: OK"<<endl;
+
+  //! 7. Re-set the array
+  doc->OpenCommand();
+  array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
+  if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
+  {
+    cout<<"7: Failed.."<<endl;
+    return 7;
+  }
+  for (i = LOWER + 1; i <= UPPER + 1; i++)
+    array->SetValue(i, i);
+  for (i = LOWER + 1; i <= UPPER + 1; i++)
+  {  
+    if (array->Value(i) != i)
+    {
+      cout<<"7: Failed.."<<endl;
+      return 7;
+    }
+  }
+  cout<<"7: OK"<<endl;
+  doc->CommitCommand();
+
+  //! 8.Test of speed: set LOWER and UPPER equal to great integer number and 
+  //! measure the time spent by this test.
+  //! Good luck!
+
+  return 0;
+}
+
+static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Standard_Boolean IsEvenArgc =  Standard_True;
+  if (argc % 2 == 0) {
+    IsEvenArgc =  Standard_True;
+  } else {
+    IsEvenArgc =  Standard_False;
+  }
+
+  if (argc < 3 || IsEvenArgc)
+    {
+      di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
+      return 1;
+    }
+
+  Standard_Integer i, aValue, aPosition;
+  NCollection_Vector<int> vec;
+  for (i = 0; i < argc - 1; i++) {
+    i++;
+    aValue = atoi(argv[i]);
+    aPosition = atoi(argv[i+1]);
+    vec.SetValue(aValue, aPosition);
+  }
+  NCollection_Vector<int>::Iterator it(vec);
+  Standard_Integer j;
+  for (j = 0; it.More(); it.Next(), j++) {
+    //di << it.Value() << "\n";                                               
+    di << j << " " << it.Value() << "\n";                                               
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1) {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+  gp_Pnt point(0.0,0.0,0.0);
+
+  TColgp_Array1OfPnt poles(0,6);
+  poles(0)=point;
+
+  point.SetCoord(1.0,1.0,0.0);
+  poles(1)=point;
+
+  point.SetCoord(2.0,1.0,0.0);
+  poles(2)=point;
+
+  point.SetCoord(3.0,0.0,0.0);
+  poles(3)=point;
+
+  point.SetCoord(4.0,1.0,0.0);
+  poles(4)=point;
+
+  point.SetCoord(5.0,1.0,0.0);
+  poles(5)=point;
+
+  point.SetCoord(6.0,0.0,0.0);
+  poles(6)=point;
+
+  TColStd_Array1OfReal knots(0,2);
+  knots(0)=0.0;
+  knots(1)=0.5;
+  knots(2)=1.0;
+
+  TColStd_Array1OfInteger multi(0,2);
+  multi(0)=4;
+  multi(1)=3;
+  multi(2)=4;
+
+  Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
+
+  //length!! 1.
+  Standard_Real l_abcissa,l_gprop;
+  GeomAdaptor_Curve adaptor_spline(spline);
+  GCPnts_AbscissaPoint temp;
+  l_abcissa=temp.Length(adaptor_spline);
+  cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
+
+  //length!! 2.
+  TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
+  GProp_GProps prop;
+  BRepGProp::LinearProperties(edge,prop);
+  l_gprop=prop.Mass();
+  cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
+
+  cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
+
+  return 0;
+}
+
+static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
+  if(AISContext.IsNull())
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  // ObjectsInside
+  AIS_ListOfInteractive ListOfIO_1;
+  AISContext->ObjectsInside(ListOfIO_1);
+  di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
+  if (!ListOfIO_1.IsEmpty() ) {
+    AIS_ListIteratorOfListOfInteractive iter;
+    for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
+      Handle(AIS_InteractiveObject) aIO=iter.Value();
+      di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
+    }
+  }
+
+  // ObjectsInCollector
+  AIS_ListOfInteractive ListOfIO_2;
+  AISContext->ObjectsInCollector(ListOfIO_2);
+  di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
+  if (!ListOfIO_2.IsEmpty() ) {
+    AIS_ListIteratorOfListOfInteractive iter;
+    for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
+      Handle(AIS_InteractiveObject) aIO=iter.Value();
+      di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
+    }
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ((argc < 9) || (((argc-3) % 3) != 0))
+  {
+    di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
+    return 1;
+  }
+  Standard_Integer i, j, np = (argc-3) / 3;
+  BRepBuilderAPI_MakePolygon W;
+  j = 3;
+  for (i = 1; i <= np; i ++) {
+    W.Add(gp_Pnt(atof(argv[j]),atof(argv[j+1]),atof(argv[j+2])));
+    j += 3;
+  }
+  W.Close();
+  DBRep::Set(argv[1],W.Wire());
+  DBRep::Set(argv[2],W.Edge());
+  return 0;
+}
+
+static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 5) {
+    di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
+    return 1;
+  }
+  gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
+               gp_Dir(1., -1., 0.));
+  gp_GTrsf aTrf;
+  aTrf.SetAffinity (aPln, atof(argv[4]));
+  gp_XYZ aOrigin (atof(argv[1]),atof(argv[2]),atof(argv[3]));
+  gp_XYZ aResult (aOrigin);
+  aTrf.Transforms(aResult);
+  char sbf[512];
+  sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
+          aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
+          aResult.X(), aResult.Y(), aResult.Z());
+  di<<sbf;
+  return 0;
+}
+
+Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 2) {
+    di << "Usage : " << argv[0] << " shape [deflection]\n";
+    return 1;
+  }
+
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+
+  if (aShape.IsNull()) {
+    di<<" Null shape is not allowed";
+    return 1;
+  }
+
+  Standard_Real aDeflection = 0.45110277533;
+  if (argc > 2) {
+    aDeflection = atof(argv[2]);
+  }
+  di<<"deflection="<< aDeflection << "\n";
+
+  BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
+  TopLoc_Location aLocation;
+  Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
+
+  if(aTriang.IsNull()) {
+    di << argv[0] << " : Faulty\n" ;
+  } else {
+    di << argv[0] << " : OK\n" ;
+    di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
+    di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
+  }
+  return 0;
+}
+
+static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 4) {
+    di << "Usage : " << argv[0] << " A B C\n";
+    return 1;
+  }
+  try
+    {
+      gp_Lin2d aLin2d (atof(argv[1]),atof(argv[2]),atof(argv[3]));
+      gp_Pnt2d anOrigin = aLin2d.Location();
+      di << "X_0 = " << anOrigin.X() << "   Y_0 = " << anOrigin.Y() << "\n" ;
+    }
+  catch(Standard_ConstructionError)
+    {
+      di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
+    }
+  return 0;
+}
+
+static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 3) {
+    di << "Usage : " << argv[0] << " file shape\n";
+    return 1;
+  }
+
+  IGESControl_Reader aReader;
+  aReader.ReadFile(argv[1]);
+  aReader.SetReadVisible(Standard_True);
+  aReader.TransferRoots();
+
+  Handle(IGESData_IGESModel) model = aReader.IGESModel();
+  if (model.IsNull()) {
+    di << "model.IsNull()\n";
+    return 1;
+  }
+  Standard_Integer nb = model->NbEntities();
+  for (Standard_Integer i = 1; i <= nb; i ++) {
+    Handle(IGESData_IGESEntity) ent = model->Entity(i);
+    Handle(TCollection_HAsciiString) name;
+    name = ent->NameValue();
+    Standard_CString aStr = name->ToCString();
+    di << "NameValue = " << aStr << "\n";
+  }
+
+  TopoDS_Shape shape = aReader.OneShape();
+  DBRep::Set(argv[2],shape);
+  return 0;
+}
+
+// For OCC16782 testing
+#include <AppStd_Application.hxx>
+#include <TDF_Tool.hxx>
+#include <TColStd_HArray1OfInteger.hxx>
+// Iterators
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfReal.hxx>
+#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
+#include <TDataStd_ListIteratorOfListOfByte.hxx>
+#include <TDF_ListIteratorOfLabelList.hxx>
+// Attributes
+#include <TDataStd_Tick.hxx>
+#include <TDataStd_IntegerList.hxx>
+#include <TDataStd_RealList.hxx>
+#include <TDataStd_ExtStringList.hxx>
+#include <TDataStd_BooleanList.hxx>
+#include <TDataStd_ReferenceList.hxx>
+#include <TDataStd_BooleanArray.hxx>
+#include <TDataStd_ReferenceArray.hxx>
+#include <TDataStd_ByteArray.hxx>
+#include <TDataStd_NamedData.hxx>
+#include <TDF_Reference.hxx>
+//
+Handle(AppStd_Application) app;
+int TestSetGet(const Handle(TDocStd_Document)& doc)
+{
+  // TDataStd_Tick:
+  // Set
+  TDataStd_Tick::Set(doc->Main());
+  // Get
+  Handle(TDataStd_Tick) tick;
+  if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
+    return 1;
+  // Forget
+  doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
+  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 2;
+  doc->Main().ResumeAttribute(tick);
+  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 3;
+  // Forget
+  doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
+  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 2;
+
+  // TDataStd_IntegerList:
+  // Set
+  Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
+  setintlist->Append(2);
+  setintlist->Prepend(1);
+  setintlist->InsertAfter(3, 2);
+  setintlist->InsertBefore(0, 1);
+  setintlist->Append(200);
+  setintlist->Remove(0);
+  setintlist->Remove(200);
+  // Get
+  Handle(TDataStd_IntegerList) getintlist;
+  if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
+    return 1;
+  if (getintlist->First() != 1)
+    return 2;
+  if (getintlist->Last() != 3)
+    return 3;
+  const TColStd_ListOfInteger& intlist = getintlist->List();
+  TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
+  for (; itr_intlist.More(); itr_intlist.Next())
+  {
+    if (itr_intlist.Value() != 1 &&
+       itr_intlist.Value() != 2 &&
+       itr_intlist.Value() != 3)
+    {
+      return 4;
+    }
+  }
+  getintlist->Clear();
+
+  // TDataStd_RealList:
+  // Set
+  Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
+  setdbllist->Append(2.5);
+  setdbllist->Prepend(1.5);
+  setdbllist->InsertAfter(3.5, 2.5);
+  setdbllist->InsertBefore(0.5, 1.5);
+  setdbllist->Append(200.5);
+  setdbllist->Remove(0.5);
+  setdbllist->Remove(200.5);
+  // Get
+  Handle(TDataStd_RealList) getdbllist;
+  if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
+    return 1;
+  if (getdbllist->First() != 1.5)
+    return 2;
+  if (getdbllist->Last() != 3.5)
+    return 3;
+  const TColStd_ListOfReal& dbllist = getdbllist->List();
+  TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
+  for (; itr_dbllist.More(); itr_dbllist.Next())
+  {
+    if (itr_dbllist.Value() != 1.5 &&
+       itr_dbllist.Value() != 2.5 &&
+       itr_dbllist.Value() != 3.5)
+    {
+      return 4;
+    }
+  }
+  getdbllist->Clear();
+
+  // TDataStd_ExtStringList:
+  // Set
+  Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
+  setstrlist->Append("Hello");
+  setstrlist->Prepend("Guten Tag");
+  setstrlist->InsertAfter("Bonjour", "Guten Tag");
+  setstrlist->InsertBefore("Bonsoir", "Hello");
+  setstrlist->Append("Good bye");
+  setstrlist->Remove("Bonsoir");
+  setstrlist->Remove("Good bye");
+  // Get
+  Handle(TDataStd_ExtStringList) getstrlist;
+  if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
+    return 1;
+  if (getstrlist->First() != "Guten Tag")
+    return 2;
+  if (getstrlist->Last() != "Hello")
+    return 3;
+  const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
+  TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
+  for (; itr_strlist.More(); itr_strlist.Next())
+  {
+    if (itr_strlist.Value() != "Guten Tag" &&
+       itr_strlist.Value() != "Bonjour" &&
+       itr_strlist.Value() != "Hello")
+    {
+      return 4;
+    }
+  }
+  getstrlist->Clear();
+
+  // TDataStd_BooleanList:
+  // Set
+  Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
+  setboollist->Append(Standard_True);
+  setboollist->Prepend(Standard_False);
+  // Get
+  Handle(TDataStd_BooleanList) getboollist;
+  if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
+    return 1;
+  if (getboollist->First() != Standard_False)
+    return 2;
+  if (getboollist->Last() != Standard_True)
+    return 3;
+  const TDataStd_ListOfByte& boollist = getboollist->List();
+  TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
+  for (; itr_boollist.More(); itr_boollist.Next())
+  {
+    if (itr_boollist.Value() != Standard_True &&
+       itr_boollist.Value() != Standard_False)
+    {
+      return 4;
+    }
+  }
+  getboollist->Clear();
+
+  // TDataStd_ReferenceList:
+  TDF_Label L1 = doc->Main().FindChild(100);
+  TDF_Label L2 = doc->Main().FindChild(101);
+  TDF_Label L3 = doc->Main().FindChild(102);
+  TDF_Label L4 = doc->Main().FindChild(103);
+  TDF_Label L5 = doc->Main().FindChild(104);
+  // Set
+  Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
+  setreflist->Append(L1);
+  setreflist->Prepend(L2);
+  setreflist->InsertAfter(L3, L2);
+  setreflist->InsertBefore(L4, L1);
+  setreflist->Append(L5);
+  setreflist->Remove(L4);
+  setreflist->Remove(L5);
+  // Get
+  Handle(TDataStd_ReferenceList) getreflist;
+  if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
+    return 1;
+  if (getreflist->First() != L2)
+    return 2;
+  if (getreflist->Last() != L1)
+    return 3;
+  const TDF_LabelList& reflist = getreflist->List();
+  TDF_ListIteratorOfLabelList itr_reflist(reflist);
+  for (; itr_reflist.More(); itr_reflist.Next())
+  {
+    if (itr_reflist.Value() != L1 &&
+       itr_reflist.Value() != L2 &&
+       itr_reflist.Value() != L3)
+    {
+      return 4;
+    }
+  }
+  getreflist->Clear();
+
+  // TDataStd_BooleanArray:
+  // Set
+  Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
+  setboolarr->SetValue(12, Standard_True);
+  setboolarr->SetValue(13, Standard_False);
+  setboolarr->SetValue(14, Standard_False);
+  setboolarr->SetValue(15, Standard_False);
+  setboolarr->SetValue(16, Standard_True);
+  setboolarr->SetValue(14, Standard_True);
+  // Get
+  Handle(TDataStd_BooleanArray) getboolarr;
+  if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
+    return 1;
+  if (getboolarr->Value(12) != Standard_True)
+    return 2;
+  if (getboolarr->Value(13) != Standard_False)
+    return 2;
+  if (getboolarr->Value(14) != Standard_True)
+    return 2;
+  if (getboolarr->Value(15) != Standard_False)
+    return 2;
+  if (getboolarr->Value(16) != Standard_True)
+    return 2;
+
+  // TDataStd_ReferenceArray:
+  // Set
+  Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
+  setrefarr->SetValue(0, L1);
+  setrefarr->SetValue(1, L2);
+  setrefarr->SetValue(2, L3);
+  setrefarr->SetValue(3, L4);
+  setrefarr->SetValue(4, L5);
+  // Get
+  Handle(TDataStd_ReferenceArray) getrefarr;
+  if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
+    return 1;
+  if (getrefarr->Value(0) != L1)
+    return 2;
+  if (getrefarr->Value(1) != L2)
+    return 2;
+  if (getrefarr->Value(2) != L3)
+    return 2;
+  if (getrefarr->Value(3) != L4)
+    return 2;
+  if (getrefarr->Value(4) != L5)
+    return 2;
+
+  // TDataStd_ByteArray:
+  // Set
+  Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
+  setbytearr->SetValue(12, 0);
+  setbytearr->SetValue(13, 1);
+  setbytearr->SetValue(14, 2);
+  setbytearr->SetValue(15, 3);
+  setbytearr->SetValue(16, 255);
+  // Get
+  Handle(TDataStd_ByteArray) getbytearr;
+  if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
+    return 1;
+  if (getbytearr->Value(12) != 0)
+    return 2;
+  if (getbytearr->Value(13) != 1)
+    return 2;
+  if (getbytearr->Value(14) != 2)
+    return 2;
+  if (getbytearr->Value(15) != 3)
+    return 2;
+  if (getbytearr->Value(16) != 255)
+    return 2;
+  
+  // TDataStd_NamedData:
+  // Set:
+  Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
+  setnd->SetInteger("Integer1", 1);
+  setnd->SetInteger("Integer2", 2);
+  setnd->SetInteger("Integer3", 8);
+  setnd->SetInteger("Integer3", 3);
+  // Get:
+  Handle(TDataStd_NamedData) getnd;
+  if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
+    return 1;
+  if (!getnd->HasIntegers())
+    return 2;
+  if (!getnd->HasInteger("Integer1"))
+    return 3;
+  if (getnd->GetInteger("Integer2") != 2)
+    return 4;
+  if (getnd->GetInteger("Integer3") != 3)
+    return 4;
+
+  return 0;
+}
+
+int TestUndoRedo(const Handle(TDocStd_Document)& doc)
+{
+  // TDataStd_Tick:
+  doc->OpenCommand();
+  Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 1;
+  doc->Undo();
+  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 2;
+  doc->Redo();
+  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 3;
+
+  // TDataStd_IntegerList:
+  doc->OpenCommand();
+  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
+  intlist->Append(2);
+  intlist->Prepend(1);
+  intlist->InsertBefore(0, 1);
+  intlist->InsertAfter(3, 2);
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
+    return 1;
+  doc->Undo();
+  if (!intlist->IsEmpty())
+    return 2;
+  doc->Redo();
+  if (!intlist->Extent())
+    return 3;
+  if (intlist->First() != 0)
+    return 4;
+  if (intlist->Last() != 3)
+    return 5;
+  intlist->Clear();
+
+  // TDataStd_RealList:
+  doc->OpenCommand();
+  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
+  dbllist->Append(2.5);
+  dbllist->Prepend(1.5);
+  dbllist->InsertBefore(0.5, 1.5);
+  dbllist->InsertAfter(3.5, 2.5);
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
+    return 1;
+  doc->Undo();
+  if (!dbllist->IsEmpty())
+    return 2;
+  doc->Redo();
+  if (!dbllist->Extent())
+    return 3;
+  if (dbllist->First() != 0.5)
+    return 4;
+  if (dbllist->Last() != 3.5)
+    return 5;
+  dbllist->Clear();
+
+  // TDataStd_ExtStringList:
+  doc->OpenCommand();
+  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
+  strlist->Append("Hello");
+  strlist->Prepend("Guten Tag");
+  strlist->InsertAfter("Bonjour", "Guten Tag");
+  strlist->InsertBefore("Bonsoir", "Hello");
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
+    return 1;
+  doc->Undo();
+  if (!strlist->IsEmpty())
+    return 2;
+  doc->Redo();
+  if (!strlist->Extent())
+    return 3;
+  if (strlist->First() != "Guten Tag")
+    return 4;
+  if (strlist->Last() != "Hello")
+    return 5;
+  strlist->Clear();
+
+  // TDataStd_BooleanList:
+  doc->OpenCommand();
+  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
+  boollist->Append(Standard_True);
+  boollist->Prepend(Standard_False);
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
+    return 1;
+  doc->Undo();
+  if (!boollist->IsEmpty())
+    return 2;
+  doc->Redo();
+  if (!boollist->Extent())
+    return 3;
+  if (boollist->First() != Standard_False)
+    return 4;
+  if (boollist->Last() != Standard_True)
+    return 5;
+  boollist->Clear();
+
+  // TDataStd_ReferenceList:
+  TDF_Label L1 = doc->Main().FindChild(100);
+  TDF_Label L2 = doc->Main().FindChild(101);
+  TDF_Label L3 = doc->Main().FindChild(102);
+  TDF_Label L4 = doc->Main().FindChild(103);
+  doc->OpenCommand();
+  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
+  reflist->Append(L1);
+  reflist->Prepend(L2);
+  reflist->InsertBefore(L3, L1);
+  reflist->InsertAfter(L4, L2);
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
+    return 1;
+  doc->Undo();
+  if (!reflist->IsEmpty())
+    return 2;
+  doc->Redo();
+  if (!reflist->Extent())
+    return 3;
+  if (reflist->First() != L2)
+    return 4;
+  if (reflist->Last() != L1)
+    return 5;
+  reflist->Clear();
+
+  // TDataStd_BooleanArray:
+  doc->OpenCommand();
+  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
+  boolarr->SetValue(23, Standard_True);
+  boolarr->SetValue(25, Standard_True);
+  doc->CommitCommand();
+  doc->OpenCommand();
+  boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
+  boolarr->SetValue(230, Standard_True);
+  boolarr->SetValue(250, Standard_True);  
+  doc->CommitCommand();
+  doc->Undo();
+  if (boolarr->Value(23) != Standard_True)
+    return 2;
+  if (boolarr->Value(24) != Standard_False)
+    return 2;
+  if (boolarr->Value(25) != Standard_True)
+    return 2;
+  doc->Redo();
+  if (boolarr->Value(230) != Standard_True)
+    return 3;
+  if (boolarr->Value(240) != Standard_False)
+    return 3;
+  if (boolarr->Value(250) != Standard_True)
+    return 3;
+
+  // TDataStd_ReferenceArray:
+  doc->OpenCommand();
+  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
+  refarr->SetValue(5, L1);
+  refarr->SetValue(6, L2);
+  refarr->SetValue(7, L3);
+  refarr->SetValue(8, L4);
+  doc->CommitCommand();
+  if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
+    return 1;
+  doc->Undo();
+  doc->Redo();
+  if (refarr->Value(5) != L1)
+    return 4;
+  if (refarr->Value(6) != L2)
+    return 4;
+  if (refarr->Value(7) != L3)
+    return 4;
+  if (refarr->Value(8) != L4)
+    return 4;
+
+  // TDataStd_ByteArray:
+  doc->OpenCommand();
+  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
+  bytearr->SetValue(23, 23);
+  bytearr->SetValue(25, 25);
+  doc->CommitCommand();
+  doc->OpenCommand();
+  bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
+  bytearr->SetValue(230, 230);
+  bytearr->SetValue(250, 250);  
+  doc->CommitCommand();
+  doc->Undo();
+  if (bytearr->Value(23) != 23)
+    return 2;
+  if (bytearr->Value(25) != 25)
+    return 2;
+  doc->Redo();
+  if (bytearr->Value(230) != 230)
+    return 3;
+  if (bytearr->Value(250) != 250)
+    return 3;
+
+  // TDataStd_NamedData:
+  doc->OpenCommand();
+  Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
+  nd->SetByte("b14", 12);
+  nd->SetByte("b17", 18);
+  nd->SetByte("b14", 14);
+  nd->SetByte("b17", 17);
+  doc->CommitCommand();
+  doc->OpenCommand();
+  nd = TDataStd_NamedData::Set(doc->Main());
+  nd->SetReal("r14", 14);
+  nd->SetReal("r17", 17);
+  nd->SetReal("r14", 14.4);
+  nd->SetReal("r17", 17.7);
+  doc->CommitCommand();
+  doc->Undo();
+  if (nd->HasStrings())
+    return 1;
+  if (nd->HasReals())
+    return 1;
+  if (nd->HasReal("r17"))
+    return 2;
+  if (!nd->HasBytes())
+    return 3;
+  if (nd->GetByte("b14") != 14)
+    return 4;
+  if (nd->GetByte("b17") != 17)
+    return 4;
+  if (nd->HasByte("b18"))
+    return 5;
+  doc->Redo();
+  if (!nd->HasBytes())
+    return 1;
+  if (!nd->HasReals())
+    return 1;
+  if (nd->GetByte("b14") != 14)
+    return 2;
+  if (nd->GetReal("r14") != 14.4)
+    return 2;
+  if (nd->GetReal("r17") != 17.7)
+    return 2;
+
+  return 0;
+}
+
+int TestCopyPaste(const Handle(TDocStd_Document)& doc)
+{
+  TDF_Label L1 = doc->Main().FindChild(1);
+  TDF_Label L2 = doc->Main().FindChild(2);
+  TDF_CopyLabel copier(L1, L2);
+
+  // TDataStd_Tick:
+  TDataStd_Tick::Set(L1);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  if (!L2.IsAttribute(TDataStd_Tick::GetID()))
+    return 2;
+
+  // TDataStd_IntegerList:
+  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
+  intlist->Append(1);
+  intlist->InsertAfter(2, 1);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  intlist->Clear();
+  intlist.Nullify();
+  if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
+    return 2;
+  if (intlist->First() != 1)
+    return 3;
+  if (intlist->Last() != 2)
+    return 4;
+  intlist->Clear();
+
+  // TDataStd_RealList:
+  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
+  dbllist->Append(1.5);
+  dbllist->InsertAfter(2.5, 1.5);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  dbllist->Clear();
+  dbllist.Nullify();
+  if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
+    return 2;
+  if (dbllist->First() != 1.5)
+    return 3;
+  if (dbllist->Last() != 2.5)
+    return 4;
+  dbllist->Clear();
+
+  // TDataStd_ExtStringList:
+  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
+  strlist->Append("Open CASCADE");
+  strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  strlist->Clear();
+  strlist.Nullify();
+  if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
+    return 2;
+  if (strlist->First() != "Open CASCADE")
+    return 3;
+  if (strlist->Last() != " - is the best set of libraries!")
+    return 4;
+  strlist->Clear();
+
+  // TDataStd_BooleanList:
+  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
+  boollist->Append(Standard_True);
+  boollist->Prepend(Standard_False);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  boollist->Clear();
+  boollist.Nullify();
+  if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
+    return 2;
+  if (boollist->First() != Standard_False)
+    return 3;
+  if (boollist->Last() != Standard_True)
+    return 4;
+  boollist->Clear();
+
+  // TDataStd_ReferenceList:
+  TDF_Label L100 = doc->Main().FindChild(100);
+  TDF_Label L101 = doc->Main().FindChild(101);
+  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
+  reflist->Append(L100);
+  reflist->InsertAfter(L101, L100);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  reflist->Clear();
+  reflist.Nullify();
+  if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
+    return 2;
+  if (reflist->First() != L100)
+    return 3;
+  if (reflist->Last() != L101)
+    return 4;
+  reflist->Clear();
+
+  // TDataStd_BooleanArray:
+  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
+  boolarr->SetValue(4, Standard_True);
+  boolarr->SetValue(6, Standard_True);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  boolarr.Nullify();
+  if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
+    return 2;
+  if (boolarr->Value(4) != Standard_True)
+    return 3;
+  if (boolarr->Value(5) != Standard_False)
+    return 3;
+  if (boolarr->Value(6) != Standard_True)
+    return 3;
+
+  // TDataStd_ReferenceArray:
+  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
+  refarr->SetValue(3, L100);
+  refarr->SetValue(4, L101);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  refarr.Nullify();
+  if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
+    return 2;
+  if (refarr->Value(3) != L100)
+    return 3;
+  if (refarr->Value(4) != L101)
+    return 3;
+
+  // TDataStd_ByteArray:
+  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
+  bytearr->SetValue(4, 40);
+  bytearr->SetValue(6, 60);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  bytearr.Nullify();
+  if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
+    return 2;
+  if (bytearr->Value(4) != 40)
+    return 3;
+  if (bytearr->Value(6) != 60)
+    return 3;
+
+  // TDataStd_NamedData:
+  Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
+  nd->SetInteger("Integer1", 11);
+  nd->SetReal("Real1", 11.1);
+  nd->SetString("String1", "11.11111111");
+  nd->SetByte("Byte1", 111);
+  Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
+  ints_arr->SetValue(4, 4);
+  ints_arr->SetValue(5, 5);
+  nd->SetArrayOfIntegers("Integers1", ints_arr);
+  copier.Perform();
+  if (!copier.IsDone())
+    return 1;
+  nd.Nullify();
+  if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
+    return 2;
+  if (!nd->HasIntegers())
+    return 3;
+  if (!nd->HasReals())
+    return 3;
+  if (!nd->HasStrings())
+    return 3;
+  if (!nd->HasBytes())
+    return 3;
+  if (!nd->HasArraysOfIntegers())
+    return 3;
+  if (nd->HasArraysOfReals())
+    return 3;
+  if (!nd->HasInteger("Integer1"))
+    return 4;
+  if (nd->GetInteger("Integer1") != 11)
+    return 4;
+  if (!nd->HasReal("Real1"))
+    return 4;
+  if (nd->GetReal("Real1") != 11.1)
+    return 4;
+  if (!nd->HasString("String1"))
+    return 4;
+  if (nd->GetString("String1") != "11.11111111")
+    return 4;
+  if (!nd->HasByte("Byte1"))
+    return 4;
+  if (nd->GetByte("Byte1") != 111)
+    return 4;
+  if (!nd->HasArrayOfIntegers("Integers1"))
+    return 4;
+  const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
+  if (ints_arr_out.IsNull())
+    return 4;
+  if (ints_arr_out->Value(5) != 5)
+    return 4;
+
+  return 0;
+}
+
+int TestOpenSave(TCollection_ExtendedString aFile1,
+                TCollection_ExtendedString aFile2,
+                TCollection_ExtendedString aFile3)
+{
+  // Std
+  Handle(TDocStd_Document) doc_std, doc_std_open;
+  app->NewDocument("MDTV-Standard", doc_std);
+  // TDataStd_Tick:
+  TDataStd_Tick::Set(doc_std->Main());
+  // TDataStd_IntegerList:
+  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
+  intlist->Append(1);
+  intlist->Append(5);
+  // TDataStd_RealList:
+  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
+  dbllist->Append(1.5);
+  dbllist->Append(5.5);
+  // TDataStd_ExtStringList:
+  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
+  strlist->Append("Auf");
+  strlist->Append("Wiedersehen");
+  // TDataStd_BooleanList:
+  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
+  boollist->Append(Standard_False);
+  boollist->Append(Standard_True);
+  // TDataStd_ReferenceList:
+  TCollection_AsciiString entry1, entry2, entry_first, entry_last;
+  TDF_Label Lstd1 = doc_std->Main().FindChild(100);
+  TDF_Tool::Entry(Lstd1, entry1);
+  TDF_Label Lstd2 = doc_std->Main().FindChild(101);
+  TDF_Tool::Entry(Lstd2, entry2);
+  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
+  reflist->Append(Lstd1);
+  reflist->Append(Lstd2);
+  // TDataStd_BooleanArray:
+  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
+  boolarr->SetValue(15, Standard_False);
+  boolarr->SetValue(16, Standard_True);
+  boolarr->SetValue(17, Standard_True);
+  boolarr->SetValue(18, Standard_True);
+  // TDataStd_ReferenceArray:
+  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
+  refarr->SetValue(45, Lstd1);
+  refarr->SetValue(46, Lstd2);
+  // TDataStd_ByteArray:
+  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
+  bytearr->SetValue(15, 150);
+  bytearr->SetValue(16, 160);
+  bytearr->SetValue(17, 170);
+  bytearr->SetValue(18, 180);
+  // TDataStd_NamedData:
+  Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
+  // TDF_Reference:
+  TDF_Label Lstd3 = doc_std->Main().FindChild(103);
+  Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
+  // 
+  // Save
+  //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
+  if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
+    return 1;
+  intlist.Nullify();
+  dbllist.Nullify();
+  strlist.Nullify();
+  boollist.Nullify();
+  reflist.Nullify();
+  boolarr.Nullify();
+  ref.Nullify();
+  app->Close(doc_std);
+  doc_std.Nullify();
+  //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
+  if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
+    return 2;
+  if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 3;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
+    return 4;
+  if (intlist->First() != 1)
+    return 5;
+  if (intlist->Last() != 5)
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
+    return 4;
+  if (dbllist->First() != 1.5)
+    return 5;
+  if (dbllist->Last() != 5.5)
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
+    return 4;
+  if (strlist->First() != "Auf")
+    return 5;
+  if (strlist->Last() != "Wiedersehen")
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
+    return 4;
+  if (boollist->First() != Standard_False)
+    return 5;
+  if (boollist->Last() != Standard_True)
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
+    return 4;
+  TDF_Tool::Entry(reflist->First(), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(reflist->Last(), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
+    return 4;
+  if (boolarr->Value(15) != Standard_False)
+    return 5;
+  if (boolarr->Value(16) != Standard_True)
+    return 5;
+  if (boolarr->Value(17) != Standard_True)
+    return 5;
+  if (boolarr->Value(18) != Standard_True)
+    return 5;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
+    return 4;
+  TDF_Tool::Entry(refarr->Value(45), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(refarr->Value(46), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
+    return 4;
+  if (bytearr->Value(15) != 150)
+    return 5;
+  if (bytearr->Value(16) != 160)
+    return 5;
+  if (bytearr->Value(17) != 170)
+    return 5;
+  if (bytearr->Value(18) != 180)
+    return 5;
+  if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
+    return 4;
+  if (ref->Get().IsNull())
+    return 5;
+  if (ref->Get().Tag() != 103)
+      return 5;
+
+  // Xml
+  Handle(TDocStd_Document) doc_xml, doc_xml_open;
+  app->NewDocument("XmlOcaf", doc_xml);
+  // TDataStd_Tick:
+  TDataStd_Tick::Set(doc_xml->Main());
+  // TDataStd_IntegerList:
+  intlist = TDataStd_IntegerList::Set(doc_xml->Main());
+  intlist->Append(1);
+  intlist->Append(5);
+  // TDataStd_RealList:
+  dbllist = TDataStd_RealList::Set(doc_xml->Main());
+  dbllist->Append(1.5);
+  dbllist->Append(5.5);
+  // TDataStd_ExtStringList:
+  strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
+  strlist->Append("Guten ");
+  strlist->Append("Tag");
+  // TDataStd_BooleanList:
+  boollist = TDataStd_BooleanList::Set(doc_xml->Main());
+  boollist->Append(Standard_False);
+  boollist->Append(Standard_True);
+  // TDataStd_ReferenceList:
+  TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
+  TDF_Tool::Entry(Lxml1, entry1);
+  TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
+  TDF_Tool::Entry(Lxml2, entry2);
+  reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
+  reflist->Append(Lxml1);
+  reflist->Append(Lxml2);
+  // TDataStd_BooleanArray:
+  boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
+  boolarr->SetValue(15, Standard_False);
+  boolarr->SetValue(16, Standard_True);
+  boolarr->SetValue(17, Standard_True);
+  boolarr->SetValue(18, Standard_True);
+  boolarr->SetValue(19, Standard_True);
+  boolarr->SetValue(20, Standard_True);
+  boolarr->SetValue(21, Standard_False);
+  boolarr->SetValue(22, Standard_True);
+  boolarr->SetValue(23, Standard_True);
+  boolarr->SetValue(24, Standard_True);
+  // TDataStd_ReferenceArray:
+  refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
+  refarr->SetValue(444, Lxml1);
+  refarr->SetValue(445, Lxml2);
+  // TDataStd_ByteArray:
+  bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
+  bytearr->SetValue(15, 0);
+  bytearr->SetValue(16, 10);
+  bytearr->SetValue(17, 100);
+  bytearr->SetValue(18, 200);
+  bytearr->SetValue(19, 250);
+  bytearr->SetValue(20, 251);
+  bytearr->SetValue(21, 252);
+  bytearr->SetValue(22, 253);
+  bytearr->SetValue(23, 254);
+  bytearr->SetValue(24, 255);
+  // TDF_Reference:
+  Lstd3 = doc_xml->Main().FindChild(103);
+  ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
+  // 
+  // Save
+  //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
+  if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
+    return 1;
+  intlist.Nullify();
+  ref.Nullify();
+  app->Close(doc_xml);
+  doc_xml.Nullify();
+  //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
+  if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
+    return 2;
+  if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 3;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
+    return 4;
+  if (intlist->First() != 1)
+    return 5;
+  if (intlist->Last() != 5)
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
+    return 4;
+  if (dbllist->First() != 1.5)
+    return 5;
+  if (dbllist->Last() != 5.5)
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
+    return 4;
+  if (strlist->First() != "Guten ")
+    return 5;
+  if (strlist->Last() != "Tag")
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
+    return 4;
+  if (boollist->First() != Standard_False)
+    return 5;
+  if (boollist->Last() != Standard_True)
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
+    return 4;
+  TDF_Tool::Entry(reflist->First(), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(reflist->Last(), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
+    return 4;
+  if (boolarr->Value(15) != Standard_False)
+    return 5;
+  if (boolarr->Value(16) != Standard_True)
+    return 5;
+  if (boolarr->Value(17) != Standard_True)
+    return 5;
+  if (boolarr->Value(18) != Standard_True)
+    return 5;
+  if (boolarr->Value(19) != Standard_True)
+    return 5;
+  if (boolarr->Value(20) != Standard_True)
+    return 5;
+  if (boolarr->Value(21) != Standard_False)
+    return 5;
+  if (boolarr->Value(22) != Standard_True)
+    return 5;
+  if (boolarr->Value(23) != Standard_True)
+    return 5;
+  if (boolarr->Value(24) != Standard_True)
+    return 5;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
+    return 4;
+  TDF_Tool::Entry(refarr->Value(444), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(refarr->Value(445), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
+    return 4;
+  if (bytearr->Value(15) != 0)
+    return 5;
+  if (bytearr->Value(16) != 10)
+    return 5;
+  if (bytearr->Value(17) != 100)
+    return 5;
+  if (bytearr->Value(18) != 200)
+    return 5;
+  if (bytearr->Value(19) != 250)
+    return 5;
+  if (bytearr->Value(20) != 251)
+    return 5;
+  if (bytearr->Value(21) != 252)
+    return 5;
+  if (bytearr->Value(22) != 253)
+    return 5;
+  if (bytearr->Value(23) != 254)
+    return 5;
+  if (bytearr->Value(24) != 255)
+    return 5;
+  if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
+    return 4;
+  if (ref->Get().IsNull())
+    return 5;
+  if (ref->Get().Tag() != 103)
+      return 5;
+
+  // Bin
+  Handle(TDocStd_Document) doc_bin, doc_bin_open;
+  app->NewDocument("BinOcaf", doc_bin);
+  // TDataStd_Tick:
+  TDataStd_Tick::Set(doc_bin->Main());
+  // TDataStd_IntegerList:
+  intlist = TDataStd_IntegerList::Set(doc_bin->Main());
+  intlist->Append(1);
+  intlist->Append(5);
+  // TDataStd_RealList:
+  dbllist = TDataStd_RealList::Set(doc_bin->Main());
+  dbllist->Append(1.5);
+  dbllist->Append(5.5);
+  // TDataStd_ExtStringList:
+  strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
+  strlist->Append("Bonjour");
+  strlist->Append("Bonsoir");
+  // TDataStd_BooleanList:
+  boollist = TDataStd_BooleanList::Set(doc_bin->Main());
+  boollist->Append(Standard_False);
+  boollist->Append(Standard_True);
+  // TDataStd_ReferenceList:
+  TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
+  TDF_Tool::Entry(Lbin1, entry1);
+  TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
+  TDF_Tool::Entry(Lbin2, entry2);
+  reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
+  reflist->Append(Lbin1);
+  reflist->Append(Lbin2);
+  // TDataStd_BooleanArray:
+  boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
+  boolarr->SetValue(15, Standard_False);
+  boolarr->SetValue(16, Standard_True);
+  boolarr->SetValue(17, Standard_True);
+  boolarr->SetValue(18, Standard_True);
+  boolarr->SetValue(19, Standard_True);
+  boolarr->SetValue(20, Standard_True);
+  boolarr->SetValue(21, Standard_False);
+  boolarr->SetValue(22, Standard_True);
+  boolarr->SetValue(23, Standard_True);
+  boolarr->SetValue(24, Standard_True);
+  // TDataStd_ReferenceArray:
+  refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
+  refarr->SetValue(0, Lbin1);
+  refarr->SetValue(1, Lbin2);
+  // TDataStd_ByteArray:
+  bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
+  bytearr->SetValue(15, 0);
+  bytearr->SetValue(16, 255);
+  // TDataStd_NamedData:
+  nameddata = TDataStd_NamedData::Set(doc_bin->Main());
+  nameddata->SetByte("A", 12);
+  nameddata->SetByte("B", 234);
+  // TDF_Reference:
+  Lstd3 = doc_bin->Main().FindChild(103);
+  ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
+  // 
+  // Save
+  //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
+  if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
+    return 1;
+  intlist.Nullify();
+  ref.Nullify();
+  app->Close(doc_bin);
+  doc_bin.Nullify();
+  //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
+  if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
+    return 2;
+  if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
+    return 3;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
+    return 4;
+  if (intlist->First() != 1)
+    return 5;
+  if (intlist->Last() != 5)
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
+    return 4;
+  if (dbllist->First() != 1.5)
+    return 5;
+  if (dbllist->Last() != 5.5)
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
+    return 4;
+  if (strlist->First() != "Bonjour")
+    return 5;
+  if (strlist->Last() != "Bonsoir")
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
+    return 4;
+  if (boollist->First() != Standard_False)
+    return 5;
+  if (boollist->Last() != Standard_True)
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
+    return 4;
+  TDF_Tool::Entry(reflist->First(), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(reflist->Last(), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
+    return 4;
+  if (boolarr->Value(15) != Standard_False)
+    return 5;
+  if (boolarr->Value(16) != Standard_True)
+    return 5;
+  if (boolarr->Value(17) != Standard_True)
+    return 5;
+  if (boolarr->Value(18) != Standard_True)
+    return 5;
+  if (boolarr->Value(19) != Standard_True)
+    return 5;
+  if (boolarr->Value(20) != Standard_True)
+    return 5;
+  if (boolarr->Value(21) != Standard_False)
+    return 5;
+  if (boolarr->Value(22) != Standard_True)
+    return 5;
+  if (boolarr->Value(23) != Standard_True)
+    return 5;
+  if (boolarr->Value(24) != Standard_True)
+    return 5;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
+    return 4;
+  TDF_Tool::Entry(refarr->Value(0), entry_first);
+  if (entry1 != entry_first)
+    return 5;
+  TDF_Tool::Entry(refarr->Value(1), entry_last);
+  if (entry2 != entry_last)
+    return 6;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
+    return 4;
+  if (bytearr->Value(15) != 0)
+    return 5;
+  if (bytearr->Value(16) != 255)
+    return 5;
+  if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
+    return 4;
+  if (nameddata->GetByte("A") != 12)
+    return 5;
+  if (nameddata->GetByte("B") != 234)
+    return 5;
+  if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
+    return 4;
+  if (ref->Get().IsNull())
+    return 5;
+  if (ref->Get().Tag() != 103)
+      return 5;
+
+  return 0;
+}
+// For OCC16782 testing
+
+static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 4)
+  {
+    di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
+    return 1;
+  }
+  TCollection_ExtendedString aFile1(argv[1]);
+  TCollection_ExtendedString aFile2(argv[2]);
+  TCollection_ExtendedString aFile3(argv[3]);
+
+  if (app.IsNull())
+    app = new AppStd_Application();
+
+  int good = 0;
+  
+  Handle(TDocStd_Document) doc;
+  app->NewDocument("MDTV-Standard", doc);
+  doc->SetUndoLimit(10);
+
+  di <<"\nTestSetGet start\n";
+  good += TestSetGet(doc);
+  di <<"TestSetGet finish\n";
+  di <<"Status = " << good << "\n";
+
+  di <<"\nTestUndoRedo start\n";
+  good += TestUndoRedo(doc);
+  di <<"TestUndoRedo finish\n";
+  di <<"Status = " << good << "\n";
+
+  di <<"\nTestCopyPaste start\n";
+  good += TestCopyPaste(doc);
+  di <<"TestCopyPaste finish\n";
+  di <<"Status = " << good << "\n";
+
+  di <<"\nTestOpenSave start\n";
+  good += TestOpenSave(aFile1, aFile2, aFile3);
+  di <<"TestOpenSave finish\n";
+  di <<"Status = " << good << "\n";
+
+  if (!good)
+    di <<"\nThe " << argv[0] << " test is passed well, OK\n";
+  else
+    di <<"\nThe " << argv[0] << " test failed, Faulty\n";
+
+  return 0;
+}
+
+static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
+    return -1;
+  }
+
+  if (argc > 2)
+  {
+    di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
+    return 1;
+  }
+  Standard_Integer mode = 0;
+  if (argc == 2)
+  {
+    mode = atoi(argv[1]);
+  }
+  if (mode > 2 || mode < 0)
+  {
+    di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
+    return 1;
+  }
+  Handle(V3d_View) V = ViewerTest::CurrentView();
+  if ( !V.IsNull() ) {
+    if (mode == 0) {
+      V->ColorScaleDisplay();
+    }
+    if (mode == 1) {
+      V->ColorScaleErase();
+      V->UpdateLights();
+      V->Update();
+    }
+    if (mode == 2) {
+      Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
+      if (IsDisplayed)
+       di <<"ColorScaleIsDisplayed = " << "1" << "\n";
+      else
+       di <<"ColorScaleIsDisplayed = " << "0" << "\n";
+    }
+  }
+  return 0;
+}
+
+#include <Interface_Macros.hxx>
+#include <IGESControl_Controller.hxx>
+#include <XSDRAW.hxx>
+#include <Draw_ProgressIndicator.hxx>
+#include <XSControl_WorkSession.hxx>
+#include <Transfer_TransientProcess.hxx>
+#include <XSDRAW_Commands.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <Message_ProgressSentry.hxx>
+#include <XSControl_TransferReader.hxx>
+
+static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
+{
+  DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
+  if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
+
+  // Progress indicator
+  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
+  progress->SetScale ( 0, 100, 1 );
+  progress->Show();
+  IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
+  if (ctl.IsNull())
+    ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
+
+  TCollection_AsciiString fnom,rnom;
+
+  Standard_Boolean modfic = XSDRAW::FileAndVar
+    (argv[1],argv[2],"IGESBREP",fnom,rnom);
+  if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
+  else        di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
+  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
+  IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
+
+#ifdef CHRONOMESURE
+  OSD_Timer Chr; Chr.Reset();
+  IDT_SetLevel(3);
+#endif
+
+
+// Reading the file
+  progress->NewScope ( 20, "Loading" ); // On average loading takes 20% 
+  progress->Show();
+
+  // *New* 
+  //In order to decrease number of produced edges during translation it is possible to set following parameter
+  Interface_Static::SetIVal("read.iges.bspline.continuity",0);
+  // *New* 
+
+  if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
+  else  if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
+
+  progress->EndScope();
+  progress->Show();
+
+  if (readstat != IFSelect_RetDone) {
+    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
+    else di<<"No model loaded"<<"\n";
+    return 1;
+  }
+// Choice of treatment
+  Standard_Boolean fromtcl = (argc > 3);
+  Standard_Integer modepri = 1, nent, nbs;
+  if (fromtcl) modepri = 4;
+
+  while (modepri) {
+    //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka 
+    //mode OnlyVisible does not work.
+    // nent = Reader.NbRootsForTransfer();
+    if (!fromtcl) {
+      cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
+      modepri = -1;
+      
+// amv 26.09.2003 : this is used to avoid error of enter's simbol        
+      char str[80];                                                             
+      cin>>str;                                                                 
+      modepri = atoi(str);   
+    }
+
+    if (modepri == 0) {  //fin
+      di << "Bye and good luck! " << "\n";
+      break;
+    } 
+
+    else if (modepri <= 2) {  // 1 : Visible Roots, 2 : All Roots
+      di << "All Geometry Transfer"<<"\n";
+      di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
+      di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
+      Handle(XSControl_WorkSession) thesession = Reader.WS();
+      thesession->ClearContext();
+      XSDRAW::SetTransferProcess (thesession->MapReader());
+      progress->NewScope ( 80, "Translation" );
+      progress->Show();
+      thesession->MapReader()->SetProgress ( progress );
+      
+      if (modepri == 1) Reader.SetReadVisible (Standard_True);
+      Reader.TransferRoots();
+      
+      thesession->MapReader()->SetProgress ( 0 );
+      progress->EndScope();
+      progress->Show();
+      // result in only one shape for all the roots
+      //        or in one shape for one root.
+      di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
+      Standard_Integer answer = 1;
+      if (Reader.NbShapes() > 1) {
+       cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
+        answer = -1;
+        //amv 26.09.2003                                                        
+        char str_a[80];                                                         
+        cin >> str_a;                                                           
+        answer = atoi(str_a);    
+      }
+      if ( answer == 0) continue;
+      if ( answer == 1 || answer == 3) {
+       TopoDS_Shape shape = Reader.OneShape();
+       // save the shape
+       if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
+       char fname[110];
+       sprintf(fname, "%s", rnom.ToCString());
+       di << "Saving shape in variable Draw : " << fname << "\n";
+       if (answer == 3) IGESToBRep::WriteShape (shape,1);
+       try {
+         OCC_CATCH_SIGNALS
+         DBRep::Set(fname,shape);
+       }
+       catch(Standard_Failure) {
+         di << "** Exception : ";
+         di << Standard_Failure::Caught()->GetMessageString();
+         di<<" ** Skip"<<"\n";
+         di << "Saving shape in variable Draw : " << fname << "\n";
+         IGESToBRep::WriteShape (shape,1);
+       }
+      }
+       
+      else if (answer == 2 || answer == 4) {
+       Standard_Integer numshape = Reader.NbShapes();
+       for (Standard_Integer inum = 1; inum <= numshape; inum++) {
+         // save all the shapes
+         TopoDS_Shape shape = Reader.Shape(inum);
+         if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
+         char fname[110];
+         sprintf(fname, "%s_%d", rnom.ToCString(),inum);
+         di << "Saving shape in variable Draw : " << fname << "\n";
+         if (answer == 4) IGESToBRep::WriteShape (shape,inum);
+         try {
+           OCC_CATCH_SIGNALS
+           DBRep::Set(fname,shape);
+         }
+         catch(Standard_Failure) {
+           di << "** Exception : ";
+           di << Standard_Failure::Caught()->GetMessageString();
+           di<<" ** Skip"<<"\n";
+         }
+       }
+      }
+      else return 0;
+    }
+
+    else if (modepri == 3) {  // One Entity
+      cout << "Only One Entity"<<endl;
+      cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
+      cout<<"  To modify : command  param read.iges.bspline.continuity"<<endl;
+      cout << " give the number of the Entity : " << flush;
+      nent = XSDRAW::GetEntityNumber();
+
+      if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
+      else {
+       nbs = Reader.NbShapes();
+       char shname[30];  sprintf (shname,"%s_%d",rnom.ToCString(),nent);
+       di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
+       di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
+       TopoDS_Shape sh = Reader.Shape(nbs);
+       DBRep::Set (shname,sh);
+      }
+    }
+
+    else if (modepri == 4) {   // Selection
+      Standard_Integer answer = 1;
+      Handle(TColStd_HSequenceOfTransient)  list;
+
+//  Selection, nommee ou via tcl. tcl : raccourcis admis
+//   * donne iges-visible + xst-transferrable-roots
+//   *r donne xst-model-roots (TOUTES racines)
+
+      if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {         
+        di << "All Geometry Transfer"<<"\n";
+        di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
+        di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
+        Handle(XSControl_WorkSession) thesession = Reader.WS();
+        thesession->ClearContext();
+        XSDRAW::SetTransferProcess (thesession->MapReader());
+        progress->NewScope ( 80, "Translation" );
+        progress->Show();
+        thesession->MapReader()->SetProgress ( progress );
+      
+        Reader.SetReadVisible (Standard_True);
+        Reader.TransferRoots();
+      
+        thesession->MapReader()->SetProgress ( 0 );
+        progress->EndScope();
+        progress->Show();
+        
+        // result in only one shape for all the roots
+        TopoDS_Shape shape = Reader.OneShape();
+        // save the shape
+        char fname[110];
+        sprintf(fname, "%s", rnom.ToCString());
+        di << "Saving shape in variable Draw : " << fname << "\n";
+        try {
+          OCC_CATCH_SIGNALS
+          DBRep::Set(fname,shape);
+        }
+        catch(Standard_Failure) {
+          di << "** Exception : ";
+         di << Standard_Failure::Caught()->GetMessageString();
+         di<<" ** Skip"<<"\n";
+          di << "Saving shape in variable Draw : " << fname << "\n";
+          IGESToBRep::WriteShape (shape,1);
+        }                                                                             
+        return 0;
+      }
+   
+      if(fromtcl) {
+       modepri = 0;    // d office, une seule passe
+       if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
+         di<<"All Roots : ";
+         list = XSDRAW::GetList ("xst-model-roots");
+       }
+        else {
+         TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
+         di<<"List given by "<<compart.ToCString()<<" : ";
+         list = XSDRAW::GetList (compart.ToCString());
+       }
+       if (list.IsNull()) {
+          di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
+          continue;
+        }
+      }
+      else {
+       cout<<"Name of Selection :"<<flush;
+       list = XSDRAW::GetList();
+       if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
+      }
+
+      Standard_Integer nbl = list->Length();
+      di<<"Nb entities selected : "<<nbl<<"\n";
+      if (nbl == 0) continue;
+      while (answer) {
+       if (!fromtcl) {
+         cout<<"Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :"<<flush;
+          answer = -1;
+          // anv 26.09.2003                                                     
+          char str_answer[80];                                                  
+          cin>>str_answer;                                                      
+          answer = atoi(str_answer);    
+       }
+       if (answer <= 0 || answer > 3) continue;
+       if (answer == 3) {
+         for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
+           Handle(Standard_Transient) ent = list->Value(ill);
+           di<<"  ";// model->Print(ent,di);
+         }
+         di<<"\n";
+       }
+       if (answer == 1 || answer == 2) {
+         Standard_Integer nbt = 0;
+         Handle(XSControl_WorkSession) thesession = Reader.WS();
+       
+         XSDRAW::SetTransferProcess (thesession->MapReader());
+          progress->NewScope ( 80, "Translation" );
+          progress->Show();
+          thesession->MapReader()->SetProgress ( progress );
+
+          Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
+         for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
+         
+           nent = Reader.Model()->Number(list->Value(ill));
+           if (nent == 0) continue;
+           if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
+           else {
+             nbs = Reader.NbShapes();
+             char shname[30];  sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
+             di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
+             di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
+             TopoDS_Shape sh = Reader.Shape(nbs);
+             DBRep::Set (shname,sh);
+              nbt++;
+           }
+         }
+         thesession->MapReader()->SetProgress ( 0 );
+          progress->EndScope();
+          progress->Show();
+         di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
+         answer = 0;  // on ne reboucle pas
+       }
+      }
+    }
+    else di<<"Unknown mode n0 "<<modepri<<"\n";
+  }
+
+  // *New* 
+  //In order to clear memory after IGES reading you could add the following code
+  Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
+  Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
+  TP->Clear();
+  TR->Clear(2);
+  Reader.WS()->Model()->Clear();
+  Standard_Integer i =1;
+  for( ; i <= 7; i++)
+    Reader.WS()->ClearData(i);
+  // *New* 
+
+  return 0;
+}
+
+#include <Geom_Plane.hxx>
+static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 6)
+  {
+    di << "Usage : " << argv[0] << " plane a b c d\n";
+    return 1;
+  }
+
+  Standard_Real A = atof(argv[2]);
+  Standard_Real B = atof(argv[3]);
+  Standard_Real C = atof(argv[4]);
+  Standard_Real D = atof(argv[5]);
+
+  Handle(Geom_Geometry) result;
+
+  Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
+  result = aPlane;
+
+  DrawTrSurf::Set(argv[1],result);
+  return 0;
+}
+
+static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=2)
+    {
+      di << "Usage : " << argv[0] << " MaxNbr" << "\n";
+      return -1;
+    }
+  Standard_Integer aMaxNbr = atoi(argv[1]);
+
+  for (Standard_Integer i=0;i<aMaxNbr;i++)
+    {
+      BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
+      w.Close();
+      TopoDS_Wire wireShape( w.Wire());
+      BRepBuilderAPI_MakeFace faceBuilder(wireShape);
+      TopoDS_Face f( faceBuilder.Face());
+      BRepMesh_IncrementalMesh im(f,1);
+      BRepTools::Clean(f);
+    }
+  return 0;
+}
+
+#include <Graphic3d_Vector.hxx>
+Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+    if (argc!=7)
+       {
+           di << "Wrong number of arguments" << "\n";
+           return -1;
+       }
+    Standard_Real X1_Pnt = atof(argv[1]);
+    Standard_Real Y1_Pnt = atof(argv[2]);
+    Standard_Real Z1_Pnt = atof(argv[3]);
+    Standard_Real X2_Pnt = atof(argv[4]);
+    Standard_Real Y2_Pnt = atof(argv[5]);
+    Standard_Real Z2_Pnt = atof(argv[6]);
+    
+    Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
+    Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
+     
+    di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
+    return 0;
+}
+    
+    
+
+
+#include <IntCurvesFace_ShapeIntersector.hxx>
+#include <gp_Lin.hxx>
+Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=9)
+    {
+      di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
+      return -1;
+    }
+
+  TopoDS_Shape shape = DBRep::Get(argv[1]);
+
+  if (shape.IsNull()) {
+    di<<" Null shape is not allowed";
+    return 1;
+  }
+
+  Standard_Real X_Pnt = atof(argv[2]);
+  Standard_Real Y_Pnt = atof(argv[3]);
+  Standard_Real Z_Pnt = atof(argv[4]);
+
+  Standard_Real X_Dir = atof(argv[5]);
+  Standard_Real Y_Dir = atof(argv[6]);
+  Standard_Real Z_Dir = atof(argv[7]);
+
+  Standard_Real PInf  = atof(argv[8]);
+
+  IntCurvesFace_ShapeIntersector intersector;
+  intersector.Load(shape, Precision::Intersection());
+
+  gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
+  gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
+  gp_Lin ray(origin, dir);
+
+  Standard_Real PSup = RealLast();
+  intersector.PerformNearest(ray, PInf, PSup);
+  if (intersector.NbPnt() != 0)
+    {
+      di << argv[0] << " status = 0 \n";
+      Standard_Real w = intersector.WParameter(1);
+      di << "w = " << w << "\n";
+    } else {
+      di << argv[0] << " status = -1 \n";
+    }
+  return 0;
+}
+
+Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1) {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+  // Create mask 1111: extent == 4
+  TColStd_PackedMapOfInteger aFullMask;
+  for (Standard_Integer i = 0; i < 4; i++)
+    aFullMask.Add(i);
+  
+  // Create mask 1100: extent == 2
+  TColStd_PackedMapOfInteger aPartMask;
+  for (Standard_Integer i = 0; i < 2; i++)
+    aPartMask.Add(i);
+  
+  di << "aFullMask = 1111" << "\n";
+  di << "aPartMask = 1100" << "\n";
+  
+  Standard_Boolean isAffected;
+  
+  isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
+  di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
+  isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
+  di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
+  isAffected = aFullMask.Subtract(aPartMask); // false (?)
+  di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
+
+  return 0;
+}
+#include <ShapeFix_FixSmallFace.hxx>
+Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+       
+  if (argc != 3) {
+    di << "Usage : " << argv[0] << " shape resshape\n";
+    return 1;
+  }
+  
+  // try to read a shape:
+  TopoDS_Shape aShape=DBRep::Get(argv[1]);
+  ShapeFix_FixSmallFace aFixSmallFaces;
+  aFixSmallFaces.Init (aShape);
+  aFixSmallFaces.Perform();
+  TopoDS_Shape aResShape = aFixSmallFaces.Shape();
+  DBRep::Set(argv[2],aResShape);
+  
+  return 0;
+
+}
+
+#include <NCollection_DataMap.hxx>
+Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+       
+  if (argc != 1) {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+  
+  TCollection_ExtendedString anExtString;
+  
+  Standard_ExtCharacter aNonAsciiChar = 0xff00;
+  anExtString.Insert(1, aNonAsciiChar);
+
+  di << "Is ASCII: " << ( anExtString.IsAscii() ? "true" : "false" ) << "\n";
+  NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
+  aMap.Bind(anExtString, 0);
+  
+  return 0;
+
+}
+
+Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+    if (argc != 10) {
+       di << "Wrong number of arguments" << argv[0] << "\n";
+       return 1;
+    }
+    
+    Standard_Real X_vec = atof(argv[1]);
+    Standard_Real Y_vec = atof(argv[2]);
+    Standard_Real Z_vec = atof(argv[3]);
+    
+    Standard_Real X_dir = atof(argv[4]);
+    Standard_Real Y_dir = atof(argv[5]);
+    Standard_Real Z_dir = atof(argv[6]);
+    
+    Standard_Real X_pnt = atof(argv[7]);
+    Standard_Real Y_pnt = atof(argv[8]);
+    Standard_Real Z_pnt = atof(argv[9]);
+    
+    gp_Dir toSym(X_vec, Y_vec, Z_vec);
+    gp_Dir dir(X_dir, Y_dir, Z_dir);
+    gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
+    gp_Ax2 symObj(loc,dir);
+    toSym.Mirror(symObj);
+    
+    di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n"; 
+    return 0;
+}
+    
+
+Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+       
+  if (argc != 9) {
+    di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
+    return 1;
+  }
+
+  Standard_Real X_mirrorFirstPoint = atof(argv[1]);
+  Standard_Real Y_mirrorFirstPoint = atof(argv[2]);
+  Standard_Real X_mirrorSecondPoint = atof(argv[3]);
+  Standard_Real Y_mirrorSecondPoint = atof(argv[4]);
+  Standard_Real X_p1 = atof(argv[5]);
+  Standard_Real Y_p1 = atof(argv[6]);
+  Standard_Real X_p2 = atof(argv[7]);
+  Standard_Real Y_p2 = atof(argv[8]);
+  
+  gp_Trsf2d identityTransformation;
+
+  gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
+  gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
+  gp_Ax2d  mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
+
+  gp_Pnt2d p1(X_p1,Y_p1);
+  gp_Pnt2d p2(X_p2,Y_p2);
+
+  gp_Trsf2d M1;
+  M1.SetMirror(mirrorAxis);
+  gp_Trsf2d M2;
+  M2.SetMirror(mirrorAxis);
+  gp_Trsf2d Tcomp;
+  Tcomp = M2.Multiplied(M1);
+
+  Standard_Real aTol = Precision::Confusion();
+  Standard_Integer aStatus = 0;
+
+  //After applying two times the same mirror the point is located on the same location OK
+  gp_Pnt2d p1MirrorM1   = p1.Transformed(M1);
+  if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
+    aStatus = 2;
+  if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
+    aStatus = 3;
+
+  gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
+  if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
+    aStatus = 4;
+  if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
+    aStatus = 5;
+
+  //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
+  gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
+  if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
+    aStatus = 6;
+  if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
+    aStatus = 7;
+
+  di << "Status = " << aStatus << "\n";
+  return 0;
+}
+
+#include <BOPTColStd_CArray1OfInteger.hxx>
+//=======================================================================
+//function : DumpArray
+//purpose  : 
+//=======================================================================
+void DumpArray(const BOPTColStd_CArray1OfInteger& aC,
+              Draw_Interpretor& aDI)
+{
+  Standard_Integer iLength, iFactLength, iBlockLength;
+  //
+  iLength=aC.Length();
+  iFactLength=aC.FactLength();
+  iBlockLength=aC.BlockLength();
+  //
+  aDI<< "Length: " <<iLength << "\n";
+  aDI<< "FactLength: " <<iFactLength << "\n";
+  aDI<< "BlockLength: " <<iBlockLength << "\n";
+}
+//=======================================================================
+//function : bcarray
+//purpose  : 
+//=======================================================================
+Standard_Integer bcarray (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+       
+  if (argc != 1) {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+  Standard_Integer i, aNb, aBL;
+  BOPTColStd_CArray1OfInteger aC;
+  //
+  aBL=100000;
+  aC.SetBlockLength(aBL);
+  //
+  for (i=1; i<=10; ++i) {
+    aC.Append(-i*10);
+  }
+  di<< "\nstate before release the unused memory\n";
+  DumpArray(aC, di);
+  //
+  aC.Purge();
+  //
+  di<< "\nstate after release the unused memory\n";
+  DumpArray(aC, di);
+  //
+  return 0;
+}
+
+void QABugs::Commands_11(Draw_Interpretor& theCommands) {
+  const char *group = "QABugs";
+
+  theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
+
+  // Remove as bad version of QAAddOrRemoveSelected from QADraw
+  //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
+
+  theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
+  theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
+  theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661,  group);
+
+//====================================================
+//
+// Following commands are inserted from 
+// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
+// ( 75455 Apr 16 18:59)
+//
+//====================================================
+
+  theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group); 
+  theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
+
+  theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
+
+  theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
+  //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
+  theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
+  theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
+  //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
+  theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
+
+  // New commands:
+  theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
+  theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
+  theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
+
+  theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
+  theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
+  theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
+
+  //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
+  theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
+
+  theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
+
+  theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
+  // Must use OCC299
+  //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
+  theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
+  theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
+  theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
+  theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
+  theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
+  theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
+  theCommands.Add("OCC543", "OCC543 name", __FILE__, OCC543, group);
+  //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
+  theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
+  theCommands.Add("OCC627", "OCC627", __FILE__, OCC627, group);
+  theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
+  theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
+  theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
+  theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
+  theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
+  theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
+  theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
+  theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
+  theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
+
+  theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
+  theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
+  theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group); 
+  theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group); 
+  theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group); 
+  theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group); 
+
+  //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
+  theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
+
+  theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
+  theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
+  theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
+  theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
+  theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
+  theCommands.Add("OCC7141", "OCC7141 [nCount]", __FILE__, OCC7141, group);
+  theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
+  theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
+  theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
+  theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
+  theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
+  theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
+  theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
+  theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
+  theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
+  theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
+  theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
+  theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
+  theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
+  theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
+  theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
+  theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
+  theCommands.Add("OCC17424", "OCC17424  shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
+  theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
+  theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
+  theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
+  theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
+  theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
+  theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
+  theCommands.Add("OCC22558", "OCC22558 x_vec y_vec z_vec x_dir y_dir z_dit x_pnt y_pnt z_pnt", __FILE__, OCC22558, group);
+  return;
+}
diff --git a/src/QABugs/QABugs_12.cxx b/src/QABugs/QABugs_12.cxx
new file mode 100644 (file)
index 0000000..e486b91
--- /dev/null
@@ -0,0 +1,134 @@
+// Created on: 2002-10-24
+// Created by: Michael KUZMITCHEV
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <gp_Pnt.hxx>
+#include <gp_Ax2.hxx>
+#include <gp.hxx>
+#include <gp_Ax1.hxx>
+#include <gce_MakeCirc.hxx>
+#include <gp_Circ.hxx>
+#include <GC_MakeArcOfCircle.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <TopoDS_Edge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <TopoDS_Wire.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <BRepOffsetAPI_ThruSections.hxx>
+//=======================================================================
+//  OCC895
+//=======================================================================
+static Standard_Integer OCC895 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 2 || argc > 5)
+  {
+    di << "Usage : " << argv[0] << " result [angle [reverse [order]]]" << "\n";
+    return 1;
+  }
+
+  const Standard_Real rad = 1.0;
+  const Standard_Real angle = (argc > 2)? atof(argv[2]) : 0.0;
+  const Standard_Integer reverse = (argc > 3)? atoi(argv[3]) : 0;
+  const Standard_Integer order = (argc > 4)? atoi(argv[4]) : 0;
+
+  // Make a wire from the first arc for ThruSections.
+  //
+  // This arc is rotated 5 degrees about the Z axis.
+  // I don't know why, but if we don't rotate it,
+  // the final shell is not twisted.
+  gp_Pnt center1(0,10,0);
+  gp_Ax2 axis1 = reverse?
+    gp_Ax2(center1, gp::DY(), gp::DZ()) : gp_Ax2(center1, -gp::DY(), gp::DX());
+  if (Abs(angle) > gp::Resolution())
+    axis1.Rotate(gp_Ax1(center1, gp::DZ()), angle*M_PI/180.0);
+
+  gce_MakeCirc makeCirc1(axis1, rad);
+  if(!makeCirc1.IsDone()) return 1;
+  gp_Circ circ1 = makeCirc1.Value();
+  GC_MakeArcOfCircle makeArc1(circ1, 0, M_PI/2, Standard_True);
+  if(!makeArc1.IsDone()) return 1;
+  Handle_Geom_TrimmedCurve arc1 = makeArc1.Value();
+
+  // Create wire 1
+  BRepBuilderAPI_MakeEdge makeEdge1(arc1, arc1->StartPoint(), arc1->EndPoint());
+  if(!makeEdge1.IsDone()) return 1;
+  TopoDS_Edge edge1 = makeEdge1.Edge();
+  BRepBuilderAPI_MakeWire makeWire1;
+  makeWire1.Add(edge1);
+  if(!makeWire1.IsDone()) return 1;
+  TopoDS_Wire wire1 = makeWire1.Wire();
+
+  // Make a wire from the second arc for ThruSections.
+  gp_Pnt center2(10,0,0);
+  gp_Ax2 axis2(center2, -gp::DX(), gp::DZ());
+
+  gce_MakeCirc makeCirc2(axis2, rad);
+  if(!makeCirc2.IsDone()) return 1;
+  gp_Circ circ2 = makeCirc2.Value();
+  GC_MakeArcOfCircle makeArc2(circ2, 0, M_PI/2, Standard_True);
+  if(!makeArc2.IsDone()) return 1;
+  Handle_Geom_TrimmedCurve arc2 = makeArc2.Value();
+
+  // Create wire 2
+  BRepBuilderAPI_MakeEdge makeEdge2(arc2, arc2->StartPoint(), arc2->EndPoint());
+  if(!makeEdge2.IsDone()) return 1;
+  TopoDS_Edge edge2 = makeEdge2.Edge();
+  BRepBuilderAPI_MakeWire makeWire2;
+  makeWire2.Add(edge2);
+  if(!makeWire2.IsDone()) return 1;
+  TopoDS_Wire wire2 = makeWire2.Wire();
+
+  BRepOffsetAPI_ThruSections thruSect(Standard_False,Standard_True);
+  if (order)
+  {
+    thruSect.AddWire(wire1);
+    thruSect.AddWire(wire2);
+  }
+  else
+  {
+    thruSect.AddWire(wire2);
+    thruSect.AddWire(wire1);
+  }
+  thruSect.Build();
+  if(!thruSect.IsDone()) return 1;
+  TopoDS_Shape myShape = thruSect.Shape();
+
+  DBRep::Set(argv[1],myShape);
+
+  return 0;
+}
+
+void QABugs::Commands_12(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC895", "OCC895 result [angle [reverse [order]]]", __FILE__, OCC895, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_13.cxx b/src/QABugs/QABugs_13.cxx
new file mode 100644 (file)
index 0000000..39758d7
--- /dev/null
@@ -0,0 +1,1073 @@
+// Created on: 2002-05-16
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <tcl.h>
+
+#include <gp_Ax2.hxx>
+#include <gp_Circ.hxx>
+#include <gp_Pln.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepCheck_Analyzer.hxx>
+#include <BRepGProp.hxx>
+#include <BRepOffsetAPI_MakePipeShell.hxx>
+#include <GC_MakeArcOfCircle.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Plane.hxx>
+#include <Law_Linear.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shell.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS_Solid.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS_Wire.hxx>
+#include <TopExp_Explorer.hxx>
+#include <GProp_GProps.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+//=======================================================================
+//function :  OCC332
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  // Used to Display Geometry or Topolgy
+  char name[255];
+  char *pname = name;
+  Standard_Boolean check = Standard_True;
+
+  // Set default arguments
+  double wall_thickness = 10.0;
+  double dia1 = 80.0;
+  double dia2 = 100.0;
+  double length = 400.0;
+  double major_radius = 280.0;
+
+  // Convert arguments
+  if (argc>1) wall_thickness = atof(argv[1]);
+  if (argc>2) dia1 = atof(argv[2]);
+  if (argc>3) dia2 = atof(argv[3]);
+  if (argc>4) major_radius = atof(argv[4]);
+  if (argc>5) length = atof(argv[5]);
+  double bend_angle = length/major_radius;
+
+  //if ((bend_angle >= M_PI)) {
+  if ((bend_angle >= M_PI)) {
+    di << "The arguments are invalid." << "\n";
+    return(TCL_ERROR);
+  }
+  di << "creating the shape for a bent tube" << "\n";
+
+  double radius_l = dia1/2.0;
+  double radius_r = dia2/2.0;
+
+  // SUPPORT:
+  // 1. There is no need to normalize the direction - it's done automatically
+  //gp_Ax2 origin(gp_Pnt(5000.0,-300.0, 1000.0),
+               //gp_Dir(0.0, -1.0/sqrt(2.0), -1.0/sqrt(2.0)));
+  gp_Ax2 origin(gp_Pnt(5000.0,-300.0,1000.0),gp_Dir(0.0,-1.0,-1.0));
+
+  TopoDS_Face myFace;
+  TopoDS_Shape myShape, gasSolid;
+  TopoDS_Solid wallSolid;
+
+  // Construct a circle for the first face, on the xy-plane at the origin
+  gp_Pln circ1Plane(origin.Location(), origin.Direction());
+  gp_Circ faceCircle(origin, radius_l);
+  gp_Circ outFaceCircle(origin, radius_l+wall_thickness);
+
+  // Construct center for a circle to be the spine of
+  // revolution, on the xz-plane at x=major_radius
+  gp_Pnt circ_center = origin.Location().Translated(major_radius*origin.XDirection());
+
+  // This point will be the center of the second face.
+  // SUPPORT:
+  // - There is no need in this point - we'll use angle instead.
+  //gp_Pnt endPoint = origin.Location();
+  //endPoint.Translate(major_radius*(1.0-cos(bend_angle))*origin.XDirection()) ;
+  //endPoint.Translate((-major_radius*sin(bend_angle))*origin.Direction());
+
+  // Construct the plane for the second face to sit on.
+  // SUPPORT:
+  // - It is better to use rotation instead of explicit calculations
+  //gp_Pln circ2Plane = gce_MakePln(circ_center, endPoint,
+  //                             endPoint.Translated(major_radius*origin.YDirection())
+  //                             ).Value();
+  gp_Ax1 circ_axis(circ_center,origin.YDirection());
+  gp_Pln circ2Plane = circ1Plane.Rotated(circ_axis,bend_angle);
+
+  // The circle used for the spine.
+  // SUPPORT:
+  // - Use direction (-X) instead of (X) to obtain correct right-handed system.
+  //   It is very important to maintain correct orientation between spine
+  //   and circles axes.
+  //gp_Ax2 spineAxis(circ_center, origin.YDirection(), origin.XDirection());
+  gp_Ax2 spineAxis(circ_center, origin.YDirection(), -origin.XDirection());
+  gp_Circ circle(spineAxis, major_radius);
+
+  // SUPPORT:
+  // - There is no need to create 2nd circles - they will be created by MakePipeShell.
+  //gp_Ax2 circ2axis(endPoint, circ2Plane.Axis().Direction(), origin.YDirection());
+  //gp_Circ faceCircle2(circ2axis,radius_r);
+  //gp_Circ outFaceCircle2(circ2axis,radius_r+wall_thickness);
+
+  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(faceCircle);
+  TopoDS_Wire Wire1_ = BRepBuilderAPI_MakeWire(E1).Wire();
+  
+  // Create the face at the near end for the wall solid, an annular ring.
+  TopoDS_Edge Eout1 = BRepBuilderAPI_MakeEdge(outFaceCircle);
+  TopoDS_Wire outerWire1_ = BRepBuilderAPI_MakeWire(Eout1).Wire();
+
+  // SUPPORT:
+  // - There is no need to create 2nd circles -
+  //   they will be created by MakePipeShell
+  //TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(faceCircle2);
+  //TopoDS_Wire Wire2_ = BRepBuilderAPI_MakeWire(E2).Wire();
+  
+  // Create the face at the far end for the wall solid, an annular ring.
+  // SUPPORT:
+  // - There is no need to create 2nd circles -
+  //   they will be created by MakePipeShell
+  //TopoDS_Edge Eout2 = BRepBuilderAPI_MakeEdge(outFaceCircle2);
+  //TopoDS_Wire outerWire2_ = BRepBuilderAPI_MakeWire(Eout2).Wire();
+
+  // SUPPORT:
+  // - It is better to use bend angle calculated above
+  //Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
+  //                                                endPoint,
+  //                                                origin.Location(),
+  //                                                Standard_True).Value();
+  Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
+                                                     0.0,
+                                                     bend_angle,
+                                                    Standard_True).Value();
+
+  // SUPPORT:
+  // - Use correct formula for scaling laws
+  Handle(Law_Linear) myLaw1 = new Law_Linear();
+  Handle(Law_Linear) myLaw2 = new Law_Linear();
+  //if ((radius_r - radius_l) < Precision::Confusion())
+  //{
+    //myLaw1->Set(SpineCurve->FirstParameter(), 1.0,
+               //SpineCurve->LastParameter(), 1.0);
+    //myLaw2->Set(SpineCurve->FirstParameter(), 1.0,
+               //SpineCurve->LastParameter(), 1.0);
+  //}
+  //else
+  //{
+    //myLaw1->Set(SpineCurve->FirstParameter(), radius_r/(radius_r-radius_l),
+               //SpineCurve->LastParameter(), 1.0);
+    //myLaw2->Set(SpineCurve->FirstParameter(), (radius_r+wall_thickness)/(radius_r-radius_l),
+               //SpineCurve->LastParameter(), 1.0);
+  //}
+  myLaw1->Set(SpineCurve->FirstParameter(),1.0,
+              SpineCurve->LastParameter(),radius_r/radius_l);
+  myLaw2->Set(SpineCurve->FirstParameter(),1.0,
+              SpineCurve->LastParameter(),(radius_r+wall_thickness)/(radius_l+wall_thickness));
+
+  BRepBuilderAPI_MakeFace mkFace;
+
+  BRepBuilderAPI_MakeEdge mkEdge;
+
+  mkEdge.Init(SpineCurve);
+  if (!mkEdge.IsDone()) return 0;
+  TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire();
+
+  sprintf (name,"SpineWire");
+  DBRep::Set(name,SpineWire);
+
+  sprintf (name,"Wire1_");
+  DBRep::Set(name,Wire1_);
+
+  sprintf (name,"outerWire1_");
+  DBRep::Set(name,outerWire1_);
+
+  // SUPPORT:
+  // - There is no need to create 2nd circles
+  //sprintf (name,"Wire2_");
+  //DBRep::Set(name,Wire2_);
+  //sprintf (name,"outerWire2_");
+  //DBRep::Set(name,outerWire2_);
+
+  di.Eval("fit");
+
+  // SUPPORT:
+  // - There is no need in these vertices
+  //TopoDS_Vertex Location1, Location2;
+  //TopExp::Vertices(SpineWire, Location1, Location2);
+
+  // Make inner pipe shell
+  BRepOffsetAPI_MakePipeShell mkPipe1(SpineWire);
+  mkPipe1.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
+  //mkPipe1.SetTransitionMode(BRepBuilderAPI_Transformed); // Default mode !!
+  mkPipe1.SetLaw(Wire1_, myLaw1/*, Location2*/, Standard_False, Standard_False);
+  mkPipe1.Build();
+  if (!mkPipe1.IsDone()) return 0;
+
+  // Make outer pipe shell
+  BRepOffsetAPI_MakePipeShell mkPipe2(SpineWire);
+  mkPipe2.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
+  //mkPipe2.SetTransitionMode(BRepBuilderAPI_Transformed); // Default mode !!
+  mkPipe2.SetLaw(outerWire1_, myLaw2/*, Location2*/, Standard_False, Standard_False);
+  mkPipe2.Build();
+  if (!mkPipe2.IsDone()) return 0;
+
+  // Make face for first opening
+  Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
+  mkFace.Init(Plane1,Standard_False,Precision::Confusion());
+  // SUPPORT:
+  // - Use wires created by MakePipeShell
+  //mkFace.Add(TopoDS::Wire(outerWire1_));
+  //mkFace.Add(TopoDS::Wire(Wire1_.Reversed()));
+  mkFace.Add(TopoDS::Wire(mkPipe2.FirstShape()));
+  mkFace.Add(TopoDS::Wire(mkPipe1.FirstShape().Reversed()));
+  if (!mkFace.IsDone()) return 0;
+  TopoDS_Face Face1 = mkFace.Face();
+
+  // Make face for second opening
+  Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
+  mkFace.Init(Plane2,Standard_False,Precision::Confusion());
+  // SUPPORT:
+  // - Use wires created by MakePipeShell
+  //mkFace.Add(TopoDS::Wire(outerWire2_));
+  //mkFace.Add(TopoDS::Wire(Wire2_.Reversed()));
+  mkFace.Add(TopoDS::Wire(mkPipe2.LastShape()));
+  mkFace.Add(TopoDS::Wire(mkPipe1.LastShape().Reversed()));
+  if (!mkFace.IsDone()) return 0;
+  TopoDS_Face Face2 = mkFace.Face();
+
+  // Make tube
+  TopoDS_Shell TubeShell;
+  BRep_Builder B;
+  B.MakeShell(TubeShell);
+  TopExp_Explorer getFaces;
+  TopoDS_Face test_face;
+  getFaces.Init(mkPipe1.Shape(), TopAbs_FACE);
+  // SUPPORT:
+  // - In our case there should be only 1 pipe face
+  //while (getFaces.More())
+  //  {
+  //    test_face = TopoDS::Face(getFaces.Current());
+  //    Handle(Geom_Surface) S = BRep_Tool::Surface(test_face); 
+  //    GeomLib_IsPlanarSurface IsPl(S);
+  //    if (!IsPl.IsPlanar()) {
+  //   B.Add(TubeShell,getFaces.Current().Reversed());
+  //    }
+  //    getFaces.Next();
+  //  }
+  if (getFaces.More())
+    B.Add(TubeShell,getFaces.Current().Reversed());
+
+  // Grab the gas solid now that we've extracted the faces.
+  mkPipe1.MakeSolid();
+  gasSolid = mkPipe1.Shape();
+
+  sprintf (name,"gasSolid_");
+  DBRep::Set(name,gasSolid);
+
+  //getFaces.Clear();
+  getFaces.Init(mkPipe2.Shape(), TopAbs_FACE);
+  // SUPPORT:
+  // - In our case there should be only 1 pipe face
+  //while (getFaces.More())
+  //  {
+  //    B.Add(TubeShell,getFaces.Current());
+  //    getFaces.Next();
+  //  }
+  if (getFaces.More())
+    B.Add(TubeShell,getFaces.Current());
+
+  B.Add(TubeShell,Face1.Reversed());
+  B.Add(TubeShell,Face2);
+
+  B.MakeSolid(wallSolid);
+  B.Add(wallSolid,TubeShell);
+
+  sprintf (name,"wallSolid_");
+  DBRep::Set(name,wallSolid);
+
+  // Now calculated the volume of the outside tube.
+  GProp_GProps gprops;
+  BRepGProp::VolumeProperties(wallSolid, gprops);
+  di << "The wallSolid's volume is: " << gprops.Mass() << "\n";
+
+  if (check) {
+    if (!(BRepCheck_Analyzer(wallSolid).IsValid()))
+      di << "The TopoDS_Solid was checked, and it was invalid!" << "\n";
+    else
+      di << "The TopoDS_Solid was checked, and it was valid." << "\n";
+    if (!wallSolid.Closed())
+      di << "The TopoDS_Solid is not closed!" << "\n";
+    else
+      di << "The TopoDS_Solid is closed." << "\n";
+    if (!wallSolid.Checked())
+      di << "The TopoDS_Solid is not checked!" << "\n";
+    else
+      di << "The TopoDS_Solid has been checked." << "\n";
+    if (wallSolid.Infinite())
+      di << "The TopoDS_Solid is infinite!" << "\n";
+    else
+      di << "The TopoDS_Solid is finite." << "\n";
+  }
+
+  di << "The result is a ";
+  // Check to see if we have a solid
+  switch (wallSolid.ShapeType()) {
+  case (TopAbs_COMPOUND):
+    di << "TopAbs_COMPOUND" << "\n";
+    break;
+  case (TopAbs_COMPSOLID):
+    di << "TopAbs_COMPSOLID" << "\n";
+    break;
+  case (TopAbs_SOLID):
+    di << "TopAbs_SOLID" << "\n";
+    break;
+  case (TopAbs_SHELL):
+    di << "TopAbs_SHELL" << "\n";
+    break;
+  case (TopAbs_FACE):
+    di << "TopAbs_FACE" << "\n";
+    break;
+  case (TopAbs_WIRE):
+    di << "TopAbs_WIRE" << "\n";
+    break;
+  case (TopAbs_EDGE):
+    di << "TopAbs_EDGE" << "\n";
+    break;
+  case (TopAbs_VERTEX):
+    di << "TopAbs_VERTEX" << "\n";
+    break;
+  case (TopAbs_SHAPE):
+    di << "TopAbs_SHAPE" << "\n";
+  }
+  di << "Can we turn it into a solid? ";
+  try {
+    OCC_CATCH_SIGNALS
+    di << " yes" << "\n";
+  }
+  catch (Standard_TypeMismatch) {
+    di << " no" << "\n";
+  }
+
+  getFaces.Clear();
+  getFaces.Init(wallSolid, TopAbs_FACE);
+  int i =0;
+  while (getFaces.More())
+    {
+      i++;
+      sprintf(name,"Face%d",i);
+      di << "Face named " << name << "\n";
+      DBRep::Set(name,getFaces.Current());
+      getFaces.Next();
+    }
+
+  return 0;
+}
+
+#include <gce_MakePln.hxx>
+#include <TopExp.hxx>
+#include <BRepOffsetAPI_Sewing.hxx>
+#include <BRepAlgoAPI_Fuse.hxx>
+///////#else
+///////#include <BRepAlgo_Fuse.hxx>
+///////#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgo_Fuse.hxx>
+
+//=======================================================================
+//function :  OCC544
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if(argc > 7) {
+    di << "Usage : " << argv[0] << " [[[[[wT [[[[d1 [[[d2 [[R [length [BRepAlgoAPI/BRepAlgo = 1/0]]]]]]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 7) {
+    Standard_Integer IsB = atoi(argv[6]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  // Used to Display Geometry or Topolgy
+  char name[255];
+  char *pname = name;
+  //bool check = true;
+  Standard_Boolean check = Standard_True;
+
+  // Set default arguments
+  double radius_l = 20.0;
+  double radius_r = 80.0;
+  // mkv 15.07.03 double bend_angle = M_PI/2.0;
+  double bend_angle = M_PI/2.0;
+
+  double major_rad = 280.0;
+  double wall_thickness = 10.0;
+                   
+
+  // Convert arguments
+  if (argc>1) radius_l = atof(argv[1]);
+  if (argc>2) radius_r = atof(argv[2]);
+  if (argc>3) bend_angle = atof(argv[3]);
+  if (argc>4) major_rad = atof(argv[4]);
+  if (argc>5) wall_thickness = atof(argv[5]);
+
+  // mkv 15.07.03 if ((bend_angle >= 2.0*M_PI)) {
+  if ((bend_angle >= 2.0*M_PI)) {
+    di << "The arguments are invalid." << "\n";
+    return(TCL_ERROR);
+  }
+  di << "creating the shape for a bent tube" << "\n";
+  gp_Ax2 origin(gp_Pnt(500.0,-300.0, 100.0),
+               gp_Dir(0.0, -1.0/sqrt(2.0), -1.0/sqrt(2.0)));
+
+  TopoDS_Face firstFace, lastFace;
+  TopoDS_Solid wallSolid, myShape;
+  // Construct a circle for the first face, on the xy-plane at the origin
+  gp_Pln circ1Plane(origin.Location(), origin.Direction());
+  gp_Circ faceCircle(origin, radius_l);
+  gp_Circ outFaceCircle(origin, radius_l+wall_thickness);
+
+  // Construct center for a circle to be the spine of
+  // revolution, on the xz-plane at x=major_rad
+  gp_Pnt circ_center = origin.Location().Translated(
+                                                   major_rad*origin.XDirection()
+                                                   );
+
+  // This point will be the center of the second face.
+  gp_Pnt endPoint = origin.Location();
+  endPoint.Translate(major_rad*(1.0-cos(bend_angle))*origin.XDirection()) ;
+  endPoint.Translate((-major_rad*sin(bend_angle))*origin.Direction());
+
+  // Construct the plane for the second face to sit on.
+  gp_Pln circ2Plane = gce_MakePln(circ_center, endPoint,
+                                 endPoint.Translated(major_rad*origin.YDirection())
+                                 ).Value();
+
+  // The circle used for the spine.
+  gp_Ax2 spineAxis(circ_center, origin.YDirection(), origin.XDirection());
+  gp_Circ circle(spineAxis, major_rad);
+
+  gp_Ax2 circ2axis(endPoint, circ2Plane.Axis().Direction(), origin.YDirection());
+  gp_Circ faceCircle2(circ2axis,radius_r);
+  gp_Circ outFaceCircle2(circ2axis,radius_r+wall_thickness);
+
+  TopoDS_Edge E1_1 = BRepBuilderAPI_MakeEdge(faceCircle, 0, M_PI);
+  TopoDS_Edge E1_2 = BRepBuilderAPI_MakeEdge(faceCircle, M_PI, 2.*M_PI);
+  TopoDS_Wire Wire1_ = BRepBuilderAPI_MakeWire(E1_1, E1_2);
+  
+  // Create the face at the near end for the wall solid, an annular ring.
+  TopoDS_Edge Eout1_1 = BRepBuilderAPI_MakeEdge(outFaceCircle, 0, M_PI);
+  TopoDS_Edge Eout1_2 = BRepBuilderAPI_MakeEdge(outFaceCircle, M_PI, 2.*M_PI);
+  TopoDS_Wire outerWire1_ = BRepBuilderAPI_MakeWire(Eout1_1, Eout1_2);
+  TopoDS_Edge E2_1 = BRepBuilderAPI_MakeEdge(faceCircle2, 0, M_PI);
+  TopoDS_Edge E2_2 = BRepBuilderAPI_MakeEdge(faceCircle2, M_PI, 2.*M_PI);
+  TopoDS_Wire Wire2_ = BRepBuilderAPI_MakeWire(E2_1, E2_2);
+  
+  // Create the face at the far end for the wall solid, an annular ring.
+  TopoDS_Edge Eout2_1 = BRepBuilderAPI_MakeEdge(outFaceCircle2, 0, M_PI);
+  TopoDS_Edge Eout2_2 = BRepBuilderAPI_MakeEdge(outFaceCircle2, M_PI, 2.*M_PI);
+  TopoDS_Wire outerWire2_ = BRepBuilderAPI_MakeWire(Eout2_1, Eout2_2);
+
+  BRepBuilderAPI_MakeFace mkFace;
+
+  Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
+                                                    endPoint,
+                                                    origin.Location(),
+                                                    Standard_True).Value();
+  Handle(Law_Linear) myLaw = new Law_Linear();
+  Handle(Law_Linear) myLaw2 = new Law_Linear();
+
+  myLaw->Set(SpineCurve->FirstParameter(),
+            radius_r/radius_l,
+            SpineCurve->LastParameter(),
+            1.0);
+
+  myLaw2->Set(SpineCurve->FirstParameter(),
+             (radius_r+wall_thickness)/(radius_l+wall_thickness),
+             SpineCurve->LastParameter(),
+             1.0);
+
+  di << "SpineCurve->FirstParameter() is " << SpineCurve->FirstParameter() << "\n";
+  di << "SpineCurve->LastParameter() is " << SpineCurve->LastParameter() << "\n";
+  di << "Law1 Value at FirstParameter() is " << myLaw->Value(SpineCurve->FirstParameter()) << "\n";
+  di << "Law1 Value at LastParameter() is " << myLaw->Value(SpineCurve->LastParameter()) << "\n";
+  di << "radius_r / radius_l is " << radius_r/radius_l << "\n";
+
+  BRepBuilderAPI_MakeEdge mkEdge;
+
+  mkEdge.Init(SpineCurve);
+  if (!mkEdge.IsDone()) return TCL_ERROR;
+  TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire();
+
+  sprintf (name,"SpineWire");
+  DBRep::Set(name,SpineWire);
+
+  sprintf (name,"Wire1_");
+  DBRep::Set(name,Wire1_);
+
+  sprintf (name,"outerWire1_");
+  DBRep::Set(name,outerWire1_);
+
+  sprintf (name,"Wire2_");
+  DBRep::Set(name,Wire2_);
+
+  sprintf (name,"outerWire2_");
+  DBRep::Set(name,outerWire2_);
+
+  di.Eval("fit");
+
+  TopoDS_Vertex Location1, Location2;
+
+  TopExp::Vertices(SpineWire, Location2, Location1);
+
+  sprintf (name,"Location1");
+  DBRep::Set(name,Location1);
+
+  sprintf (name,"Location2");
+  DBRep::Set(name,Location2);
+
+  // Make inner pipe shell
+  BRepOffsetAPI_MakePipeShell mkPipe1(SpineWire);
+  mkPipe1.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
+  mkPipe1.SetTransitionMode(BRepBuilderAPI_Transformed);
+  mkPipe1.SetMode(Standard_False);
+  mkPipe1.SetLaw(Wire1_, myLaw, Location1, Standard_False, Standard_False);
+  mkPipe1.Build();
+  if (!mkPipe1.IsDone()) return TCL_ERROR;
+
+  // Make outer pipe shell
+  BRepOffsetAPI_MakePipeShell mkPipe2(SpineWire);
+  mkPipe2.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
+  mkPipe2.SetTransitionMode(BRepBuilderAPI_Transformed);
+  mkPipe2.SetMode(Standard_False);
+  mkPipe2.SetLaw(outerWire1_, myLaw2, Location1, Standard_False, Standard_False);
+ mkPipe2.Build();
+  if (!mkPipe2.IsDone()) return TCL_ERROR;
+
+//    sprintf(name,"w1-first");
+//    DBRep::Set(name,mkPipe1.FirstShape());
+
+//    sprintf(name,"w1-last");
+//    DBRep::Set(name,mkPipe1.LastShape());
+
+//    sprintf(name,"w2-first");
+//    DBRep::Set(name,mkPipe2.FirstShape());
+
+//    sprintf(name,"w2-last");
+//    DBRep::Set(name,mkPipe2.LastShape());
+
+  BRepOffsetAPI_Sewing SewIt(1.0e-4);
+
+  // Make tube
+  TopExp_Explorer getFaces;
+  TopoDS_Face test_face;
+  getFaces.Init(mkPipe1.Shape(), TopAbs_FACE);
+  while (getFaces.More())
+    {
+      SewIt.Add(getFaces.Current().Reversed());
+      getFaces.Next();
+    }
+
+  // Make face for first opening
+  Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
+  mkFace.Init(Plane1,Standard_False,Precision::Confusion());
+  mkFace.Add(TopoDS::Wire(outerWire1_));
+  mkFace.Add(TopoDS::Wire(Wire1_.Reversed()));
+  if (!mkFace.IsDone()) return TCL_ERROR;
+  TopoDS_Face Face1 = mkFace.Face();
+
+  // Make face for second opening
+  Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
+  mkFace.Init(Plane2,Standard_False,Precision::Confusion());
+  mkFace.Add(TopoDS::Wire(outerWire2_));
+  mkFace.Add(TopoDS::Wire(Wire2_.Reversed()));
+  if (!mkFace.IsDone()) return TCL_ERROR;
+  TopoDS_Face Face2 = mkFace.Face();
+
+  // Grab the gas solid now that we've extracted the faces.
+  mkPipe1.MakeSolid();
+  myShape = TopoDS::Solid(mkPipe1.Shape());
+
+  getFaces.Clear();
+  getFaces.Init(mkPipe2.Shape(), TopAbs_FACE);
+  while (getFaces.More())
+    {
+      SewIt.Add(getFaces.Current());
+      getFaces.Next();
+    }
+
+  SewIt.Add(Face1.Reversed());
+  SewIt.Add(Face2);
+
+  SewIt.Perform();
+
+  di << "The result of the Sewing operation is a ";
+  // Check to see if we have a solid
+  switch (SewIt.SewedShape().ShapeType()) {
+  case (TopAbs_COMPOUND):
+    di << "TopAbs_COMPOUND" << "\n";
+    break;
+  case (TopAbs_COMPSOLID):
+    di << "TopAbs_COMPSOLID" << "\n";
+    break;
+  case (TopAbs_SOLID):
+    di << "TopAbs_SOLID" << "\n";
+    break;
+  case (TopAbs_SHELL):
+    di << "TopAbs_SHELL" << "\n";
+    break;
+  case (TopAbs_FACE):
+    di << "TopAbs_FACE" << "\n";
+    break;
+  case (TopAbs_WIRE):
+    di << "TopAbs_WIRE" << "\n";
+    break;
+  case (TopAbs_EDGE):
+    di << "TopAbs_EDGE" << "\n";
+    break;
+  case (TopAbs_VERTEX):
+    di << "TopAbs_VERTEX" << "\n";
+    break;
+  case (TopAbs_SHAPE):
+    di << "TopAbs_SHAPE" << "\n";
+  }
+
+  BRep_Builder B;
+
+  TopoDS_Shell TubeShell;
+  di << "Can we turn it into a shell? ";
+  try {
+    OCC_CATCH_SIGNALS
+    TubeShell = TopoDS::Shell(SewIt.SewedShape());
+    B.MakeSolid(wallSolid);
+    B.Add(wallSolid,TubeShell);
+    di << " yes" << "\n";
+  }
+  catch (Standard_TypeMismatch) {
+    di << "Can't convert to shell..." << "\n";
+    TopExp_Explorer getSol;
+    getSol.Init(SewIt.SewedShape(), TopAbs_SOLID);
+    if (getSol.More()) {
+      di << "First solid found in compound" << "\n";
+      wallSolid = TopoDS::Solid(getSol.Current());
+      TopoDS_Solid test_solid;
+      while (getSol.More())
+       {
+         di << "Next solid found in compound" << "\n";
+         getSol.Next();
+         test_solid = TopoDS::Solid(getSol.Current());
+//////#if ! defined(BRepAlgoAPI_def01)
+//////   BRepAlgoAPI_Fuse fuser(test_solid, wallSolid);
+//////#else
+//////   BRepAlgo_Fuse fuser(test_solid, wallSolid);
+//////#endif
+//////   fuser.Build();
+         if (IsBRepAlgoAPI) {
+           di << "BRepAlgoAPI_Fuse fuser(test_solid, wallSolid)" <<"\n";
+           BRepAlgoAPI_Fuse fuser(test_solid, wallSolid);
+           fuser.Build();
+           wallSolid = TopoDS::Solid(fuser.Shape());
+         } else {
+           di << "BRepAlgo_Fuse fuser(test_solid, wallSolid)" <<"\n";
+           BRepAlgo_Fuse fuser(test_solid, wallSolid);
+           fuser.Build();
+           wallSolid = TopoDS::Solid(fuser.Shape());
+         }
+//////   wallSolid = TopoDS::Solid(fuser.Shape());
+       }
+    } else {
+      // Let's see if we can extract shells instead of solids.
+      TopExp_Explorer getShel;
+      getShel.Init(SewIt.SewedShape(), TopAbs_SHELL);
+      if (getShel.More()) {
+       di << "First shell found in compound" << "\n";
+       B.MakeSolid(wallSolid);
+       di << "B.Add(wallSolid,TopoDS::Shell(getShel.Current()));" << "\n";
+       int i = 1;
+       while (getShel.More())
+         {
+           di << "Next shell found in compound" << "\n";
+           di << "B.Add(wallSolid,TopoDS::Shell(getShel.Current()));" << "\n";
+           sprintf(name,"shell%d", i++);
+           DBRep::Set(name,getShel.Current());
+           B.Add(wallSolid,TopoDS::Shell(getShel.Current()));
+           getShel.Next();
+         }
+      }
+    }
+  }
+
+  sprintf(name,"result");
+  DBRep::Set(name,wallSolid);
+
+  // Now calculated the volume of the outside tube.
+  GProp_GProps gprops;
+  BRepGProp::VolumeProperties(wallSolid, gprops);
+  di << "The wallSolid's volume is: " << gprops.Mass() << "\n";
+
+  if (check) {
+    if (!(BRepCheck_Analyzer(wallSolid).IsValid()))
+      di << "The TopoDS_Solid was checked, and it was invalid!" << "\n";
+    else
+      di << "The TopoDS_Solid was checked, and it was valid." << "\n";
+    if (!wallSolid.Closed())
+      di << "The TopoDS_Solid is not closed!" << "\n";
+    else
+      di << "The TopoDS_Solid is closed." << "\n";
+    if (!wallSolid.Checked())
+      di << "The TopoDS_Solid is not checked!" << "\n";
+    else
+      di << "The TopoDS_Solid has been checked." << "\n";
+    if (wallSolid.Infinite())
+      di << "The TopoDS_Solid is infinite!" << "\n";
+    else
+      di << "The TopoDS_Solid is finite." << "\n";
+  }
+
+  di << "The result is a ";
+  // Check to see if we have a solid
+  switch (wallSolid.ShapeType()) {
+  case (TopAbs_COMPOUND):
+    di << "TopAbs_COMPOUND" << "\n";
+    break;
+  case (TopAbs_COMPSOLID):
+    di << "TopAbs_COMPSOLID" << "\n";
+    break;
+  case (TopAbs_SOLID):
+    di << "TopAbs_SOLID" << "\n";
+    break;
+  case (TopAbs_SHELL):
+    di << "TopAbs_SHELL" << "\n";
+    break;
+  case (TopAbs_FACE):
+    di << "TopAbs_FACE" << "\n";
+    break;
+  case (TopAbs_WIRE):
+    di << "TopAbs_WIRE" << "\n";
+    break;
+  case (TopAbs_EDGE):
+    di << "TopAbs_EDGE" << "\n";
+    break;
+  case (TopAbs_VERTEX):
+    di << "TopAbs_VERTEX" << "\n";
+    break;
+  case (TopAbs_SHAPE):
+    di << "TopAbs_SHAPE" << "\n";
+  }
+
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepBndLib.hxx>
+#include <TopTools_Array1OfShape.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepAlgoAPI_Cut.hxx>
+#include <BRepAlgoAPI_Common.hxx>
+//////////#else
+//////////#include <BRepAlgo_Cut.hxx>
+//////////#include <BRepAlgo_Common.hxx>
+//////////#include <BRepAlgoAPI_Cut.hxx>
+//////////#include <BRepAlgoAPI_Common.hxx>
+#include <BRepAlgo_Cut.hxx>
+#include <BRepAlgo_Common.hxx>
+#include <Precision.hxx>
+
+static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  //////////if(argc != 3) {
+  //////////  cout << "Usage : " << argv[0] << " result mesh_delta" << endl;
+  //////////  return 1;        
+  //////////}
+  if(argc < 3 || argc > 4) {
+    di << "Usage : " << argv[0] << " result mesh_delta [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 4) {
+    Standard_Integer IsB = atoi(argv[3]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def02)
+//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
+//      return 1;
+#endif
+#if ! defined(BRepAlgo_def03)
+//      di << "Error: There is not BRepAlgo_Common class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  
+  Standard_Real delt = 5.0*Precision::Confusion();
+  Standard_Real mesh_delt = atof(argv[2]);
+  if (mesh_delt <= 0.0)
+  {
+    di<<"Error: mesh_delta must be positive value"<<"\n";
+    return -1;
+  }
+
+  // Create outer box solid
+  gp_Pnt P(0,0,0);
+  TopoDS_Solid fullSolid = BRepPrimAPI_MakeBox(P, 30.0, 30.0, 30.0).Solid();
+
+  // Create inner box solid
+  P.SetX(10); P.SetY(10); P.SetZ(10);
+  TopoDS_Solid internalSolid = BRepPrimAPI_MakeBox(P, 10.0, 10.0, 10.0).Solid();
+
+  // Cut inner from outer
+//////////#if ! defined(BRepAlgoAPI_def01)
+//////////  BRepAlgoAPI_Cut cut( fullSolid, internalSolid );
+//////////#else
+//////////  BRepAlgo_Cut cut( fullSolid, internalSolid );
+//////////#endif
+//////////  TopoDS_Shape cut_shape = cut.Shape();
+//////////  if ( !cut.IsDone() )
+//////////  {
+//////////    cout << "Error: Could not cut volumes" << endl;
+//////////    return -1;
+//////////  }
+
+  TopoDS_Shape cut_shape;
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Cut cut( fullSolid, internalSolid )" <<"\n";
+    BRepAlgoAPI_Cut cut( fullSolid, internalSolid );
+    cut_shape = cut.Shape();
+    if ( !cut.IsDone() )
+      {
+       di << "Error: Could not cut volumes" << "\n";
+       return -1;
+      }
+  } else {
+    di << "BRepAlgo_Cut cut( fullSolid, internalSolid )" <<"\n";
+    BRepAlgo_Cut cut( fullSolid, internalSolid );
+    cut_shape = cut.Shape();
+    if ( !cut.IsDone() )
+      {
+       di << "Error: Could not cut volumes" << "\n";
+       return -1;
+      }
+  }
+
+  // see if we have a solid
+  Standard_Integer found_solid = 0;
+  TopoDS_Solid cutSolid;
+  TopExp_Explorer Ex;
+  for (Ex.Init(cut_shape, TopAbs_SOLID); Ex.More(); Ex.Next())
+  {
+    TopoDS_Solid sol = TopoDS::Solid(Ex.Current());
+    if (!sol.IsNull()) { cutSolid = sol; found_solid++; }
+  }
+  if ( found_solid != 1 )
+  {
+    di << "Error: Cut operation produced " << found_solid << " solids" << "\n";
+    return -1;
+  }
+  DBRep::Set(argv[1],cutSolid);
+
+  // Calculate initial volume
+  GProp_GProps volumeVProps;
+  BRepGProp::VolumeProperties (cutSolid, volumeVProps);
+  di << "Info: Original volume  = " << volumeVProps.Mass() << "\n";
+
+  //
+  // build bounding box and calculate bounds for initial mesh
+  //
+  Bnd_Box bndBox;
+  BRepBndLib::Add( cutSolid, bndBox );
+  Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
+  bndBox.Get( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
+  Xmin -= delt;
+  Ymin -= delt;
+  Zmin -= delt;
+  Xmax += delt;
+  Ymax += delt;
+  Zmax += delt;
+  di<<"Info: Bounds\n  ("<<Xmin<<","<<Ymin<<","<<Zmin<<")\n  ("<<Xmax<<","<<Ymax<<","<<Zmax<<")"<<"\n";
+
+  // grid the bounding box
+  Standard_Integer NumXsubvolumes = (Xmax - Xmin) / mesh_delt; if (NumXsubvolumes <= 0) NumXsubvolumes = 1;
+  Standard_Integer NumYsubvolumes = (Ymax - Ymin) / mesh_delt; if (NumYsubvolumes <= 0) NumYsubvolumes = 1;
+  Standard_Integer NumZsubvolumes = (Zmax - Zmin) / mesh_delt; if (NumZsubvolumes <= 0) NumZsubvolumes = 1;
+  const Standard_Real StepX = (Xmax - Xmin) / NumXsubvolumes;
+  const Standard_Real StepY = (Ymax - Ymin) / NumYsubvolumes;
+  const Standard_Real StepZ = (Zmax - Zmin) / NumZsubvolumes;
+  const Standard_Integer NumSubvolumes = NumXsubvolumes * NumYsubvolumes * NumZsubvolumes;
+  di << "Info: NumSubvolumesX = " << NumXsubvolumes << "\n";
+  di << "Info: NumSubvolumesY = " << NumYsubvolumes << "\n";
+  di << "Info: NumSubvolumesZ = " << NumZsubvolumes << "\n";
+  di << "Info: NumSubvolumes = " << NumSubvolumes << "\n";
+
+  //
+  // construct initial mesh of cutSolid
+  //
+  TopTools_Array1OfShape SubvolumeSolid(0,NumSubvolumes-1);
+  TColStd_Array1OfReal SubvolumeVol(0,NumSubvolumes-1);
+  Standard_Real accumulatedVolume = 0.0;
+  Standard_Integer i, j, k, l = 0;
+  Standard_Real x = Xmin;
+  for ( i = 0; i < NumXsubvolumes; i++ )
+  {
+    Standard_Real y = Ymin;
+    for ( j = 0; j < NumYsubvolumes; j++ )
+    {
+      Standard_Real z = Zmin;
+      for ( k = 0; k < NumZsubvolumes; k++ )
+      {
+       P.SetX(x);
+       P.SetY(y);
+       P.SetZ(z);
+       TopoDS_Shape aSubvolume = BRepPrimAPI_MakeBox(P, StepX, StepY, StepZ).Solid();
+        di<<"Info: box b_"<<l<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" "<<StepX<<" "<<StepY<<" "<<StepZ<<"\n";
+       if ( aSubvolume.IsNull())
+        {
+         di << "Error: could not construct subvolume " << l << "\n";
+         return 1;
+       }
+       SubvolumeSolid.SetValue(l,aSubvolume);
+       GProp_GProps subvolumeVProps;
+       BRepGProp::VolumeProperties (SubvolumeSolid(l), subvolumeVProps);
+        const Standard_Real vol = subvolumeVProps.Mass();
+       di << "Info: original subvolume " << l << " volume = " << vol << "\n";
+        SubvolumeVol.SetValue(l,vol);
+        accumulatedVolume += vol;
+       l++;
+       z += StepZ;
+      }
+      y += StepY;
+    }
+    x += StepX;
+  }
+  di << "Info: Accumulated mesh volume = " << accumulatedVolume << "\n";
+
+  //  
+  // trim mesh to cutSolid
+  //
+  accumulatedVolume = 0.0;
+  for ( l = 0; l < NumSubvolumes; l++ )
+  {
+    TopoDS_Shape copySolid = BRepBuilderAPI_Copy(cutSolid).Shape();
+
+    // perform common
+//////////#if ! defined(BRepAlgoAPI_def01)
+//////////    BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
+//////////#else
+//////////    BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
+//////////#endif
+//////////    if (!common.IsDone())
+//////////    {
+//////////      cout << "Error: could not construct a common solid " << l << endl;
+//////////      return 1;
+//////////    }
+
+    TopoDS_Shape aCommonShape;
+    if (IsBRepAlgoAPI) {
+      di << "BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l))" <<"\n";
+      BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
+      if (!common.IsDone())
+       {
+         di << "Error: could not construct a common solid " << l << "\n";
+         return 1;
+       }
+      aCommonShape = common.Shape();
+    } else {
+      di << "BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l))" <<"\n";
+      BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
+      if (!common.IsDone())
+       {
+         di << "Error: could not construct a common solid " << l << "\n";
+         return 1;
+       }
+      aCommonShape = common.Shape();
+    }
+
+    // see if we have a solid
+    found_solid = 0;
+    TopoDS_Shape commonShape;
+    //////////for (Ex.Init(common.Shape(), TopAbs_SOLID); Ex.More(); Ex.Next())
+    for (Ex.Init(aCommonShape, TopAbs_SOLID); Ex.More(); Ex.Next())
+    {
+      TopoDS_Solid sol = TopoDS::Solid(Ex.Current());
+      if (!sol.IsNull()) { commonShape = sol; found_solid++; }
+    }
+    if ( found_solid != 1 )
+    {
+      di << "Info: Common operation " << l << " produced " << found_solid << " solids" << "\n";
+    }
+    else
+    {
+      SubvolumeSolid.SetValue(l,commonShape);
+      GProp_GProps subvolumeVProps;
+      BRepGProp::VolumeProperties (SubvolumeSolid(l), subvolumeVProps);
+      const Standard_Real vol = subvolumeVProps.Mass();
+      const Standard_Boolean err = (vol > SubvolumeVol(l)) || (vol <= 0.0);
+      //cout << (err? "ERROR" : "Info") << ": final subvolume " << l << " volume = " << vol << endl;
+      if (err)
+       di << "ERROR" << ": final subvolume " << l << " volume = " << vol << "\n";
+      else
+       di << "Info" << ": final subvolume " << l << " volume = " << vol << "\n";
+      accumulatedVolume += vol;
+      if (err)
+      {
+        char astr[80];
+        sprintf(astr,"e_%d",l);
+        DBRep::Set(astr,commonShape);
+      }
+    }
+  }
+  di << "Info: Accumulated meshed volume = " << accumulatedVolume << "\n";
+
+  return 0;    
+}
+
+void QABugs::Commands_13(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC332", "OCC332 [wall_thickness [dia1 [dia2 [length [major_radius]]]]]", __FILE__, OCC332bug, group);
+  //////theCommands.Add("OCC544", "OCC544 [[[[[wT [[[[d1 [[[d2 [[R [length]]]]]", __FILE__, OCC544, group);
+  theCommands.Add("OCC544", "OCC544 [[[[[wT [[[[d1 [[[d2 [[R [length [BRepAlgoAPI/BRepAlgo = 1/0]]]]]]", __FILE__, OCC544, group);
+  //////theCommands.Add("OCC817", "OCC817 result mesh_delta", __FILE__, OCC817, group);
+  theCommands.Add("OCC817", "OCC817 result mesh_delta [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC817, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_14.cxx b/src/QABugs/QABugs_14.cxx
new file mode 100644 (file)
index 0000000..448917e
--- /dev/null
@@ -0,0 +1,1111 @@
+// Created on: 2002-03-19
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <stdio.h>
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Geom2d_Line.hxx>
+#include <TColgp_Array1OfPnt2d.hxx>
+#include <Geom2d_BezierCurve.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dGcc_QualifiedCurve.hxx>
+#include <Geom2dGcc_Circ2d2TanRad.hxx>
+#include <Geom2d_Circle.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <gp_Lin.hxx>
+#include <BRepFeat_SplitShape.hxx>
+#include <DBRep_DrawableShape.hxx>
+#include <BRep_Builder.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <BRepExtrema_DistShapeShape.hxx>
+#include <Draw.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <BRepLib_MakeVertex.hxx>
+#include <BRepLib_MakeEdge.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <GeomAPI_Interpolate.hxx>
+#include <Precision.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <OSD_Path.hxx>
+#include <ShapeBuild_ReShape.hxx>
+#include <ShapeExtend_WireData.hxx>
+#include <TopoDS_Wire.hxx>
+#include <ShapeExtend_WireData.hxx>
+#include <ShapeFix_Wire.hxx>
+#include <ShapeAnalysis_WireOrder.hxx>
+#include <ShapeAnalysis_Wire.hxx>
+#include <TopExp.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BRep_Tool.hxx>
+#include <ShapeAnalysis_Curve.hxx>
+#include <V3d_View.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  Standard_Character abuf[16];
+
+  Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(100, 0), gp_Dir2d(-1, 0));
+  sprintf(abuf,"line");
+  Standard_CString st = abuf;
+  DrawTrSurf::Set (st, aLine);
+
+  TColgp_Array1OfPnt2d aPoints(1, 3);
+  aPoints.SetValue(1, gp_Pnt2d(0, 0));
+  aPoints.SetValue(2, gp_Pnt2d(50, 50));
+  aPoints.SetValue(3, gp_Pnt2d(0, 100));
+  Handle(Geom2d_BezierCurve) aCurve = new Geom2d_BezierCurve(aPoints);
+  sprintf(abuf,"curve");
+  DrawTrSurf::Set (st, aCurve);
+
+  Geom2dAdaptor_Curve aCLine(aLine);
+  Geom2dAdaptor_Curve aCCurve(aCurve);
+  Geom2dGcc_QualifiedCurve aQualifCurve1(aCLine, GccEnt_outside);
+  Geom2dGcc_QualifiedCurve aQualifCurve2(aCCurve, GccEnt_outside);
+  Geom2dGcc_Circ2d2TanRad aGccCirc2d(aQualifCurve1, aQualifCurve2, 10, 1e-7);
+  if(!aGccCirc2d.IsDone())
+  {
+    di << "Faulty: can not create a circle." << "\n";
+    return 1;
+  }
+  for(Standard_Integer i = 1; i <= aGccCirc2d.NbSolutions(); i++)
+  {
+    gp_Circ2d aCirc2d = aGccCirc2d.ThisSolution(i);
+    di << "circle : X " << aCirc2d.Location().X() << " Y " << aCirc2d.Location().Y() << " R " << aCirc2d.Radius();
+    Standard_Real aTmpR1, aTmpR2;
+    gp_Pnt2d aPnt2d1, aPnt2d2;
+    aGccCirc2d.Tangency1(i, aTmpR1, aTmpR2, aPnt2d1);
+    aGccCirc2d.Tangency2(i, aTmpR1, aTmpR2, aPnt2d2);
+    di << "\n" << "tangency1 : X " << aPnt2d1.X() << " Y " << aPnt2d1.Y();
+    di << "\n" << "tangency2 : X " << aPnt2d2.X() << " Y " << aPnt2d2.Y() << "\n";
+    
+    sprintf(abuf,"circle_%d",i);
+    Handle(Geom2d_Curve) circ_res = new Geom2d_Circle(aCirc2d);
+    DrawTrSurf::Set (st, circ_res);
+  }
+
+  di << "done" << "\n";
+  return 0;
+}
+
+static Standard_Integer BUC60889 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 10) {
+    di << "Usage : " << argv[0] << " point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2" << "\n";
+    return 1;
+  } else {
+    gp_Pnt p1, p2;
+    if (!(DrawTrSurf::GetPoint(argv[1], p1)) || !(DrawTrSurf::GetPoint(argv[2], p2)))
+    {
+      di << "Need two points to define a band" << "\n";
+      return 1;
+    }
+    TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(argv[3]));
+    if (ed.IsNull())
+    {
+      di << "Need an edge to define the band direction" << "\n";
+      return 1;
+    }
+    BRepAdaptor_Curve curve(ed);
+    gp_Dir d = curve.Line().Direction();
+    Bnd_Box bnd_box;
+    bnd_box.Update(atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7]), atof(argv[8]), atof(argv[9]));
+    if(bnd_box.IsOut(p1, p2, d))
+      di << "The band lies out of the box" << "\n";
+    else
+      di << "The band intersects the box" << "\n";
+    
+    return 0;
+  }
+}
+
+static Standard_Integer BUC60852 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 8)
+    di << "Usage : " << argv[0] << " name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2" << "\n";
+  else {
+    TopoDS_Edge shape = TopoDS::Edge(DBRep::Get(argv[1]));
+    if(shape.ShapeType() != TopAbs_EDGE)
+      di << "shape must be an edge" << "\n";
+    else {
+      BRepAdaptor_Curve curve(shape);
+      gp_Lin lin = curve.Line();
+      Bnd_Box bnd_box;
+      bnd_box.Update(atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7]));
+      if(bnd_box.IsOut(lin))
+       di << "Line that lies on edge does not intersect the box" << "\n";
+      else
+       di << "Line that lies on edge intersects the box" << "\n";
+    }
+  }
+  return 0;
+}
+
+static Standard_Integer BUC60854 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv)
+{
+  Standard_Integer newnarg;
+  if (argc < 3) return 1;
+  TopoDS_Shape S = DBRep::Get(argv[2]);
+  BRepFeat_SplitShape Spls(S);
+  Standard_Boolean pick = Standard_False;
+  TopoDS_Shape EF;
+  Standard_Real u,v;
+  Standard_Integer i = 3;
+  for ( newnarg=3; newnarg<argc; newnarg++) {
+    if (argv[newnarg][0] == '@') {
+      break;
+    }
+  }
+  if (newnarg == 3 || 
+      (newnarg !=argc && ((argc-newnarg)<=2 || (argc-newnarg)%2 != 1))) {
+    return 1;
+  }
+  if (i<newnarg) {
+    pick = (argv[i][0] == '.');
+    EF = DBRep::Get(argv[i],TopAbs_FACE);
+    if (EF.IsNull()) return 1;
+  }
+  while (i < newnarg) {
+    if (pick) {
+      DBRep_DrawableShape::LastPick(EF,u,v);
+    }
+    if (EF.ShapeType() == TopAbs_FACE) {
+      i++;
+      while (i < newnarg) {
+       TopoDS_Shape W;
+       Standard_Boolean rever = Standard_False;
+       if (argv[i][0] == '-') {
+         if (argv[i][1] == '\0')
+           return 1;
+         pick = (argv[i][1] == '.');
+         const char* Temp = argv[i]+1;
+         W = DBRep::Get(Temp,TopAbs_SHAPE,Standard_False);
+         rever = Standard_True;
+       }
+       else {
+         pick = (argv[i][0] == '.');
+         W = DBRep::Get(argv[i],TopAbs_SHAPE,Standard_False);
+       }
+       if (W.IsNull()) {
+         return 1;
+       }
+       TopAbs_ShapeEnum wtyp = W.ShapeType();
+       if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE && pick) {
+         Standard_Real u,v;
+         DBRep_DrawableShape::LastPick(W,u,v);
+         wtyp = W.ShapeType();
+       }
+       if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE) {
+         EF = DBRep::Get(argv[i]);
+         break;
+       }
+       else {
+         if (rever) {
+           W.Reverse();
+         }
+         if (wtyp == TopAbs_WIRE) {
+           Spls.Add(TopoDS::Wire(W),TopoDS::Face(EF));
+         }
+         else {
+           Spls.Add(TopoDS::Edge(W),TopoDS::Face(EF));
+         }
+       }
+       i++;
+      }
+    }
+    else
+      return 1;
+  }
+  for (i++; i<argc; i+=2) {
+    TopoDS_Shape Ew,Es;
+    TopoDS_Shape aLocalShape(DBRep::Get(argv[i],TopAbs_EDGE));
+    Es = TopoDS::Edge(aLocalShape);
+    if (Es.IsNull()) {
+      return 1;
+    }
+    aLocalShape = DBRep::Get(argv[i+1],TopAbs_EDGE);
+    Ew = TopoDS::Edge(aLocalShape);
+    if (Ew.IsNull()) {
+      return 1;
+    }
+    Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es));
+  }
+  Spls.Build();
+  const TopTools_ListOfShape& aLeftPart = Spls.Left();
+  BRep_Builder BB;
+  TopoDS_Shape aShell;
+  BB.MakeShell(TopoDS::Shell(aShell));
+  TopTools_ListIteratorOfListOfShape anIter(aLeftPart);
+  for(; anIter.More(); anIter.Next()) BB.Add(aShell, anIter.Value());
+  DBRep::Set(argv[1],aShell);
+  return 0;
+}
+
+static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Standard_Integer i1;
+  if (argc != 5) {
+    di << "Usage : " << argv[0] << " result name_of_shape_1 name_of_shape_2 dev" << "\n";
+    return 1;
+  }
+  const char *ns1 = (argv[2]), *ns2 = (argv[3]), *ns0 = (argv[1]);
+  TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2))  ;
+  Standard_Real dev =  atof(argv[4]);
+  BRepExtrema_DistShapeShape dst(S1 ,S2, dev );
+  if (dst.IsDone()) {
+    char named[100];
+    sprintf(named, "%s%s" ,ns0,"_val");
+    char* tempd = named;
+    Draw::Set(tempd,dst.Value());
+    di << named << " ";
+    for (i1=1; i1<= dst.NbSolution(); i1++) {
+      gp_Pnt P1,P2;
+      P1 = (dst.PointOnShape1(i1));
+      P2 = (dst.PointOnShape2(i1));
+      if (dst.Value()<=1.e-9) {
+       TopoDS_Vertex V =BRepLib_MakeVertex(P1);
+       char namev[100];
+       if (i1==1) {
+         sprintf(namev, "%s" ,ns0);
+       } else {
+         sprintf(namev, "%s%d" ,ns0,i1);
+       }
+       char* tempv = namev;
+       DBRep::Set(tempv,V);
+       di << namev << " ";
+      } else {
+       char name[100];
+       TopoDS_Edge E = BRepLib_MakeEdge (P1, P2);
+       if (i1==1) {
+         sprintf(name,"%s",ns0);
+       } else {
+         sprintf(name,"%s%d",ns0,i1);
+       }
+       char* temp = name;
+       DBRep::Set(temp,E);
+       di << name << " " ;
+      }
+    }
+  } else {
+    di << "Faulty : found a problem"<< "\n";
+  }
+  return 0;
+}
+
+static Standard_Integer BUC60902 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1,5);
+  gp_Pnt aP(0., 0., 0.);
+  for(Standard_Integer i = 1; i <= 5; i++) {
+    aP.SetX((i-1)*1.57);
+    aP.SetY(Sin((i-1)*1.57));
+    aPnts->SetValue(i, aP);
+  }
+  GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion());
+  anInterpolater.Perform(); 
+  if(!anInterpolater.IsDone()) {
+    di << "Faulty : error in interpolation" << "\n";
+    return 1;
+  }
+  Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve(); 
+  gp_Vec aFirstTang, aLastTang;
+  aCur->D1(aCur->FirstParameter(), aP, aFirstTang);
+  aCur->D1(aCur->LastParameter(), aP, aLastTang);
+  di << " Used Tang1 = " << aFirstTang.X() << " " << aFirstTang.Y() << " " << aFirstTang.Z() << "\n"; 
+  di << " Used Tang2 = " << aLastTang.X() << " " << aLastTang.Y() << " " << aLastTang.Z() << "\n"; 
+  GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion());
+  anInterpolater1.Load(aFirstTang, aLastTang, Standard_False); 
+  anInterpolater1.Perform(); 
+  if(!anInterpolater1.IsDone()) {
+    di << "Faulty : error in interpolation 1" << "\n";
+    return 1;
+  }
+  aCur = anInterpolater1.Curve();
+  gp_Vec aFirstTang1, aLastTang1;
+  aCur->D1(aCur->FirstParameter(), aP, aFirstTang1);
+  aCur->D1(aCur->LastParameter(), aP, aLastTang1);
+  di << " Tang1 after compute = " << aFirstTang1.X() << " " << aFirstTang1.Y() << " " << aFirstTang1.Z() << "\n"; 
+  di << " Tang2 after compute = " << aLastTang1.X() << " " << aLastTang1.Y() << " " << aLastTang1.Z() << "\n"; 
+  if(aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular())) {
+    di << "First tangent is OK" << "\n";
+  }
+  else {
+    di << "Faulty : first tangent is wrong" << "\n";
+  }
+  if(aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular())) {
+    di << "Last tangent is OK" << "\n";
+  }
+  else {
+    di << "Faulty : last tangent is wrong" << "\n";
+  }
+  return 0;
+}
+
+static Standard_Integer BUC60944 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " path" << "\n";
+  }
+
+  TCollection_AsciiString in(argv[1]);
+  OSD_Path* aPath = new OSD_Path(in);
+  TCollection_AsciiString out;
+  aPath->SystemName(out);
+  if(in == out) 
+    di << "The convertion is right." << "\n";
+  else
+    di << "Faulty : The convertion is incorrect : " << out.ToCString() << "\n";
+  di << out.ToCString() << "\n";
+//  cout << aPath->Trek() << " !" << endl;
+  return 0;
+}
+
+Standard_Boolean BuildWiresWithReshape
+                (const Handle(ShapeBuild_ReShape)& theReshape,
+                 const TopTools_ListOfShape &theListOfEdges,
+                 TopTools_ListOfShape       &theListOfWires,
+                 const Standard_Boolean      isFixConnectedMode,
+                 const Standard_Boolean      isKeepLoopsMode,
+                 const Standard_Real         theTolerance)
+{
+  TopTools_ListIteratorOfListOfShape anEdgeIter;
+  Standard_Boolean                   isDone;
+  TopoDS_Wire                        aWire;
+
+  theListOfWires.Clear();
+  Handle(ShapeExtend_WireData) aWireData  = new ShapeExtend_WireData;
+  Handle(ShapeFix_Wire) aShFixWire = new ShapeFix_Wire;
+  aShFixWire->SetContext (theReshape);
+
+  Handle(ShapeAnalysis_Wire) aWireAnalyzer;
+  ShapeAnalysis_WireOrder aWireOrder;
+
+  aShFixWire->Load(aWireData);
+  aShFixWire->SetPrecision(theTolerance);
+
+  for(anEdgeIter.Initialize(theListOfEdges); anEdgeIter.More(); anEdgeIter.Next())
+    aWireData->Add(TopoDS::Edge(anEdgeIter.Value()));
+
+  aWireOrder.KeepLoopsMode() = isKeepLoopsMode;
+  aWireAnalyzer = aShFixWire->Analyzer();
+  aWireAnalyzer->CheckOrder(aWireOrder, Standard_True);
+
+  aShFixWire->FixReorder(aWireOrder);
+  isDone = !aShFixWire->StatusReorder(ShapeExtend_FAIL);
+  if (!isDone)
+    return Standard_False;
+
+  if (isFixConnectedMode)
+  {
+    aShFixWire->ModifyTopologyMode() = Standard_True;
+    aShFixWire->FixConnected(theTolerance);
+  }
+
+  aWire = aWireData->Wire();
+
+//   if (aWire.Closed())
+//   {
+//     theListOfWires.Append(aWire);
+//     return Standard_True;
+//   }
+
+  Standard_Integer i;
+  BRep_Builder     aBuilder;
+  TopoDS_Wire      aCurWire;
+  TopoDS_Vertex    aVf;
+  TopoDS_Vertex    aVl;
+  TopoDS_Vertex    aVlast;
+  Standard_Integer aNbEdges = aWireData->NbEdges();
+
+  aBuilder.MakeWire(aCurWire);
+  if (aNbEdges >= 1)
+  {
+    TopoDS_Edge anE = aWireData->Edge(1);
+    TopExp::Vertices(anE, aVf, aVlast, Standard_True);
+    aBuilder.Add(aCurWire, anE);
+  }
+
+  for(i = 2; i <= aNbEdges; i++)
+  {
+    TopoDS_Edge anE = aWireData->Edge(i);
+    TopExp::Vertices(anE, aVf, aVl, Standard_True);
+    if (aVf.IsSame(aVlast))
+    {
+      aBuilder.Add(aCurWire, anE);
+      aVlast = aVl;
+    }
+    else
+    {
+      aVlast = aVl;
+      TopExp::Vertices(aCurWire, aVf, aVl);
+      if (aVf.IsSame(aVl))
+        aCurWire.Closed(Standard_True);
+      theListOfWires.Append(aCurWire);
+      aBuilder.MakeWire(aCurWire);
+      aBuilder.Add(aCurWire, anE);
+    }
+  }
+
+  TopExp::Vertices(aCurWire, aVf, aVl);
+  if (aVf.IsSame(aVl))
+    aCurWire.Closed(Standard_True);
+  theListOfWires.Append(aCurWire);
+
+  return Standard_True;
+}
+
+Standard_Boolean BuildWires(const TopTools_ListOfShape &theListOfEdges,
+                                     TopTools_ListOfShape       &theListOfWires,
+                                     const Standard_Boolean      isFixConnectedMode = Standard_False,
+                                     const Standard_Boolean      isKeepLoopsMode = Standard_True,
+                                     const Standard_Real         theTolerance = Precision::Confusion())
+{
+  Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
+  return BuildWiresWithReshape (aReshape, theListOfEdges, theListOfWires,
+                                isFixConnectedMode, isKeepLoopsMode, theTolerance);
+}
+
+Standard_Boolean BuildBoundWires(const TopoDS_Shape   &theShell,
+                                          TopTools_ListOfShape &theListOfWires)
+{
+  TopTools_IndexedDataMapOfShapeListOfShape
+                               anEdgeFaceMap;
+  Standard_Integer             i;
+  Standard_Boolean             isBound;
+  TopTools_ListOfShape         aBoundaryEdges;
+
+  TopExp::MapShapesAndAncestors(theShell, TopAbs_EDGE, TopAbs_FACE, anEdgeFaceMap);
+
+  isBound = Standard_False;
+  for (i = 1; i <= anEdgeFaceMap.Extent(); i++)
+  {
+    const TopTools_ListOfShape &anAncestFaces = anEdgeFaceMap.FindFromIndex(i);
+    if (anAncestFaces.Extent() == 1)
+    {
+      const TopoDS_Edge &anEdge = TopoDS::Edge(anEdgeFaceMap.FindKey(i));
+      if (!BRep_Tool::Degenerated(anEdge))
+      {
+        aBoundaryEdges.Append(anEdge);
+        isBound = Standard_True;
+      }
+    }
+  }
+
+  if (!isBound)
+    return Standard_True;
+
+  return BuildWires(aBoundaryEdges, theListOfWires);
+}
+
+static Standard_Integer BUC60868 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 3) {
+    di << "Usage : " <<argv[0] << " Result Shell" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aShell = DBRep::Get(argv[2]);
+
+  if (aShell.IsNull()) {
+    di << "Faulty : The shape is NULL" << "\n";
+    return 1;
+  }
+
+  TopTools_ListOfShape               aListOfWires;
+  BuildBoundWires(aShell, aListOfWires);
+
+  TopoDS_Shape aRes;
+  if (aListOfWires.IsEmpty())
+    di << "no bound" << "\n";
+  else if (aListOfWires.Extent() == 1)
+    aRes = aListOfWires.First();
+  else {
+    BRep_Builder aBld;
+    aBld.MakeCompound (TopoDS::Compound(aRes));
+    TopTools_ListIteratorOfListOfShape aWireIter (aListOfWires);
+    for(; aWireIter.More(); aWireIter.Next())
+      aBld.Add (aRes, aWireIter.Value());
+  }
+
+  DBRep::Set(argv[1], aRes);
+  return 0;
+}
+
+static Standard_Integer BUC60924 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 5) {
+    di << "Usage : " <<argv[0] << " curve X Y Z" << "\n";
+    return 1;
+  }
+
+  Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]);
+
+  if (aCurve.IsNull()) {
+    di << "Faulty : the curve is NULL." << "\n";
+    return 1;
+  }
+  
+  gp_XYZ aVec(atof(argv[2]),atof(argv[3]),atof(argv[4]));
+  
+  Standard_Boolean isPlanar=Standard_False;
+  isPlanar=ShapeAnalysis_Curve::IsPlanar(aCurve,aVec,1e-7);
+  
+  if(isPlanar)
+    di << "The curve is planar !" << "\n";
+  else 
+    di << "Faulty : the curve is not planar!" << "\n";
+  
+  return 0;
+}
+
+static Standard_Integer  BUC60920(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    cerr << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  di.Eval("box b 10 10 10");
+  di.Eval("box w 20 20 20");
+  di.Eval("explode w e");
+
+  di.Eval(" vdisplay b");
+  di.Eval("vsetdispmode 1");
+
+  const char * Shname="w_11";
+  TopoDS_Shape theShape =  DBRep::Get(Shname);
+
+  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
+  myAISContext->Display( anAISShape, Standard_True );
+  
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  
+  double Xv,Yv;
+  myV3dView->Project(20,20,0,Xv,Yv);
+//  cout<<Xv<<"\t"<<Yv<<endl;
+  
+  Standard_Integer Xp,Yp;
+  myV3dView->Convert(Xv,Yv,Xp,Yp);
+//  cout<<Xp<<"\t"<<Yp<<endl;
+
+  myAISContext->MoveTo( Xp,Yp, myV3dView  );
+  myAISContext->MoveTo( Xp,Yp, myV3dView  );
+
+//   if (myAISContext->IsHilighted(anAISShape)) 
+//              cout << "has hilighted shape : OK"   << endl;
+//   else       cout << "has hilighted shape : bugged - Faulty "   << endl;
+  
+  return 0;
+}
+
+#include <LDOMParser.hxx>
+static Standard_Integer  OCC983 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2) {
+    di << "Usage : " << argv[0] << " file" << "\n";
+    return 1;
+  }
+
+  LDOMParser aParser;
+  LDOM_Document myDOM;
+
+  const char *File = (argv[1]);
+
+  if(!aParser.parse(File)) {
+    myDOM=aParser.getDocument();
+    di<<"Document parsed"<<"\n";
+  } else {
+    di<<"Document not parsed"<<"\n";
+    return 0;
+  }
+
+  LDOM_Element root = myDOM.getDocumentElement();
+
+  if ( root.isNull() ) {
+    di<<"Root element is null"<<"\n";
+    return 0;
+  }
+
+  TCollection_AsciiString RootName = root.getTagName();
+  di << "   RootName = " << RootName.ToCString() << "\n";
+  LDOM_NodeList aChildList = root.GetAttributesList();
+  for(Standard_Integer i=0,n=aChildList.getLength();i<n;i++) {
+    LDOM_Node item = aChildList.item(i);
+    TCollection_AsciiString itemName = item.getNodeName();
+    TCollection_AsciiString itemValue = item.getNodeValue();
+    di << "       AttributeName = " << itemName.ToCString() << "\n";
+    di << "       AttributeValue = " << itemValue.ToCString() << "\n";
+  }
+
+//  LDOM_Element element;
+//  for ( element = (const LDOM_Element&) root.getFirstChild();
+//       !element.isNull();
+//       element = (const LDOM_Element&) element.getNextSibling() ) {
+  LDOM_Element element;
+  LDOM_Node    node;
+  for ( node = root.getFirstChild(), element = (const LDOM_Element&) node;
+       !element.isNull();
+       node = element.getNextSibling(), element = (const LDOM_Element&) node) {
+    TCollection_AsciiString ElementName = element.getTagName();
+    di << "   ElementName = " << ElementName.ToCString() << "\n";
+    LDOM_NodeList aChildList2 = element.GetAttributesList();
+    for(Standard_Integer i2=0,n2=aChildList2.getLength();i2<n2;i2++) {
+      LDOM_Node item2 = aChildList2.item(i2);
+      TCollection_AsciiString itemName2 = item2.getNodeName();
+      TCollection_AsciiString itemValue2 = item2.getNodeValue();
+      di << "       AttributeName = " << itemName2.ToCString() << "\n";
+      di << "       AttributeValue = " << itemValue2.ToCString() << "\n";
+    }
+  }
+
+  return 0;
+}
+
+static Standard_Integer  OCC984 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2) {
+    di << "Usage : " << argv[0] << " file" << "\n";
+    return 1;
+  }
+
+  LDOMParser aParser;
+  LDOM_Document myDOM;
+
+  //Standard_Character  *File = new Standard_Character [100];
+  //sprintf(File,"%s",argv[1]);
+  const char *File = (argv[1]);
+
+  if(!aParser.parse(File)) {
+    myDOM=aParser.getDocument();
+    di<<"Document parsed"<<"\n";
+  } else {
+    di<<"Document not parsed"<<"\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC1786 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 2)
+  {
+    di << "Usage : " << argv[0] << " AutoHilight=0/1" << "\n";
+    return 1;
+  }
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+  {
+    cerr << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  Standard_Integer AutoHilightInteger =  atoi(argv[1]);
+  Standard_Boolean AutoHilightBoolean = Standard_False;
+  if (AutoHilightInteger != 0) {
+     AutoHilightBoolean = Standard_True;
+  }
+  aContext->SetAutomaticHilight(AutoHilightBoolean);
+  return 0;
+}
+
+//#include <math.h>
+// See QAOCC.cxx OCC6143
+//static Standard_Integer OCC1723 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv)
+//{
+//  if( argc != 1)
+//  {
+//    cout << "Usage : " << argv[0] << endl;
+//    return 1;
+//  }
+//
+//  Standard_Boolean isBad = Standard_False, isCaught;
+//
+//  // Case 1
+//  isCaught = Standard_False;
+//  {
+//    try {
+//      OCC_CATCH_SIGNALS
+//      Standard_Integer a = 1;
+//      Standard_Integer b = 0;
+//      Standard_Integer c = a / b;
+//    }
+//    catch ( Standard_Failure ) {
+//      isCaught = Standard_True;
+//      cout << "OCC1723 Case 1 : OK" << endl;
+//    }
+//  }
+//  isBad = isBad || !isCaught;
+//
+//  // Case 2
+//  isCaught = Standard_False;
+//  {
+//    try {
+//      OCC_CATCH_SIGNALS
+//      Standard_Real d = -1.0;
+//      Standard_Real e = sqrt(d);
+//    }
+//    catch ( Standard_Failure ) {
+//      isCaught = Standard_True;
+//      cout << "OCC1723 Case 2 : OK" << endl;
+//    }
+//  }
+//  isBad = isBad || !isCaught;
+//
+//  // Case 3
+//  isCaught = Standard_False;
+//  {
+//    try {
+//      OCC_CATCH_SIGNALS
+//      Standard_Real f = 1.0e-200;
+//      Standard_Real g = 1.0e-200;
+//      Standard_Real h = f * g;
+//    }
+//    catch ( Standard_Failure ) {
+//      isCaught = Standard_True;
+//      cout << "OCC1723 Case 3 : OK" << endl;
+//    }
+//  }
+//  // MSV: underflow is not caught
+//  //isBad = isBad || !isCaught;
+//
+//  // Case 4
+//  isCaught = Standard_False;
+//  {
+//    try {
+//      OCC_CATCH_SIGNALS
+//      Standard_Real i = 1.0e+200;
+//      Standard_Real j = 1.0e+200;
+//      Standard_Real k = i * j;
+//    }
+//    catch ( Standard_Failure ) {
+//      isCaught = Standard_True;
+//      cout << "OCC1723 Case 4 : OK" << endl;
+//    }
+//  }
+//  isBad = isBad || !isCaught;
+//
+//  if (isBad) {
+//    cout << "OCC1723 : Error" << endl;
+//  } else {
+//    cout << "OCC1723 : OK" << endl;
+//  }
+//
+//  return 0;
+//}
+
+#include <locale.h>
+static Standard_Integer OCC1919_get (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+  const TCollection_AsciiString anOldNumLocale =
+    (Standard_CString) setlocale (LC_NUMERIC, NULL);
+  di << "LC_NUMERIC = " << anOldNumLocale.ToCString() << "\n";
+  return 0;
+}
+static Standard_Integer OCC1919_set (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 2)
+  {
+    di << "Usage : " << argv[0] << " LC_NUMERIC" << "\n";
+    return 1;
+  }
+  TCollection_AsciiString aNumLocale(argv[1]);
+  setlocale(LC_ALL, "") ;
+  setlocale(LC_NUMERIC, aNumLocale.ToCString()) ;
+  return 0;
+}
+#include <DDF.hxx>
+#include <TDF_Label.hxx>
+#include <TDataStd_Real.hxx>
+#include <NCollection_BaseMap.hxx>
+static Standard_Integer OCC1919_real (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc == 4) {
+    Handle(TDF_Data) DF;
+    if (!DDF::GetDF(argv[1],DF)) return 1;
+    TDF_Label L;
+    DDF::AddLabel(DF, argv[2], L);
+
+    //TDataStd_Real::Set(L,atof(arg[3]));
+    TCollection_AsciiString AsciiStringReal(argv[3]);
+    if (!AsciiStringReal.IsRealValue()) return 1;
+    Standard_Real aReal = AsciiStringReal.RealValue();
+    di << "aReal = " << aReal << "\n";
+
+    TDataStd_Real::Set(L,aReal);
+    return 0;
+  }
+  return 1;
+}
+
+#include <TDataStd_UAttribute.hxx>
+static Standard_Integer OCC2932_SetIDUAttribute (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 5)
+  {
+    di << "Usage : " << argv[0] << " (DF, entry, oldLocalID, newLocalID)" << "\n";
+    return 1;
+  }
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) return 1; 
+  TDF_Label label;
+  if( !DDF::FindLabel(DF, argv[2], label) ) {
+    di << "No label for entry " << argv[2] << "\n";
+    return 0;
+  }
+  Standard_GUID old_guid(argv[3]);  //"00000000-0000-0000-2222-000000000000");
+  Standard_GUID new_guid(argv[4]);  //"00000000-0000-0000-2222-000000000001");
+
+  Handle(TDataStd_UAttribute) UA;    
+  if( !label.FindAttribute(old_guid, UA) ) {
+    di << "No UAttribute Attribute on label " << argv[2] << "\n";
+    return 0;
+  }
+  Handle(TDataStd_UAttribute) anotherUA;    
+  if( label.FindAttribute(new_guid, anotherUA) ) {
+    di << "There is this UAttribute Attribute on label " << argv[2] << "\n";
+    return 0;
+  }
+  UA->SetID(new_guid);
+  return 0;  
+}
+
+static Standard_Integer OCC2932_SetTag (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 4)
+  {
+    di << "Usage : " << argv[0] << " (DF, entry, Tag)" << "\n";
+    return 1;
+  }
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) return 1;
+  TDF_Label L;
+  DDF::AddLabel(DF, argv[2], L);
+  Standard_Integer Tag = atoi(argv[3]);
+  Handle(TDF_TagSource) A = TDF_TagSource::Set(L);
+  A->Set(Tag);
+  return 0;
+}
+
+#include <TDataStd_Current.hxx>
+static Standard_Integer OCC2932_SetCurrent (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 3)
+  {
+    di << "Usage : " << argv[0] << " (DF, entry)" << "\n";
+    return 1;
+  }
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) return 1;
+  TDF_Label L;
+  DDF::AddLabel(DF, argv[2], L);
+  TDataStd_Current::Set(L);  
+  return 0;
+}
+
+#include <TDataStd_Expression.hxx>
+static Standard_Integer OCC2932_SetExpression (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 4)
+  {
+    di << "Usage : " << argv[0] << " (DF, entry, Expression)" << "\n";
+    return 1;
+  }
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) return 1;
+  TDF_Label L;
+  DDF::AddLabel(DF, argv[2], L);
+  TCollection_ExtendedString Expression(argv[3]);
+  Handle(TDataStd_Expression) A = TDataStd_Expression::Set(L);
+  A->SetExpression(Expression);
+  return 0;
+}
+
+#include <TDataStd_Relation.hxx>
+static Standard_Integer OCC2932_SetRelation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 4)
+  {
+    di << "Usage : " << argv[0] << " (DF, entry, Relation)" << "\n";
+    return 1;
+  }
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) return 1;
+  TDF_Label L;
+  DDF::AddLabel(DF, argv[2], L);
+  TCollection_ExtendedString Relation(argv[3]);
+  Handle(TDataStd_Relation) A = TDataStd_Relation::Set(L);
+  A->SetRelation(Relation);
+  return 0;
+}
+
+static Standard_Integer OCC3277 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if( argc != 2)
+  {
+    di << "Usage : " << argv[0] << " string" << "\n";
+    return 1;
+  }
+  TCollection_ExtendedString ExtendedString;
+  TCollection_ExtendedString InputString(argv[1]);
+  ExtendedString.Cat(InputString);
+  //ExtendedString.Print(cout);
+  Standard_SStream aSStream;
+  ExtendedString.Print(aSStream);
+  di << aSStream;
+  return 0;
+}
+
+static Standard_Integer OCC6794 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc > 2)
+    {
+      di << "Usage: " << argv[0] << " [nb]" << "\n";
+      return 1;
+    }
+
+  char* max = ::getenv( "MMGT_THRESHOLD" );
+  
+  Standard_Integer aNb = 1;
+  if ( max )
+    aNb += atoi( max );
+  else
+    aNb += 40000;
+
+  if ( argc > 1 )
+    aNb = atoi( argv[1] );
+
+  di << "Use nb = " << aNb << "\n";
+
+  const char* c = "a";
+  {
+    TCollection_AsciiString anAscii;
+    for ( int i = 1; i <= aNb; i++ ) {
+      anAscii += TCollection_AsciiString( c );
+    }
+    Standard_Integer aLength = anAscii.Length();
+    di << "aLength = " << aLength << "\n";
+  }
+  return 0;
+}
+
+static Standard_Integer OCC16485 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc > 1)
+    {
+      di << "Usage: " << argv[0] << "\n";
+      return 1;
+    }
+
+  // Create points with X co-ordinate from varying from 0. to 1000.
+  // anc compute cumulative bounding box by adding boxes for all the 
+  // points, enlarged on tolerance
+  
+  Standard_Real tol = 1e-3;
+  int nbstep = 1000;
+  Bnd_Box Box;
+  for ( int i=0; i <= nbstep; i++ )
+  {
+    gp_Pnt p(i, 0., 0.);
+    Bnd_Box B;
+    B.Add(p);
+    B.Enlarge(tol);
+    B.Add ( Box ); 
+    Box = B; // in this case XMin of Box will grow each time
+  }
+  
+  Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
+  Box.Get (xmin, ymin, zmin, xmax, ymax, zmax);
+  //cout.precision(16);
+  //cout << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << endl;
+  di << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << "\n";
+  if ( Abs ( xmin + tol ) > 1e-10 )
+      di << "TEST FAILED: Xmin must be equal to -1e3!\n";
+  else
+      di << "TEST OK\n";
+      //cout << "TEST FAILED: Xmin must be equal to -1e3!" << endl;
+      //cout << "TEST OK" << endl;
+      //di << "TEST FAILED: Xmin must be equal to -1e3!\n";
+      //di << "TEST OK\n";
+  return 0;
+}
+//Resulting dimensions: Xmin = -0.001 , Xmax = 1000.001 , Tolerance = 0.001
+//TEST OK
+
+void QABugs::Commands_14(Draw_Interpretor& theCommands) {
+  const char *group = "QABugs";
+
+  theCommands.Add ("BUC60897", "BUC60897", __FILE__, BUC60897, group);
+  theCommands.Add ("BUC60889", "BUC60889 point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60889, group);
+  theCommands.Add ("BUC60852", "BUC60852 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60852, group);
+  theCommands.Add ("BUC60854", "BUC60854 result_shape name_of_shape name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] [ name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] ... ] [ @ edge_on_shape edge_on_wire [ edge_on_shape edge_on_wire ... ] ] ", __FILE__, BUC60854, group);
+  theCommands.Add ("BUC60870", "BUC60870 result name_of_shape_1 name_of_shape_2 dev", __FILE__, BUC60870, group);
+  theCommands.Add ("BUC60902", "BUC60902", __FILE__, BUC60902, group);
+  theCommands.Add ("BUC60944", "BUC60944 path", __FILE__, BUC60944, group);
+  theCommands.Add ("BUC60868", "BUC60868 Result Shell", __FILE__, BUC60868, group);
+  theCommands.Add ("BUC60924", "BUC60924 curve X Y Z", __FILE__, BUC60924, group);
+  theCommands.Add ("BUC60920", "BUC60920", __FILE__, BUC60920, group);
+  theCommands.Add ("OCC983", "OCC983 file", __FILE__, OCC983, group);
+  theCommands.Add ("OCC984", "OCC984 file", __FILE__, OCC984, group);
+
+  theCommands.Add ("OCC1786", "OCC1786 AutoHilight=0/1", __FILE__, OCC1786, group);
+
+//  theCommands.Add ("OCC1723", "OCC1723", __FILE__, OCC1723, group);
+
+  theCommands.Add ("OCC1919_get", "OCC1919_get", __FILE__, OCC1919_get, group);
+
+  theCommands.Add ("OCC1919_set", "OCC1919_set LC_NUMERIC", __FILE__, OCC1919_set, group);
+
+  theCommands.Add ("OCC1919_real", "OCC1919_real (DF, entry, value)", __FILE__, OCC1919_real, group);
+
+  theCommands.Add ("OCC2932_SetIDUAttribute", "OCC2932_SetIDUAttribute (DF, entry, oldLocalID, newLocalID)", __FILE__, OCC2932_SetIDUAttribute, group);
+
+  theCommands.Add ("OCC2932_SetTag", "OCC2932_SetTag (DF, entry, Tag)", __FILE__, OCC2932_SetTag, group);
+
+  theCommands.Add ("OCC2932_SetCurrent", "OCC2932_SetCurrent (DF, entry)", __FILE__, OCC2932_SetCurrent, group);
+
+  theCommands.Add ("OCC2932_SetExpression", "OCC2932_SetExpression (DF, entry, Expression)", __FILE__, OCC2932_SetExpression, group);
+
+  theCommands.Add ("OCC2932_SetRelation", "OCC2932_SetRelation (DF, entry, Relation)", __FILE__, OCC2932_SetRelation, group);
+
+  theCommands.Add ("OCC3277", "OCC3277 string", __FILE__, OCC3277, group);
+
+  theCommands.Add ("OCC6794", "OCC6794 [nb]", __FILE__, OCC6794, group);
+
+  theCommands.Add ("OCC16485", "OCC16485", __FILE__, OCC16485, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_15.cxx b/src/QABugs/QABugs_15.cxx
new file mode 100644 (file)
index 0000000..bf5fb2a
--- /dev/null
@@ -0,0 +1,74 @@
+// Created on: 2002-04-09
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <QABugs_PresentableObject.hxx>
+
+Handle(QABugs_PresentableObject) theObject1=NULL;
+Handle(QABugs_PresentableObject) theObject2=NULL;
+
+static Standard_Integer BUC60720 (Draw_Interpretor& di,Standard_Integer argc,const char ** argv )
+{
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " 0/1" << "\n";
+  }
+
+  if(atoi(argv[1]) == 0) {
+    if ( theObject1.IsNull() )
+      {
+       theObject1 = new QABugs_PresentableObject();
+       theObject1->SetDisplayMode(0);
+       myAISContext->Display(theObject1);
+      }
+  } else if(atoi(argv[1]) == 1) {
+    if ( theObject2.IsNull() )
+      {
+       theObject2 = new QABugs_PresentableObject();
+       theObject2->SetDisplayMode(1);
+       myAISContext->Display(theObject2);
+      }
+  } else {
+    di << "Usage : " << argv[0] << " 0/1" << "\n";
+    return -1;
+  }
+  return 0;
+}
+
+void QABugs::Commands_15(Draw_Interpretor& theCommands)
+{
+  char *group = "QABugs";
+  theCommands.Add("BUC60720","BUC60720 0/1",__FILE__,BUC60720,group);
+}
diff --git a/src/QABugs/QABugs_16.cxx b/src/QABugs/QABugs_16.cxx
new file mode 100644 (file)
index 0000000..4f04054
--- /dev/null
@@ -0,0 +1,881 @@
+// Created on: 2002-03-18
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <GProp_GProps.hxx>
+#include <BRepGProp.hxx>
+#include <TopoDS_Edge.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <AIS_Trihedron.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <gp_Ax2.hxx>
+#include <Geom_Circle.hxx>
+#include <AIS_Circle.hxx>
+#include <V3d_View.hxx>
+#include <TopoDS.hxx>
+#include <Geom_Plane.hxx>
+#include <gp_Pln.hxx>
+#include <AIS_AngleDimension.hxx>
+
+#include <TopExp_Explorer.hxx>
+#include <BRepAdaptor_Curve.hxx>
+#include <GC_MakePlane.hxx>
+#include <AIS_PlaneTrihedron.hxx>
+#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+
+#include <BRep_Tool.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <Precision.hxx>
+
+#include <GProp_PrincipalProps.hxx>
+
+#include <OSD_Path.hxx>
+#include <Standard_ProgramError.hxx>
+
+//#include <QAModTopOpe_Limitation.hxx>
+#include <QANewModTopOpe_Limitation.hxx>
+
+//#include <QAModTopOpe_Glue.hxx>
+#include <QANewModTopOpe_Glue.hxx>
+
+#include <ShapeFix_Wireframe.hxx>
+#include <ShapeBuild_ReShape.hxx>
+
+#include <ViewerTest_Tool.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+
+//#include <QAModTopOpe_ReShaper.hxx>
+#include <QANewModTopOpe_ReShaper.hxx>
+
+#include <ViewerTest_EventManager.hxx>
+
+#include <TColgp_Array1OfPnt2d.hxx>
+
+#include <DDocStd.hxx>
+#include <TDocStd_Document.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#if ! defined(WNT)
+extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#else
+Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#endif
+
+static Standard_Integer BUC60848 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 2 ) {
+    di << "Usage : " << argv[0] << " shape " << "\n";
+    return 1;
+  }
+  TopoDS_Shape S = DBRep::Get( argv[1] );
+  if ( S.IsNull() ) {
+    di << "Shape is empty" << "\n";
+    return 1;
+  }
+  GProp_GProps G;
+  BRepGProp::VolumeProperties( S,G );
+  Standard_Real GRes;
+  GRes = G.Mass();
+  if ( GRes < 0 ) {
+    di << "Result is negative : " << GRes << "\n";
+    return 1;
+  } else {
+    di << "Volume : " << GRes << "\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer BUC60828 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0.,0.,0.), gp_Pnt(0.,0.,1.)); 
+  Standard_Boolean aValue; 
+  aValue=anEdge.Infinite(); 
+  di << "Initial flag : " << (Standard_Integer) aValue << "\n";
+  anEdge.Infinite(Standard_True); 
+  Standard_Boolean aValue1; 
+  aValue1=anEdge.Infinite(); 
+  di << "Current flag : " << (Standard_Integer) aValue1 << "\n";
+  if(aValue1) di << "Flag was set properly." << "\n";
+  else di << "Faulty : flag was not set properly." << "\n";
+  return 0;
+}
+
+static Standard_Integer  BUC60814(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  
+  // TRIHEDRON
+  Handle(AIS_Trihedron) aTrihedron;
+  Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
+  aTrihedron=new AIS_Trihedron(aTrihedronAxis);
+  myAISContext->Display(aTrihedron);
+  
+  //Circle
+  gp_Pnt P(10,10,10);
+  gp_Dir V(1,0,0);
+  gp_Ax2 aAx2(P,V);
+  
+  Handle(Geom_Circle) ahCircle=new Geom_Circle(aAx2,20);
+  Handle(AIS_Circle)   aCircle=new AIS_Circle(ahCircle);
+  myAISContext->Display(aCircle);
+    
+  myAISContext->SelectionColor(Quantity_NOC_BLUE1);
+  
+  myAISContext->AddOrRemoveSelected(aTrihedron);
+  myAISContext->AddOrRemoveSelected(aCircle);
+  
+  return 0;
+}
+
+static Standard_Integer  BUC60774(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return -1;
+  }
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  
+  double Xc,Yc,Width, Height;
+  myV3dView->Center(Xc,Yc);
+  myV3dView-> Size (Width, Height);
+  
+  double Xmin,Ymin;
+  Xmin=Xc-Width/2;
+  Ymin=Yc-Height/2;
+  double Xmax,Ymax;
+  Xmax=Xc+Width/2;
+  Ymax=Yc+Height/2;
+    
+  Standard_Integer XPmin,YPmin;
+  myV3dView->Convert(Xmin,Ymin,XPmin,YPmin);
+//  cout<<Xmin<<"\t"<<Ymin<<endl;
+//  cout<<XPmin<<"\t"<<YPmin<<endl;
+
+  Standard_Integer XPmax,YPmax;
+  myV3dView->Convert(Xmax,Ymax,XPmax,YPmax);
+//  cout<<Xmax<<"\t"<<Ymax<<endl;
+//  cout<<XPmax<<"\t"<<YPmax<<endl;
+  
+  AIS_StatusOfPick status;
+  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_NothingSelected)
+             di << "status = AIS_SOP_NothingSelected : OK"   << "\n";
+  else       di << "status = AIS_SOP_NothingSelected : bugged - Faulty "   << "\n";
+  
+  di.Eval("box b 10 10 10");
+  di.Eval(" vdisplay b");
+
+  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_OneSelected)
+             di << "status = AIS_SOP_OneSelected : OK"   << "\n";
+  else       di << "status = AIS_SOP_OneSelected : bugged - Faulty "   << "\n";
+
+  di.Eval("box w 20 20 20 20 20 20");
+  di.Eval(" vdisplay w");
+
+  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_SeveralSelected)
+             di << "status = AIS_SOP_SeveralSelected : OK"   << "\n";
+  else       di << "status = AIS_SOP_SeveralSelected : bugged - Faulty "   << "\n";
+  
+  return 0;
+
+}  
+
+static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  if(argc != 6) {
+    di << "Usage : " << argv[0] << " edge edge plane val text" << "\n";
+    return 1;
+  }
+  
+  TopoDS_Edge aFirst = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
+  TopoDS_Edge aSecond = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
+  Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(DrawTrSurf::GetSurface(argv[3]));
+  if(aPlane.IsNull())
+    return 1;
+  
+  di << aPlane->Pln().SquareDistance( gp_Pnt(0,0,0) ) << "\n";
+  
+  TCollection_ExtendedString aText(argv[5]);
+  //Standard_ExtString ExtString_aText = aText.ToExtString();
+  //di << ExtString_aText << " " << atof(argv[4]) << "\n";
+  di << argv[5] << " " << atof(argv[4]) << "\n";
+  
+  Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, atof(argv[4]), aText);
+  aContext->Display(aDim);                                                         
+  
+  return 0;
+}
+
+static Standard_Integer OCC218bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  if(argc != 5) {
+    di << "Usage : " << argv[0] << " name plane Xlabel Ylabel" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape S = DBRep::Get( argv[2] );
+  if ( S.IsNull() ) {
+    di << "Shape is empty" << "\n";
+    return 1;
+  }
+
+  TCollection_AsciiString name(argv[1]);
+  TCollection_AsciiString Xlabel(argv[3]);
+  TCollection_AsciiString Ylabel(argv[4]);
+  
+  // Construction de l'AIS_PlaneTrihedron
+  Handle(AIS_PlaneTrihedron) theAISPlaneTri;
+
+  Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
+  if (IsBound) {
+    // on recupere la shape dans la map des objets displayes
+    Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+      
+    // On verifie que l'AIS InteraciveObject est bien 
+    // un AIS_PlaneTrihedron
+    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
+      // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
+      theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape;
+
+      theAISPlaneTri->SetXLabel(Xlabel);
+      theAISPlaneTri->SetYLabel(Ylabel);
+  
+      aContext->Redisplay(theAISPlaneTri, Standard_False);
+      aContext->UpdateCurrentViewer();
+    }
+  } else {
+    TopoDS_Face  FaceB=TopoDS::Face(S);
+  
+    // Construction du Plane
+    // recuperation des edges des faces.
+    TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
+  
+    TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
+    // declarations 
+    gp_Pnt A,B,C;
+  
+    // si il y a plusieurs edges
+    if (FaceExpB.More() ) {
+      FaceExpB.Next();
+      TopoDS_Edge EdgeC=TopoDS::Edge(FaceExpB.Current() );
+      BRepAdaptor_Curve theCurveB(EdgeB);
+      BRepAdaptor_Curve theCurveC(EdgeC);
+      A=theCurveC.Value(0.1);
+      B=theCurveC.Value(0.9);
+      C=theCurveB.Value(0.5);
+    }
+    else {
+      // FaceB a 1 unique edge courbe
+      BRepAdaptor_Curve theCurveB(EdgeB);
+      A=theCurveB.Value(0.1);
+      B=theCurveB.Value(0.9);
+      C=theCurveB.Value(0.5);
+    }
+    // Construction du Geom_Plane
+    GC_MakePlane MkPlane(A,B,C);
+    Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
+    
+    // on le display & bind
+    theAISPlaneTri= new AIS_PlaneTrihedron(theGeomPlane );
+    
+    theAISPlaneTri->SetXLabel(Xlabel);
+    theAISPlaneTri->SetYLabel(Ylabel);
+    
+    GetMapOfAIS().Bind ( theAISPlaneTri, name);
+    aContext->Display(theAISPlaneTri );
+  }
+  return 0;
+}
+
+static Standard_Integer OCC295(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 4) {
+    di << "Usage : " << argv[0] << " edge_result edge1 edge2" << "\n";
+    return 1;
+  }
+  
+  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
+  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
+  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
+  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
+  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
+  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
+  Standard_Real f1,l1,f2,l2;
+  Standard_Boolean After =  Standard_True;
+  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
+  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
+  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
+  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
+  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
+  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
+  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
+  bsplc2->SetPole(1, pmid);
+  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
+  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
+  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
+  if(MkEdge.IsDone()) {
+    TopoDS_Edge nedge = MkEdge.Edge();
+    DBRep::Set ( argv[1], nedge );
+    return 0;
+  }
+  else return 1;
+}
+
+static Standard_Integer OCC49 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+
+  if ( argc != 2 ) {
+    di << "Usage : " << argv[0] << " name" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape S = DBRep::Get(argv[1]);
+  if (S.IsNull()) return 0;
+
+  GProp_GProps G;
+  BRepGProp::VolumeProperties(S,G);
+  GProp_PrincipalProps Pr = G.PrincipalProperties();
+  Standard_Boolean Result = Pr.HasSymmetryAxis();
+  if (Result) {
+    di << "1" << "\n";
+  } else {
+    di << "0" << "\n";
+  }
+  return 0;
+}
+
+static Standard_Integer OCC132 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  /*
+     OCC132:
+     =======
+
+     ... the validation of the name of files in Analyse_DOS and Analyse_UNIX is : 
+
+     characters not allowed in DOS/WNT names are 
+     / 
+     : 
+     * 
+     ? 
+     " 
+     < 
+     > 
+     | 
+     and  more than one dot in filename.
+     */
+
+  if ( argc != 2 ) {
+    di << "Usage : " << argv[0] << " DependentName" << "\n";
+    return 1;
+  }
+
+  OSD_SysType SysType1 = OSD_OS2;
+  OSD_SysType SysType2 = OSD_WindowsNT;
+
+  {
+    try {
+      OCC_CATCH_SIGNALS
+      OSD_Path Path (argv[1], SysType1);
+    }
+    catch (Standard_ProgramError) {
+      di << "1" << "\n";
+      return 0;
+    }
+  }
+
+  {
+    try {
+      OCC_CATCH_SIGNALS
+      OSD_Path Path (argv[1], SysType2);
+    }
+    catch (Standard_ProgramError) {
+      di << "2" << "\n";
+      return 0;
+    }
+  }
+  
+  di << "0" << "\n";
+  return 0;
+}
+
+static Standard_Integer OCC405 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 4) {
+    di << "Usage : " << argv[0] << " edge_result edge1 edge2; merge two edges" << "\n";
+    return 1;
+  }
+  
+  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
+  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
+  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
+  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
+  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
+  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
+  Standard_Real f1,l1,f2,l2;
+  Standard_Boolean After =  Standard_True;
+  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
+  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
+  if(e1.Orientation() == TopAbs_REVERSED) {
+    Standard_Real cf = f1;
+      f1 = ac1->ReversedParameter ( l1 );
+      l1 = ac1->ReversedParameter ( cf );
+      ac1 = ac1->Reversed();
+    }
+    if(e2.Orientation() == TopAbs_REVERSED) {
+      Standard_Real cf = f2;
+      f2 = ac2->ReversedParameter ( l2 );
+      l2 = ac2->ReversedParameter ( cf );
+      ac2 = ac2->Reversed();
+    }
+  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
+  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
+  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
+  if(bsplc1->FirstParameter() < f1 - Precision::PConfusion() || 
+     bsplc1->LastParameter() > l1 + Precision::PConfusion()) {
+    Handle(Geom_BSplineCurve) aBstmp  = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy());
+    aBstmp->Segment(f1,l1);
+    gp_Pnt p1 = aBstmp->Pole(1);
+    gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
+    bsplc1 =aBstmp; 
+  }
+  if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() || 
+     bsplc2->LastParameter() > l2 + Precision::PConfusion()) {
+    Handle(Geom_BSplineCurve) aBstmp  = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy());
+    aBstmp->Segment(f2,l2);
+    gp_Pnt p1 = aBstmp->Pole(1);
+    gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
+    bsplc2 =aBstmp; 
+  }
+  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
+  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
+  bsplc2->SetPole(1, pmid);
+  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
+  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
+  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
+  if(MkEdge.IsDone()) {
+    TopoDS_Edge nedge = MkEdge.Edge();
+    DBRep::Set ( argv[1], nedge );
+    return 0;
+  }
+  else return 1;
+}
+
+static Standard_Integer OCC252 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(!(argc == 4 || argc == 5)) {
+    di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n";
+    return 1;
+  }
+  
+  TopoDS_Shape s1 = DBRep::Get(argv[2]);
+  TopoDS_Shape s2 = DBRep::Get(argv[3]);
+  if (s1.IsNull() || s2.IsNull()) return 1;
+
+  //QAModTopOpe_ModeOfLimitation ModeOfLimitation = QAModTopOpe_Forward;
+  QANewModTopOpe_ModeOfLimitation ModeOfLimitation = QANewModTopOpe_Forward;
+  if(argc==5) {
+    Standard_Integer ModeOfLimitationInteger = atoi(argv[4]);
+    if(!(ModeOfLimitationInteger == 0 || ModeOfLimitationInteger == 1 || ModeOfLimitationInteger == 2)) {
+      di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n";
+      return 1;
+    }
+    //if (ModeOfLimitationInteger == 1) ModeOfLimitation = QAModTopOpe_Reversed;
+    //if (ModeOfLimitationInteger == 2) ModeOfLimitation = QAModTopOpe_BothParts;
+    if (ModeOfLimitationInteger == 1) ModeOfLimitation = QANewModTopOpe_Reversed;
+    if (ModeOfLimitationInteger == 2) ModeOfLimitation = QANewModTopOpe_BothParts;
+  }
+
+  //TopoDS_Shape res = QAModTopOpe_Limitation(s1,s2,ModeOfLimitation);
+  TopoDS_Shape res = QANewModTopOpe_Limitation(s1,s2,ModeOfLimitation);
+  if (res.IsNull()) {
+    di << "Error : result is null" << "\n";
+    return 1;
+  }
+
+  DBRep::Set(argv[1],res);
+
+  return 0;
+}
+
+static Standard_Integer OCC307 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(!(argc == 4 || argc == 5)) {
+    di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n";
+    return 1;
+  }
+  
+  TopoDS_Shape s1 = DBRep::Get(argv[2]);
+  TopoDS_Shape s2 = DBRep::Get(argv[3]);
+  if (s1.IsNull() || s2.IsNull()) return 1;
+
+  Standard_Boolean AllowCutting = Standard_False;
+  if(argc==5) {
+    Standard_Integer AllowCuttingInteger = atoi(argv[4]);
+    if(!( AllowCuttingInteger == 0 || AllowCuttingInteger == 1)) {
+      di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n";
+      return 1;
+    }
+    if (AllowCuttingInteger == 1) AllowCutting = Standard_True;
+  }
+
+  //TopoDS_Shape res = QAModTopOpe_Glue(s1,s2,AllowCutting);
+  TopoDS_Shape res = QANewModTopOpe_Glue(s1,s2,AllowCutting);
+  if (res.IsNull()) {
+    di << "Error : result is null" << "\n";
+    return 1;
+  }
+
+  DBRep::Set(argv[1],res);
+
+  return 0;
+}
+
+static Standard_Integer OCC395 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 4) {
+    di << "Usage : " << argv[0] << " edge_result edge1 edge2" << "\n";
+    return 1;
+  }
+  //TCollection_AsciiString fnom(a[1]);
+  //Standard_Boolean modfic = XSDRAW::FileAndVar(a[1],a[2],a[3],"IGES",fnom,rnom,resnom);
+  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
+  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
+  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
+  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
+  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
+  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
+  Standard_Real f1,l1,f2,l2;
+  Standard_Boolean After =  Standard_True;
+  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
+  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
+  if(e1.Orientation() == TopAbs_REVERSED) {
+      //Standard_Real cf = cf1;
+      //cf1 = ac1->ReversedParameter ( cl1 );
+      //cl1 = ac1->ReversedParameter ( cf );
+      ac1 = ac1->Reversed();
+    }
+    if(e2.Orientation() == TopAbs_REVERSED) {
+      //Standard_Real cf = cf2;
+      //ac2 = ac2->ReversedParameter ( cl2 );
+      //ac2 = ac2->ReversedParameter ( cf );
+      ac2 = ac2->Reversed();
+    }
+  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
+  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
+  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
+  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
+  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
+  bsplc2->SetPole(1, pmid);
+  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
+  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
+  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
+  if(MkEdge.IsDone()) {
+    TopoDS_Edge nedge = MkEdge.Edge();
+    DBRep::Set ( argv[1], nedge );
+    return 0;
+  }
+  else return 1;
+}
+
+static Standard_Integer OCC394 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc < 3) {
+    di << "Usage : " << argv[0] << " edge_result edge [tol [mode [tolang]]]" << "\n";
+    return 1;
+  }
+   TopoDS_Shape Sh = DBRep::Get(argv[2]);
+   Standard_Integer k = 3;
+   Standard_Real tol = 100000;
+   Standard_Integer mode = 2;
+   Standard_Real tolang = M_PI/2;
+   if(argc > k) 
+     tol = atof(argv[k++]);
+   
+   if(argc > k) 
+     mode=  atoi(argv[k++]);
+   
+   if(argc > k) 
+     tolang = atof(argv[k++]);
+     
+   
+   Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe();
+   Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape;
+   aSfwr->SetContext(aReShape);
+   aSfwr->Load(Sh);
+   aSfwr->SetPrecision(tol);
+   Standard_Boolean aModeDrop = Standard_True;
+   if(mode == 2) 
+     aModeDrop = Standard_False;
+   
+    TopTools_MapOfShape theSmallEdges, theMultyEdges;
+  TopTools_DataMapOfShapeListOfShape theEdgeToFaces,theFaceWithSmall;
+  aSfwr->CheckSmallEdges(theSmallEdges,theEdgeToFaces,theFaceWithSmall, theMultyEdges);
+  aSfwr->MergeSmallEdges (theSmallEdges,theEdgeToFaces,theFaceWithSmall, theMultyEdges, aModeDrop,tolang);
+   //aSfwr->FixSmallEdges(); 
+  TopoDS_Shape resShape =  aSfwr->Shape();;
+  DBRep::Set ( argv[1], resShape );
+  return 0;
+}
+
+static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  //Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("OCC301");
+  //ViewerTest_Tool::InitViewerTest (context);
+  Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
+  if(context.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  if ( argc != 5 ) {
+    di << "Usage : " << argv[0] << " X Y Z ArrowSize" << "\n";
+    return 1;
+  }
+
+  Standard_Real X = atof(argv[1]);
+  Standard_Real Y = atof(argv[2]);
+  Standard_Real Z = atof(argv[3]);
+  Standard_Real ArrowSize = atof(argv[4]);
+
+  gp_Pnt p1 = gp_Pnt(10.,10.,0.);
+  gp_Pnt p2 = gp_Pnt(50.,10.,0.);
+  gp_Pnt p3 = gp_Pnt(50.,50.,0.);
+
+  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(p1, p2);
+  TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(p2, p3);
+
+  context->Display(new AIS_Shape(E1)); 
+  context->Display(new AIS_Shape(E2)); 
+
+  gp_Pnt plnpt(0, 0, 0);
+  gp_Dir plndir(0, 0, 1);
+  Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
+
+  Handle(AIS_AngleDimension) AngleDimension = new AIS_AngleDimension(E2, E1, pln, -3.14/2., "Angle");
+
+  AngleDimension->SetPosition(gp_Pnt(X, Y, Z));
+  AngleDimension->SetArrowSize(ArrowSize);
+
+  context->Display(AngleDimension);
+  return 0;
+}
+
+static Standard_Integer OCC294 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc < 4) {
+    di << "Usage : " << argv[0] << " shape_result shape edge" << "\n";
+    return 1;
+  }
+  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
+  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
+  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
+  if(Sh2.ShapeType() != TopAbs_EDGE) return 1;
+
+  //QAModTopOpe_ReShaper ReShaper(Sh1);
+  QANewModTopOpe_ReShaper ReShaper(Sh1);
+  ReShaper.Remove(Sh2);
+  const TopoDS_Shape& ResultShape = ReShaper.GetResult();
+  if(ResultShape.IsNull()) {
+    di << "Faulty " << argv[0] << " : " << argv[1] << " - shape_result is null" << "\n";
+    return 1;
+  }
+
+  DBRep::Set ( argv[1], ResultShape);
+  return 0;
+}
+
+static Standard_Integer OCC60 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  if(argc < 5) {
+    di << "Usage : " << argv[0] << " xmin ymin xmax ymax; selection window" << "\n";
+    return 1;
+  }
+
+  Standard_Integer xmin = atoi(argv[1]);
+  Standard_Integer ymin = atoi(argv[2]);
+  Standard_Integer xmax = atoi(argv[3]);
+  Standard_Integer ymax = atoi(argv[4]);
+
+  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
+
+  Handle(ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
+  EM->Select(xmin,ymin,xmax,ymax);
+
+  return 0;
+}
+
+static Standard_Integer OCC70 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  if(argc < 7) {
+    di << "Usage : " << argv[0] << " x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection" << "\n";
+    return 1;
+  }
+  if (((argc - 1) % 2) != 0) {
+    di << "Usage : " << argv[0] << " x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection" << "\n";
+    return 1;
+  }
+
+  Standard_Integer i, j, np = (argc-1) / 2;
+  TColgp_Array1OfPnt2d Polyline(1,np);
+  j = 1;
+  for (i = 1; i <= np; i++) {
+    Polyline(i) = gp_Pnt2d(atof(argv[j]), atof(argv[j+1]));
+    j += 2;
+  }
+
+  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
+
+  aContext->Select(Polyline,V3dView);
+  aContext->UpdateCurrentViewer();
+
+  return 0;
+}
+
+static Standard_Integer OCC261 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " Doc" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) Doc;
+  if(DDocStd::GetDocument(argv[1], Doc)) {
+    Doc->ClearRedos();
+    return 0;
+  } else
+    return 1;
+}
+
+#include <OSD_File.hxx>
+static Standard_Integer OCC710 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " path" << "\n";
+  }
+
+  TCollection_AsciiString in(argv[1]);
+  OSD_File* aFile = new OSD_File(in);
+  Standard_Boolean anExists = aFile->Exists();
+  if(anExists == Standard_True) 
+    di << "1" << "\n";
+  else
+    di << "0" << "\n";
+  return 0;
+}
+
+#include <ShapeFix_Shell.hxx>
+static Standard_Integer OCC904 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc != 4) {
+    di << "Usage : " << argv[0] << " result shape nonmanifoldmode(0/1)" << "\n";
+  }
+  TopoDS_Shape S = DBRep::Get(argv[2]);
+  if (S.IsNull() || S.ShapeType() != TopAbs_SHELL) {
+    di << " Shape is null" << "\n";
+    return 1;
+  }
+  Standard_Boolean nonmanifmode = (atoi(argv[3]) != 0);
+  Handle(ShapeFix_Shell) SFSh = new ShapeFix_Shell;
+  SFSh->FixFaceOrientation(TopoDS::Shell(S),Standard_True,nonmanifmode);
+  DBRep::Set(argv[1],SFSh->Shape());
+  return 0;
+}
+
+void QABugs::Commands_16(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group);
+  theCommands.Add ("BUC60828", "BUC60828", __FILE__, BUC60828, group);
+  theCommands.Add ("BUC60814", "BUC60814", __FILE__, BUC60814, group);
+  theCommands.Add ("BUC60774", "BUC60774", __FILE__, BUC60774, group);
+  theCommands.Add ("BUC60972", "BUC60972 edge edge plane val text ", __FILE__, BUC60972, group);
+  theCommands.Add ("OCC218", "OCC218 name plane Xlabel Ylabel", __FILE__, OCC218bug, group);
+  theCommands.Add ("OCC295", "OCC295 edge_result edge1 edge2", __FILE__, OCC295, group);
+  theCommands.Add ("OCC49", "OCC49 name", __FILE__, OCC49, group);
+  theCommands.Add ("OCC132", "OCC132 DependentName", __FILE__, OCC132, group);
+  theCommands.Add ("OCC405", "OCC405 edge_result edge1 edge2; merge two edges", __FILE__, OCC405, group);
+  theCommands.Add ("OCC252", "OCC252 result part tool [ModeOfLimitation=0/1/2]", __FILE__, OCC252, group);
+  theCommands.Add ("OCC307", "OCC307 result part tool [AllowCutting=0/1]", __FILE__, OCC307, group);
+  theCommands.Add ("OCC395", "OCC395 edge_result edge1 edge2", __FILE__, OCC395, group);
+  theCommands.Add ("OCC394", "OCC394 edge_result edge [tol [mode [tolang]]]", __FILE__, OCC394, group);
+  theCommands.Add ("OCC301", "OCC301 X Y Z ArrowSize", __FILE__, OCC301, group);
+  theCommands.Add ("OCC294", "OCC294 shape_result shape edge", __FILE__, OCC294, group);
+  theCommands.Add ("OCC60", "OCC60 xmin ymin xmax ymax; selection window", __FILE__, OCC60, group);
+  theCommands.Add ("OCC70", "OCC70 x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection", __FILE__, OCC70, group);
+  theCommands.Add ("OCC261", "OCC261 Doc", __FILE__, OCC261, group);
+  theCommands.Add ("OCC710", "OCC710 path", __FILE__, OCC710, group);
+  theCommands.Add ("OCC904", "OCC904 result shape nonmanifoldmode(0/1)", __FILE__, OCC904, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_17.cxx b/src/QABugs/QABugs_17.cxx
new file mode 100644 (file)
index 0000000..e1648e0
--- /dev/null
@@ -0,0 +1,2305 @@
+// Created on: 2002-03-18
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#if defined(WOKC40)
+#define V2D
+#define Viewer2dTest QAViewer2dTest
+#endif
+
+#include <stdio.h>
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <Geom_Circle.hxx>
+#include <Geom_Ellipse.hxx>
+#include <Geom_Plane.hxx>
+#include <gp_Pln.hxx>
+#include <Geom2d_Curve.hxx>
+#include <GeomAPI.hxx>
+#include <Geom2dAdaptor_Curve.hxx>
+#include <Geom2dGcc_QualifiedCurve.hxx>
+#include <Geom2dGcc_Lin2d2Tan.hxx>
+#include <Geom2d_Line.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <TopoDS_Edge.hxx>
+#include <Precision.hxx>
+#include <Geom2d_Circle.hxx>
+#include <Geom2dGcc_MyQCurve.hxx>
+#include <GccEnt_QualifiedCirc.hxx>
+#include <Geom2dGcc_MyL2d2Tan.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Wire.hxx>
+#include <BRep_Tool.hxx>
+#include <gp_Circ.hxx>
+#include <BRepOffsetAPI_MakePipeShell.hxx>
+#include <AIS_Trihedron.hxx>
+#include <Geom_Axis2Placement.hxx>
+#include <V3d_View.hxx>
+#include <ViewerTest_Tool.hxx>
+#include <BRepBuilderAPI_MakeVertex.hxx>
+#include <AIS_LengthDimension.hxx>
+#include <AIS_RadiusDimension.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <GeomAdaptor_Surface.hxx>
+#include <Extrema_ExtPS.hxx>
+#include <Geom_CartesianPoint.hxx>
+#include <Geom2d_CartesianPoint.hxx>
+#include <Geom2dGcc_Circ2d3Tan.hxx>
+#include <Aspect_Window.hxx>
+
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_CompSolid.hxx>
+#include <StdSelect_ShapeTypeFilter.hxx>
+
+#include <QABugs_MyText.hxx>
+
+#if defined(WOKC40)
+#include <QAViewer2dTest.hxx>
+#include <QAViewer2dTest_DoubleMapOfInteractiveAndName.hxx>
+#else
+#include <Viewer2dTest.hxx>
+#include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx>
+#endif
+
+#include <Prs3d_Projector.hxx>
+#include <HLRAlgo_Projector.hxx>
+#include <AIS2D_ProjShape.hxx>
+#include <AIS2D_InteractiveContext.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#if ! defined(WNT)
+#if defined(WOKC40)
+extern QAViewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
+#else
+extern Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
+#endif
+#else
+Standard_EXPORT Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
+#endif
+
+#include <GGraphic2d_SetOfCurves.hxx>
+#include <Graphic2d_SetOfSegments.hxx>
+
+#include <Graphic3d_NameOfFont.hxx>
+
+static Standard_Integer BUC60842 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** /*argv*/)
+{
+  Standard_Character abuf[16];
+  //Standard_Character * abuf = new Standard_Character[16];
+
+  Standard_CString st = abuf;
+
+  Handle(Geom_Circle) cir = new Geom_Circle (gp_Ax2 (gp_Pnt (823.687192, 502.366825, 478.960440), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560)), 50);
+  Handle(Geom_Ellipse) ell = new Geom_Ellipse (gp_Ax2 (gp_Pnt (1262.224429, 425.040878, 363.609716), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560)), 150, 100);
+  Handle(Geom_Plane) plne = new Geom_Plane (gp_Ax3 (gp_Ax2 (gp_Pnt (1262.224429, 425.040878, 363.609716), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560))));
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+  gp_Pln pln = plne->Pln();
+  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d (ell, pln);
+  sprintf(abuf,"ell");
+  DrawTrSurf::Set(st,curve2d);
+  if(!aContext.IsNull()) {
+    Handle(AIS_Shape) aisp = 
+      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
+    aContext->Display (aisp);
+  }
+
+  Handle(Geom2d_Curve) fromcurve2d = GeomAPI::To2d (cir, pln);
+  sprintf(abuf,"cil");
+  DrawTrSurf::Set(st,fromcurve2d);
+  if(!aContext.IsNull()) {
+    Handle(AIS_Shape) aisp = 
+      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(fromcurve2d, pln)).Edge());
+    aContext->Display (aisp);
+  }
+
+  Geom2dAdaptor_Curve acur (curve2d), afromcur (fromcurve2d);
+  Geom2dGcc_QualifiedCurve qcur (acur, GccEnt_outside);
+  Geom2dGcc_QualifiedCurve qfromcur (afromcur, GccEnt_outside);
+  Geom2dGcc_Lin2d2Tan lintan (qcur, qfromcur, 0.1, 0.0, 0.0);
+  Standard_Integer i=0;
+  for(i=0;i<lintan.NbSolutions();i++) {
+    sprintf(abuf,"lintan_%d",i);
+    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
+    DrawTrSurf::Set(st,glin);
+    if(!aContext.IsNull()) {
+      Handle(AIS_Shape) aisp = 
+        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
+    }
+  }
+  di << " Is Done = \n" << (Standard_Integer) lintan.IsDone();
+  return 0;
+}
+
+static Standard_Integer BUC60843 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
+{
+  if (argc != 4 && argc != 5 && argc != 6 && argc != 7) {
+    di << "Usage : " << argv[0] << "result_shape name_of_circle name_of_curve [ par1 [ tol ] ]" << "\n";
+    return 1;
+  }
+
+  Standard_Real par1 = 0.0, par2 = 0.0;
+  Standard_Real tol  = Precision::Angular();
+  if (argc >= 5)
+    par1 = atof(argv[4]);
+  if (argc == 6)
+    par2 = atof(argv[5]);
+  if (argc == 7)
+    tol = atof(argv[6]);
+  Handle(Geom2d_Curve)  aCur2d1 = DrawTrSurf::GetCurve2d(argv[2]);
+  Handle(Geom2d_Curve)  aCur2d2 = DrawTrSurf::GetCurve2d(argv[3]);
+  if (aCur2d1.IsNull() || aCur2d2.IsNull()) {
+    di << "Faulty : not curves" << "\n";
+    return 1;
+  }
+  Standard_Boolean c1IsCircle = Standard_False;
+  Handle(Geom2d_Circle) aCir2d = Handle(Geom2d_Circle)::DownCast(aCur2d1);
+  if (!aCir2d.IsNull()) {
+    c1IsCircle = Standard_True;
+    if (argc == 6) tol = atof(argv[5]);
+  }
+  if(c1IsCircle) {
+    Geom2dAdaptor_Curve acur(aCur2d2);
+    Geom2dGcc_MyQCurve qcur(acur, GccEnt_unqualified);
+    GccEnt_QualifiedCirc qfromcur(aCir2d->Circ2d(), GccEnt_unqualified);
+    Geom2dGcc_MyL2d2Tan lintan(qfromcur, qcur , par1, tol); 
+    if (lintan.IsDone()) {
+      gp_Lin2d lin = lintan.ThisSolution(); 
+      Handle(Geom2d_Line) glin = new Geom2d_Line(lin); 
+      DrawTrSurf::Set(argv[1], glin);
+    } else {
+      di << "Faulty : tangent line is not done." << "\n";
+    }
+  }
+  else {
+    Geom2dAdaptor_Curve acur1(aCur2d1);
+    Geom2dAdaptor_Curve acur2(aCur2d2);
+    Geom2dGcc_MyQCurve qcur1(acur1, GccEnt_unqualified);
+    Geom2dGcc_MyQCurve qcur2(acur2, GccEnt_unqualified);
+    Geom2dGcc_MyL2d2Tan lintan(qcur1, qcur2 , par1, par2, tol); 
+    if (lintan.IsDone()) {
+      gp_Lin2d lin = lintan.ThisSolution(); 
+      Handle(Geom2d_Line) glin = new Geom2d_Line(lin); 
+      DrawTrSurf::Set(argv[1], glin);
+    } else {
+      di << "Faulty : tangent line is not done." << "\n";
+    }
+  }   
+  return 0;
+}
+
+static Standard_Integer BUC60970 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=3)
+  {
+    di << "Usage : " << argv[0] << " shape result" <<"\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aResult = DBRep::Get(argv[1]);
+
+  BRepBuilderAPI_MakeWire bRepSpineWire; 
+  TopExp_Explorer exp_(aResult, TopAbs_WIRE); 
+
+  Standard_Integer i = 0; 
+  for(;exp_.More();exp_.Next()){     
+    i++; 
+    bRepSpineWire.Add(TopoDS::Wire(exp_.Current())); 
+  } 
+
+  //printf("total no of wires are ............. %d\n", i); 
+  di << "total no of wires are ............. " << i << "\n"; 
+
+  TopoDS_Wire spineWire = bRepSpineWire.Wire(); 
+  aContext->Display(new AIS_Shape(spineWire)); 
+
+  DBRep::Set("slineW",spineWire);
+
+  TopExp_Explorer spineWireExp(spineWire, TopAbs_EDGE); 
+  Standard_Real first, last; 
+  Handle_Geom_Curve curl_ = BRep_Tool::Curve(TopoDS::Edge(spineWireExp.Current()), first, last); 
+  gp_Pnt firstPnt; 
+  gp_Vec tanVec; 
+  curl_->D1(first, firstPnt, tanVec); 
+  tanVec.Normalize(); 
+  gp_Dir tanDir(tanVec.X(), tanVec.Y(), tanVec.Z()); 
+  gp_Ax2 gpAx2(firstPnt, tanDir); 
+  gp_Circ gpCirc(gpAx2, 2.5); 
+  BRepBuilderAPI_MakeWire aMWire(BRepBuilderAPI_MakeEdge(new Geom_Circle(gpCirc)).Edge());
+  TopoDS_Wire topoWire(aMWire); 
+  aContext->Display(new AIS_Shape(topoWire));
+
+  DBRep::Set("topoW",topoWire);
+
+  BRepOffsetAPI_MakePipeShell bRepPipe(spineWire);
+  bRepPipe.Add(topoWire); 
+  bRepPipe.Build(); 
+
+  aContext->Display(new AIS_Shape(bRepPipe.Shape())); 
+
+  DBRep::Set(argv[2],bRepPipe.Shape());
+
+  return 0;
+}
+
+static Standard_Integer  BUC60818(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return -1;
+  }
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  // TRIHEDRON
+  Handle(AIS_Trihedron) aTrihedron;
+  Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
+  aTrihedron=new AIS_Trihedron(aTrihedronAxis);
+  myAISContext->Display(aTrihedron);
+
+  myAISContext->OpenLocalContext(); 
+  myAISContext->Load(aTrihedron,0); 
+
+  myAISContext->SetAutomaticHilight(  Standard_False );
+
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  double Xv,Yv;
+  myV3dView->Project(0,0,0,Xv,Yv);
+
+  Standard_Integer Xp,Yp;
+  myV3dView->Convert(Xv,Yv,Xp,Yp);
+
+  myAISContext->MoveTo( Xp,Yp, myV3dView  );
+  myAISContext->MoveTo( Xp,Yp, myV3dView  );
+
+  if (myAISContext->HasDetected(  )) 
+    di << "has detected shape : OK"   << "\n";
+  else       di << "has detected shape : bugged - Faulty "   << "\n";
+
+  myAISContext->SetAutomaticHilight(  Standard_True );
+
+  return 0;
+}
+
+static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
+{
+  if (argc > 1) {
+    di<<"Function don't has parameters"<<"\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("buc60915");
+  ViewerTest_Tool::InitViewerTest (context);
+
+  //The following dimesion code has problems regarding arrow_size. The desired effect is not produced.
+  /***************************************/
+  //First view
+  /***************************************/
+  gp_Pnt p1 = gp_Pnt(602.51,50.,0.);
+  gp_Pnt p2 = gp_Pnt(602.51,200.,0.);
+  gp_Pnt p3 = gp_Pnt(102.51,200.,0.);
+  gp_Pnt p4 = gp_Pnt(102.51,170.,0.);
+  gp_Pnt p5 = gp_Pnt(502.51,170.,0.);
+  gp_Pnt p6 = gp_Pnt(502.51,80.,0.);
+  gp_Pnt p7 = gp_Pnt(102.51,80.,0.);
+  gp_Pnt p8 = gp_Pnt(102.51,50.,0.);
+  TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(p1);
+  TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(p2);
+  TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(p3);
+  TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(p4);
+  TopoDS_Vertex V5 = BRepBuilderAPI_MakeVertex(p5);
+  TopoDS_Vertex V6 = BRepBuilderAPI_MakeVertex(p6);
+  TopoDS_Vertex V7 = BRepBuilderAPI_MakeVertex(p7);
+  TopoDS_Vertex V8 = BRepBuilderAPI_MakeVertex(p8);
+  gp_Pnt plnpt(0, 0, 0);
+  gp_Dir plndir(0, 0, 1);
+  Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
+  /***************************************/
+  //dimension "L 502.51"
+  /***************************************/
+  Handle(AIS_LengthDimension) len = new AIS_LengthDimension(V2, V3, pln, 502.51, "502.51");
+  len->SetPosition(gp_Pnt(350, 250, 0));
+  len->SetTypeOfDist(AIS_TOD_Horizontal);
+  len->SetArrowSize(30.0);
+  context->Display(len);
+  /***************************************/
+  //dimension "L 90"
+  /***************************************/
+  Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V4, V7, pln, 90, "90");
+  len1->SetPosition(gp_Pnt(70, 120, 0));
+  len1->SetTypeOfDist(AIS_TOD_Vertical);
+  len1->SetArrowSize(100.0);
+  context->Display(len1);
+  /***************************************/
+  //dimension "L 150"
+  /***************************************/
+  Handle(AIS_LengthDimension) len2 = new AIS_LengthDimension(V1, V2, pln, 150, "150",gp_Pnt(650, 120, 0),DsgPrs_AS_BOTHAR,
+    AIS_TOD_Vertical, 100.0 );
+  //len2->SetPosition(gp_Pnt(650, 120, 0));
+  //len2->SetTypeOfDist(AIS_TOD_Vertical);
+  //len1->SetArrowSize(100.0);
+  context->Display(len2);
+  /***************************************/
+  //dimension "R 88.58"
+  /***************************************/
+  gp_Circ cir = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 88.58);
+  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(cir,gp_Pnt(191.09,0,0.),gp_Pnt(191.09,-177.16,0.) );
+  Handle(AIS_RadiusDimension) dim1 = new AIS_RadiusDimension(E1,88.58, "R 88.58",gp_Pnt(-30.0, -80.0, 0.0),DsgPrs_AS_BOTHAR,
+    100.0 );
+  context->Display(dim1);
+  /***************************************/
+  //dimension "R 43.80"
+  /***************************************/
+  gp_Circ cir1 = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 43.80);
+  TopoDS_Edge E_cir1 = BRepBuilderAPI_MakeEdge(cir1);
+  dim1 = new AIS_RadiusDimension(E_cir1,43.80, "R 43.80",gp_Pnt(0.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 60.0 );
+  context->Display(dim1);
+  /***************************************/
+  //dimension "R 17.86"
+  /***************************************/
+  gp_Circ cir2 = gp_Circ(gp_Ax2(gp_Pnt(566.11, -88.58, 0), gp_Dir(0, 0, -1)), 17.86);
+  TopoDS_Edge E_cir2 = BRepBuilderAPI_MakeEdge(cir2);
+  dim1 = new AIS_RadiusDimension(E_cir2,17.86, "R 17.86",gp_Pnt(600.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 40.0 );
+  context->Display(dim1);
+
+  return 0;
+}
+
+static Standard_Integer  OCC138 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
+  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300,300));
+  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500,500));
+
+  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
+  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
+  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
+
+  aContext->Display(ais1);
+  aContext->Display(ais2);
+  aContext->Display(ais3);
+
+  aContext->AddOrRemoveCurrentObject(ais1);
+  aContext->AddOrRemoveCurrentObject(ais2);
+  aContext->AddOrRemoveCurrentObject(ais3);
+
+  di << "\n No of currents = " << aContext->NbCurrents();
+
+  aContext->InitCurrent();
+
+  int count = 1;
+  while(aContext->MoreCurrent())
+  {
+    di << "\n count is = " << count++;
+    Handle_AIS_InteractiveObject ais = aContext->Current();
+    aContext->AddOrRemoveCurrentObject(ais);
+    aContext->InitCurrent();
+  }
+
+  return 0; 
+}
+
+static Standard_Integer BUC60821(Draw_Interpretor& di, Standard_Integer argc,const char ** argv )   
+{
+
+  if(argc < 3){
+    di << "Usage: " << argv[0] << " TextHight1 TextHight2 TextHight2";
+    return(-1);
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+  if(aContext.IsNull()) 
+  { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  Handle(QABugs_MyText) txt1 = new QABugs_MyText("Gosha1",gp_Pnt(0,0,0),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_RED,atoi(argv[1]));
+  aContext->Display(txt1);
+
+  Handle(QABugs_MyText) txt2 = new QABugs_MyText("Gosha2",gp_Pnt(0,0,100),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_YELLOW,atoi(argv[2]));
+  aContext->Display(txt2);
+
+  Handle(QABugs_MyText) txt3 = new QABugs_MyText("Gosha3",gp_Pnt(0,100,100),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_SKYBLUE,atoi(argv[3]));
+  aContext->Display(txt3);
+
+  return 0;
+}
+
+static int geom_get_2Dpt_from_3Dpt(const gp_Pnt& pnt3d, const gp_Pln& pln, gp_Pnt2d& pnt2d)
+{ 
+  int ret = 0; 
+  Handle_Geom_Plane gpln = new Geom_Plane(pln); 
+  GeomAdaptor_Surface adsur(gpln); 
+  Extrema_ExtPS extps(pnt3d, adsur, 0.001, 0.001); 
+  if( extps.IsDone() ) 
+  { 
+    int index;
+    for(index=1; index<= extps.NbExt(); index++ ) 
+    { 
+      Extrema_POnSurf pons = extps.Point(index); 
+      Standard_Real U, V; 
+      pons.Parameter(U, V); 
+      pnt2d.SetCoord(U, V); 
+      ret = 1; 
+    } 
+  } 
+  return ret;
+} 
+
+static Standard_Integer OCC353 (Draw_Interpretor& di, Standard_Integer , const char ** )
+{
+  gp_Ax2 ax21( gp_Pnt(100,0,0), gp_Dir(0,0,1) );
+  Handle_Geom_Circle h_cir1 = new Geom_Circle( ax21, 25 );
+
+  gp_Ax2 ax22( gp_Pnt(-100,0,0), gp_Dir(0,0,1) );
+  Handle_Geom_Circle h_cir2 = new Geom_Circle( ax22, 25 );
+
+  gp_Pln refpln( gp_Pnt(0,0,0), gp_Dir(0,0,1) );
+  Handle_Geom2d_Curve cir2d1 = GeomAPI::To2d(h_cir1, refpln);
+  Handle_Geom2d_Curve cir2d2 = GeomAPI::To2d(h_cir2, refpln);
+
+  Geom2dAdaptor_Curve adop1(cir2d1);
+  Geom2dAdaptor_Curve adop2(cir2d2);
+
+  Geom2dGcc_QualifiedCurve qcur1(adop1, GccEnt_enclosing);
+  Geom2dGcc_QualifiedCurve qcur2(adop2, GccEnt_enclosing);
+
+  Handle_Geom_CartesianPoint h_carpt = new Geom_CartesianPoint(0,175,0);
+
+  gp_Pnt pt3d = h_carpt->Pnt();
+  gp_Pnt2d pt2d;
+  geom_get_2Dpt_from_3Dpt(pt3d, refpln, pt2d);
+
+  Standard_CString st;
+  st = "cir2d1";
+  DrawTrSurf::Set(st,cir2d1);
+  st = "cir2d2";
+  DrawTrSurf::Set(st,cir2d2);
+  st = "pt2d";
+  DrawTrSurf::Set(st,pt2d);
+
+  Handle_Geom2d_CartesianPoint pt = new Geom2d_CartesianPoint(pt2d);
+  Geom2dGcc_Circ2d3Tan sol( qcur1, qcur2, pt, 0.001, 0.0, 0.0);
+
+  int res = 0;
+  Standard_Character buf[10];
+  buf[0] = '\0';
+
+  if( sol.IsDone() ) {
+    res = sol.NbSolutions();
+    for(Standard_Integer i=1;i<=res;i++) {
+      Handle(Geom2d_Circle) aC = new Geom2d_Circle(sol.ThisSolution(i));
+      sprintf(buf,"Result_%d",i);
+      st = buf;
+      DrawTrSurf::Set(st,aC);
+    }
+  }
+  else
+    di << "\n Faulty: no solutions found ";
+  //printf("\n Faulty: no solutions found ");
+
+  //printf("\n Num of solutions are %d ", res );
+  di << "\n Num of solutions are " << res << " ";
+
+  return 0;
+}
+
+static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+  { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " hlr=0/1 setsurfecedetail=0/1; set perspecrive view" << "\n";
+    return 1;
+  }
+
+  Standard_Integer HLR = atoi(argv[1]);
+  if (HLR != 0) {
+    HLR = 1;
+  }
+
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+
+  Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
+  if(atoi(argv[2])) {
+    aViewer->SetDefaultSurfaceDetail(V3d_TEX_ALL);
+  }
+  aViewer->SetDefaultTypeOfView(V3d_PERSPECTIVE);
+
+  Handle(Aspect_Window) asp = aView->Window();
+  aViewer->SetViewOff(aView);
+  aView->Remove();
+
+  Handle(V3d_View) aNewView = aViewer->CreateView();
+  ViewerTest::CurrentView(aNewView);
+
+  aNewView->SetWindow(asp);
+  if (!asp->IsMapped()) asp->Map();
+
+  aNewView->Update();
+
+  if (HLR == 1) {
+    di << "HLR" << "\n";
+    aNewView->SetDegenerateModeOff();
+  }
+
+  return 0;
+}
+
+static Standard_Integer  OCC232 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  BRep_Builder builder;
+  TopoDS_Compound comp;
+  TopoDS_CompSolid cs1, cs2;
+
+  builder.MakeCompound(comp);
+  builder.MakeCompSolid(cs1);
+  builder.MakeCompSolid(cs2);
+
+  TopoDS_Shape sh1 = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 100, 100, 100).Shape();
+  TopoDS_Shape sh2 = BRepPrimAPI_MakeBox(gp_Pnt(100, 0, 0), 100, 100, 100).Shape();
+  TopoDS_Shape sh3 = BRepPrimAPI_MakeBox(gp_Pnt(200, 0, 0), 100, 100, 100).Shape();
+  builder.Add(cs1, sh1);
+  builder.Add(cs1, sh2);
+  builder.Add(cs1, sh3);
+
+  TopoDS_Shape sh4 = BRepPrimAPI_MakeBox(gp_Pnt(0, 500, 0), 100, 100, 100).Shape();
+  TopoDS_Shape sh5 = BRepPrimAPI_MakeBox(gp_Pnt(100, 500, 0), 100, 100, 100).Shape();
+  TopoDS_Shape sh6 = BRepPrimAPI_MakeBox(gp_Pnt(200, 500, 0), 100, 100, 100).Shape();
+
+  builder.Add(cs2, sh4);
+  builder.Add(cs2, sh5);
+  builder.Add(cs2, sh6);
+
+  builder.Add(comp, cs1);
+  builder.Add(comp, cs2);
+
+  Handle_AIS_Shape ais = new AIS_Shape(comp);
+  aContext->Display(ais);
+
+  TopExp_Explorer exp(comp,  TopAbs_COMPSOLID);
+  while(exp.More())
+  {
+    //printf("\n TopAbs_COMPSOLID is  there \n");
+    di << "\n TopAbs_COMPSOLID is  there \n";
+    exp.Next();
+  }
+
+  Handle (StdSelect_ShapeTypeFilter) filt = new StdSelect_ShapeTypeFilter(TopAbs_COMPSOLID);
+  aContext->AddFilter(filt);
+  aContext->CloseAllContexts();
+  aContext->OpenLocalContext(); 
+  aContext->ActivateStandardMode(TopAbs_SOLID);
+
+  return 0; 
+}
+
+static Standard_Integer  OCC138LC (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
+  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300,300));
+  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500,500));
+
+  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
+  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
+  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
+
+  aContext->Display(ais1);
+  aContext->Display(ais2);
+  aContext->Display(ais3);
+
+  aContext->AddOrRemoveSelected(ais1);
+  aContext->AddOrRemoveSelected(ais2);
+  aContext->AddOrRemoveSelected(ais3);
+
+  di << "\n No of selected = " << aContext->NbSelected();
+
+  aContext->InitSelected();
+
+  int count = 1;
+  while(aContext->MoreSelected())
+  {
+    di << "\n count is = %d" << count++;
+    Handle_AIS_InteractiveObject ais = aContext->SelectedInteractive();
+    aContext->AddOrRemoveSelected(ais);
+    aContext->InitSelected();
+  }
+
+  return 0; 
+}
+
+static Standard_Integer  OCC189 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext1 = ViewerTest::GetAISContext();
+  if(aContext1.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  Handle(AIS_InteractiveContext) aContext2 = ViewerTest::GetAISContext();
+  if(aContext2.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
+  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300, 300));
+  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500, 500));
+
+  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
+  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
+  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
+
+  aContext1->Display(ais1);
+  aContext1->Display(ais2);
+  aContext1->Display(ais3);
+
+  aContext2->Display(ais1);
+  aContext2->Display(ais2);
+  aContext2->Display(ais3);
+
+  aContext1->AddOrRemoveCurrentObject(ais1);
+  aContext1->AddOrRemoveCurrentObject(ais2);
+  aContext1->AddOrRemoveCurrentObject(ais3);
+
+  di << "\n Stage : 1";
+  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
+  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
+
+  di << "\n aContext1->IsCurrent = " << (Standard_Integer) aContext1->IsCurrent(ais1) << ", aContext2->IsCurrent = " << (Standard_Integer) aContext2->IsCurrent(ais1) << " ";
+
+  aContext2->AddOrRemoveCurrentObject(ais1);
+  aContext2->AddOrRemoveCurrentObject(ais2);
+  aContext2->AddOrRemoveCurrentObject(ais3);
+
+  di << "\n Stage : 2";
+  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
+  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
+
+  aContext1->InitCurrent();
+  int count1 = 1;
+  while(aContext1->MoreCurrent())
+  {
+    di << "\n count1 is = " << count1++;
+    Handle_AIS_InteractiveObject ais = aContext1->Current();
+    aContext1->AddOrRemoveCurrentObject(ais);
+    aContext1->InitCurrent();
+  }
+
+  di << "\n Stage : 3";
+  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
+  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
+
+  aContext2->InitCurrent();
+  int count2 = 1;
+  while(aContext2->MoreCurrent())
+  {
+    di << "\n count2 is = " << count2++;
+    Handle_AIS_InteractiveObject ais = aContext2->Current();
+    aContext2->AddOrRemoveCurrentObject(ais);
+    aContext2->InitCurrent();
+  }
+
+  di << "\n\n Stage : 4";
+  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
+  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents();
+
+  return 0; 
+}
+
+static Standard_Integer  OCC389 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 3)
+  {
+    di<<"Usage: " << argv[0] << " name shape1 [shape2] ..."<<"\n";
+    return 1;
+  }
+
+  //if (Viewer2dTest::CurrentView().IsNull())
+  //{ 
+  //  cout << "2D AIS Viewer Initialization ..." << endl;
+  //  Viewer2dTest::ViewerInit(); 
+  //  cout << "Done" << endl;
+  //}
+
+  di<<"Begin!"<<"\n";
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  di<<"Check InteractiveContext"<<"\n";
+
+  if(aContext.IsNull()) {
+    di << "use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  di<<"CloseLocalContext"<<"\n";
+  aContext->CloseLocalContext();
+
+  di<<"OpenLocalContext"<<"\n";
+  aContext->OpenLocalContext();
+
+  TCollection_AsciiString name(argv[1]);
+
+  di<<"Found name"<<"\n";
+  Standard_Boolean IsBound = GetMapOfAIS2D().IsBound2(name);
+  if (IsBound)
+  {
+    di<<"Already displayed"<<"\n";
+  }
+  else // Create the AIS2D_ProjShape from a name
+  {
+    di<<"Create the AIS2D_ProjShape from a name; (1)"<<"\n";
+    Prs3d_Projector aPrs3dProjector(Standard_False, 1, -1.0,0.2,0.3, 0.0, 0.0, 0.0, -0.0,0.0,1.0);
+    di<<"Create the AIS2D_ProjShape from a name; (2)"<<"\n";
+    HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();
+    di<<"Create the AIS2D_ProjShape from a name; (3)"<<"\n";
+    Handle(AIS2D_ProjShape) shp_2d =
+      new AIS2D_ProjShape(aProjector, 0, Standard_False, Standard_True);
+    di<<"Create the AIS2D_ProjShape from a name; (4)"<<"\n";
+
+    Standard_Integer i;
+    Standard_Boolean isValid = Standard_False;
+    for (i = 2; i < argc; i++)
+    {
+      di<<"i="<< i-1 <<"\n";
+      TopoDS_Shape aShape = DBRep::Get(argv[i]);
+      if (!aShape.IsNull())
+      {
+        shp_2d->Add( aShape );
+        di<<"Added shape: "<<argv[i]<<"\n";
+        isValid = Standard_True;
+      }
+    }
+
+    if (isValid)
+    {
+      di<<"Now start displaying..."<<"\n";
+      aContext->Display(shp_2d, 1, 1, Standard_True);
+
+      GetMapOfAIS2D().Bind(shp_2d, name);
+    }
+  }
+
+  aContext->UpdateCurrentViewer();
+  return 0; 
+}
+
+#include <BRepBndLib.hxx>
+#include <Draw.hxx>
+//=======================================================================
+//function : OCC566
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC566(Draw_Interpretor& di,Standard_Integer n,const char ** a)
+{
+  if (n < 2) {
+    di<<"Usage: " << a[0] << " shape [ xmin ymin zmin xmax ymax zmax]"<<"\n";
+    return 1;
+  }
+  TopoDS_Shape S = DBRep::Get(a[1]);
+  if (S.IsNull()) return 1;
+  Bnd_Box B;
+  BRepBndLib::AddClose(S,B);
+  Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
+  B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
+  di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax;
+  if (n >= 8) {
+    Draw::Set(a[2],axmin) ;
+    Draw::Set(a[3],aymin) ;
+    Draw::Set(a[4],azmin) ;
+    Draw::Set(a[5],axmax) ;
+    Draw::Set(a[6],aymax) ;
+    Draw::Set(a[7],azmax) ;
+  }
+  return 0;
+}
+
+#include <BRepFilletAPI_MakeFillet.hxx>
+//=======================================================================
+//function : OCC570
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC570 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
+{
+  if (argc < 2) {
+    di<<"Usage: " << argv[0] << " result"<<"\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeBox mkBox(100.,100.,100.);
+  TopoDS_Shape aBox = mkBox.Shape();
+
+  TopExp_Explorer aExp;
+  aExp.Init(aBox,TopAbs_WIRE);
+  if (aExp.More())
+  {
+    TopoDS_Shape aWire = aExp.Current();
+
+    aExp.Init(aWire,TopAbs_EDGE);
+    TopoDS_Edge e1 = TopoDS::Edge(aExp.Current()); aExp.Next();
+    TopoDS_Edge e2 = TopoDS::Edge(aExp.Current()); aExp.Next();
+    TopoDS_Edge e3 = TopoDS::Edge(aExp.Current()); aExp.Next();
+    TopoDS_Edge e4 = TopoDS::Edge(aExp.Current());
+
+    try
+    {
+      OCC_CATCH_SIGNALS
+        BRepFilletAPI_MakeFillet mkFillet(aBox);
+      mkFillet.SetContinuity(GeomAbs_C1,.001);
+
+      // Setup variable fillet data
+      TColgp_Array1OfPnt2d t_pnt(1,4);
+      t_pnt.SetValue(1,gp_Pnt2d(0.0,5.0));
+      t_pnt.SetValue(2,gp_Pnt2d(0.3,15.0));
+      t_pnt.SetValue(3,gp_Pnt2d(0.7,15.0));
+      t_pnt.SetValue(4,gp_Pnt2d(1.0,5.0));
+
+      // HERE:
+      // It is impossible to build fillet if at least one edge
+      // with variable radius is added!!! If all are constant, everything is ok.
+      mkFillet.Add(t_pnt,e1);
+      mkFillet.Add(5.0,e2);
+      mkFillet.Add(t_pnt,e3);
+      mkFillet.Add(5.0,e4);
+
+      mkFillet.Build();
+      TopoDS_Shape aFinalShape = mkFillet.Shape();
+
+      DBRep::Set(argv[1],aFinalShape);
+    }
+    catch(Standard_Failure)
+    {
+      di << argv[0] << ": Exception in fillet"<<"\n";
+      return 2;
+    }
+  }
+
+  return 0;
+}
+
+#include <Law_Interpol.hxx>
+
+static Standard_Real t3d = 1.e-4;
+static Standard_Real t2d = 1.e-5;
+static Standard_Real ta  = 1.e-2;
+static Standard_Real fl  = 1.e-3;
+static Standard_Real tapp_angle = 1.e-2;
+static GeomAbs_Shape blend_cont = GeomAbs_C1;
+
+static BRepFilletAPI_MakeFillet* Rakk = 0;
+static BRepFilletAPI_MakeFillet* Rake = 0;
+static char name[100];
+
+static void printtolblend(Draw_Interpretor& di)
+{
+  di<<"tolerance ang : "<<ta<<"\n";
+  di<<"tolerance 3d  : "<<t3d<<"\n";
+  di<<"tolerance 2d  : "<<t2d<<"\n";
+  di<<"fleche        : "<<fl<<"\n";
+
+  di<<"tolblend "<<ta<<" "<<t3d<<" "<<t2d<<" "<<fl<<"\n";
+}
+
+static Standard_Integer MKEVOL(Draw_Interpretor& di, 
+                               Standard_Integer narg, 
+                               const char ** a)
+{
+  if(Rake != 0) {delete Rake; Rake = 0;}
+  printtolblend(di);
+  if (narg < 3) return 1;
+  TopoDS_Shape V = DBRep::Get(a[2]);
+  Rake = new BRepFilletAPI_MakeFillet(V);
+  Rake->SetParams(ta,t3d,t2d,t3d,t2d,fl);
+  Rake->SetContinuity(blend_cont, tapp_angle);
+  if (narg == 4) {
+    ChFi3d_FilletShape FSh = ChFi3d_Rational;
+    if (!strcasecmp(a[3], "Q")) {
+      FSh = ChFi3d_QuasiAngular;
+    }
+    else if (!strcasecmp(a[3], "P")) {
+      FSh = ChFi3d_Polynomial;
+    }
+    Rake->SetFilletShape(FSh);
+  }
+  strcpy(name, a[1]);
+  return 0;
+}
+
+static Standard_Integer UPDATEVOL(Draw_Interpretor& di, 
+                                  Standard_Integer narg, 
+                                  const char ** a)
+{
+  if(Rake == 0){
+    di << "MakeFillet non initialise"<<"\n";
+    return 1 ;
+  }
+  if(narg%2 != 0 || narg < 4) return 1;
+  TColgp_Array1OfPnt2d uandr(1,(narg/2)-1);
+  Standard_Real Rad, Par;
+  TopoDS_Shape aLocalEdge(DBRep::Get(a[1],TopAbs_EDGE));
+  TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
+  for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){
+    Par = atof(a[2*ii]);
+    Rad = atof(a[2*ii + 1]);
+    uandr.ChangeValue(ii).SetCoord(Par,Rad);
+  }
+  //HELPDESK: Add law creation
+  const Standard_Boolean aLawMode = !strcmp(a[0],"OCC570evollaw");
+  if (aLawMode)
+  {
+    di<<"INFO: Using law to define variable fillet"<<"\n";
+    Handle(Law_Interpol) law = new Law_Interpol;
+    law->Set(uandr);
+    Rake->Add(law,E);
+  }
+  else
+    Rake->Add(uandr,E);
+
+  return 0;
+}
+
+static Standard_Integer BUILDEVOL(Draw_Interpretor& di,
+                                  Standard_Integer, 
+                                  const char **)
+{
+  if(Rake == 0){
+    di << "MakeFillet non initialise"<<"\n";
+    return 1 ;
+  }
+  Rake->Build();
+  if(Rake->IsDone()){
+    TopoDS_Shape result = Rake->Shape();
+    DBRep::Set(name,result);
+    if(Rake != 0) {delete Rake; Rake = 0;}
+    return 0;
+  }
+  if(Rake != 0) {delete Rake; Rake = 0;}
+  return 1;
+}
+
+#include <TColGeom_SequenceOfCurve.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomFill_NSections.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+//=======================================================================
+//function : OCC606
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC606 ( Draw_Interpretor& di, Standard_Integer n, const char ** a )
+{
+  if (n != 3 && n != 4)
+  {
+    di << "Usage : " << a[0] << " result shape [-t]" << "\n";
+    return 0;
+  }
+
+  Standard_Boolean TrimMode = (n == 4);
+  if (TrimMode) di<<"INFO: Using trimmed curves..."<<"\n";
+  else di<<"INFO: Using non trimmed curves..."<<"\n";
+
+  TopoDS_Shape S = DBRep::Get(a[2]);
+
+  TopExp_Explorer t_exp(S,TopAbs_EDGE);
+  TColGeom_SequenceOfCurve n_curves1;
+  TColStd_SequenceOfReal np;
+  Standard_Real param = 5.0;
+
+  for (;t_exp.More();t_exp.Next())
+  {
+    Standard_Real f,l;
+    Handle(Geom_Curve) h_cur = BRep_Tool::Curve(TopoDS::Edge(t_exp.Current()),f,l);
+    if (!h_cur.IsNull())
+    {
+      if (TrimMode) h_cur = new Geom_TrimmedCurve(h_cur,f,l);
+
+      n_curves1.Append(h_cur);
+      np.Append(param);
+      param += 1.0;
+    }
+  }
+
+  if (n_curves1.Length()>1 && !np.IsEmpty())
+  {
+    try
+    {
+      OCC_CATCH_SIGNALS
+        GeomFill_NSections b_surface1(n_curves1, np);
+      b_surface1.ComputeSurface();
+      Handle(Geom_BSplineSurface) result_surf1 = b_surface1.BSplineSurface();
+      if (!result_surf1.IsNull())
+      {
+        BRepBuilderAPI_MakeFace b_face1(result_surf1, Precision::Confusion());
+        TopoDS_Face bsp_face1 = b_face1.Face();
+        DBRep::Set(a[1],bsp_face1);
+      }
+    }
+    catch(Standard_Failure)
+    {
+      di<<"ERROR: Exception in GeomFill_NSections"<<"\n";
+    }
+  }
+
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC813
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC813 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
+{
+  if (argc < 3)
+  {
+    di << "Usage : " << argv[0] << " U V" << "\n";
+    return 1;
+  }
+
+  Standard_CString str;
+  Standard_Real U = atof(argv[1]);
+  Standard_Real V = atof(argv[2]);
+
+  //Between ellipse and point:
+
+  Handle(Geom_Ellipse) ell = new Geom_Ellipse(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
+    gp_Dir(0.173648,0.984808,0.000000),
+    gp_Dir(-0.932169,0.164367,-0.322560)), 150, 100);
+  Handle(Geom_Plane) plne = new Geom_Plane(gp_Ax3(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
+    gp_Dir(0.173648,0.984808,0.000000),
+    gp_Dir(-0.932169,0.164367,-0.322560))) );
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+  gp_Pnt2d pt2d(U,V);
+  gp_Pln pln = plne->Pln();
+
+  str = "OCC813_pnt"; DrawTrSurf::Set(str,pt2d);
+
+  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d(ell,pln);
+  Geom2dAdaptor_Curve acur(curve2d);
+  Geom2dGcc_QualifiedCurve qcur(acur, GccEnt_outside);
+
+  str = "OCC813_ell"; DrawTrSurf::Set(str,curve2d);
+  if(!aContext.IsNull()) {
+    Handle(AIS_Shape) aisp = 
+      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
+    aContext->Display (aisp);
+  }
+
+  //This does not give any solutions.
+  Geom2dGcc_Lin2d2Tan lintan(qcur, pt2d, 0.1);
+  di<<"OCC813 nb of solutions = "<<lintan.NbSolutions()<<"\n";
+
+  Standard_Character abuf[16];
+  Standard_CString st = abuf;
+
+  Standard_Integer i;
+  for(i=1;i<=lintan.NbSolutions();i++) {
+    sprintf(abuf,"lintan_%d",i);
+    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
+    DrawTrSurf::Set(st,glin);
+    if(!aContext.IsNull()) {
+      Handle(AIS_Shape) aisp = 
+        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
+    }
+  }
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC814
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC814 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
+{
+  if (argc > 1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+
+  Standard_CString str;
+
+  //Between Ellipse and Circle:
+
+  Handle(Geom_Circle) cir = new Geom_Circle(gp_Ax2(gp_Pnt(823.687192,502.366825,478.960440),
+    gp_Dir(0.173648,0.984808,0.000000),
+    gp_Dir(-0.932169,0.164367,-0.322560)), 50);
+  Handle(Geom_Ellipse) ell = new Geom_Ellipse(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
+    gp_Dir(0.173648,0.984808,0.000000),
+    gp_Dir(-0.932169,0.164367,-0.322560)), 150, 100);
+  Handle(Geom_Plane) plne = new Geom_Plane(gp_Ax3(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
+    gp_Dir(0.173648,0.984808,0.000000),
+    gp_Dir(-0.932169,0.164367,-0.322560))) );
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+
+  gp_Pln pln = plne->Pln();
+  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d(ell, pln);
+  Handle(Geom2d_Curve) fromcurve2d = GeomAPI::To2d(cir, pln);
+
+  str = "OCC814_cir"; DrawTrSurf::Set(str,curve2d);
+  str = "OCC814_ell"; DrawTrSurf::Set(str,fromcurve2d);
+  if(!aContext.IsNull()) {
+    Handle(AIS_Shape) aisp = 
+      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
+    aContext->Display (aisp);
+  }
+  if(!aContext.IsNull()) {
+    Handle(AIS_Shape) aisp = 
+      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(fromcurve2d, pln)).Edge());
+    aContext->Display (aisp);
+  }
+
+  Geom2dAdaptor_Curve acur(curve2d), afromcur(fromcurve2d);
+
+  Geom2dGcc_QualifiedCurve qcur(acur, GccEnt_outside) ;
+  Geom2dGcc_QualifiedCurve qfromcur(afromcur, GccEnt_outside) ;
+
+  //This does not give any solutions.
+  Geom2dGcc_Lin2d2Tan lintan(qcur, qfromcur, 0.1);
+  di<<"OCC814 nb of solutions = "<<lintan.NbSolutions()<<"\n";
+
+  Standard_Character abuf[16];
+  Standard_CString st = abuf;
+
+  Standard_Integer i;
+  for(i=1;i<=lintan.NbSolutions();i++) {
+    sprintf(abuf,"lintan_%d",i);
+    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
+    DrawTrSurf::Set(st,glin);
+    if(!aContext.IsNull()) {
+      Handle(AIS_Shape) aisp = 
+        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
+    }
+  }
+
+  return 0;
+}
+
+#include <ShapeAnalysis_Wire.hxx>
+#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
+#include <ShapeFix_Wire.hxx>
+//=======================================================================
+//function : OCC884
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC884 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 3 || argc > 5)
+  {
+    di << "Usage : " << argv[0] << " result shape [toler [maxtoler]]" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape shape = DBRep::Get(argv[2]); //read the shape
+
+  TopExp_Explorer exp(shape, TopAbs_EDGE);
+  if (!exp.More())
+  {
+    di<<"Error: no edge found"<<"\n";
+    return 1;
+  }
+
+  BRep_Builder builder;
+  TopoDS_Wire wire;
+  builder.MakeWire(wire);
+  builder.Add(wire, TopoDS::Edge(exp.Current()));
+
+  // HelpDesk: Create planar face if possible
+  TopoDS_Face face = BRepBuilderAPI_MakeFace(wire,Standard_True);
+
+  Handle(ShapeAnalysis_Wire) advWA = new ShapeAnalysis_Wire;
+  advWA->Load(wire);
+  advWA->SetFace(face);
+  advWA->SetPrecision(0.001);
+
+  IntRes2d_SequenceOfIntersectionPoint points2d;
+  TColgp_SequenceOfPnt points3d;
+
+  di << "Info: CheckSelfIntersectingEdge = " << (Standard_Integer) advWA->CheckSelfIntersectingEdge(1,points2d,points3d) << "\n";
+
+  ShapeExtend_Status status = ShapeExtend_FAIL1;
+  if (advWA->StatusSelfIntersection(status))
+    di << "Info: No P Curve found in the edge\n";
+
+  status = ShapeExtend_FAIL2; 
+  if (advWA->StatusSelfIntersection(status))
+    di << "Info: No Vertices found in the edge\n";
+
+  status = ShapeExtend_DONE1; 
+  if (advWA->StatusSelfIntersection(status))
+    di << "Info: Self-intersection found in the edge\n";
+
+  Standard_Integer i, num = points2d.Length();
+  di << "Info: No. of self-intersection points : " << num << "\n";
+
+  char str[80];
+  Standard_CString name = str;
+  for (i = 1; i <= num; ++i)
+  { 
+    gp_Pnt pt = points3d(i); 
+    di << "Info: Intersecting pt : (" << pt.X() << ", " << pt.Y() << ", " << pt.Z() << ")\n";
+    sprintf(str,"p_%d",i);
+    DrawTrSurf::Set(name,pt);
+  }
+
+  Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
+  sfw->Load(wire);
+  sfw->SetFace(face);
+
+  if (argc > 3) sfw->SetPrecision(atof(argv[3])/*0.1*/);
+  if (argc > 4) sfw->SetMaxTolerance(atof(argv[4]));
+  di << "Info: Precision is set to " << sfw->Precision() << "\n";
+  di << "Info: MaxTolerance is set to " << sfw->MaxTolerance() << "\n";
+
+  sfw->ModifyTopologyMode() = 1;
+  sfw->ModifyGeometryMode() = 1; 
+  sfw->FixSelfIntersectingEdgeMode() = 1;
+  //printf("Info: FixSelfIntersection = %d\n",sfw->FixSelfIntersection());
+  di << "Info: FixSelfIntersection = " << (Standard_Integer) sfw->FixSelfIntersection() << "\n";
+
+  DBRep::Set(argv[1],sfw->Wire());
+
+  status = ShapeExtend_OK;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_OK : No intersection found\n";
+  //printf("Info: ShapeExtend_OK : No intersection found\n");
+
+  status = ShapeExtend_FAIL1;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_FAIL1 : analysis failed (edge has no pcurve, or no vertices etc.)\n";
+
+  status = ShapeExtend_FAIL2;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_FAIL2 : self-intersection was found, but not fixed because of limit of increasing tolerance (MaxTolerance)\n";
+
+  status = ShapeExtend_FAIL3;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_FAIL3 : intercestion of non adjacent edges found, but not fixed because of limit of increasing tolerance (MaxTolerance)\n";
+
+  status = ShapeExtend_DONE1;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE1 : tolerance of vertex was increased to fix self-intersection\n";
+
+  status = ShapeExtend_DONE2;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE2 : vertex was moved to fix self-intersection\n";
+
+  status = ShapeExtend_DONE3;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE3 : some edges were removed because of intersection\n";
+
+  status = ShapeExtend_DONE4;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE4 : pcurve(s) was(were) modified\n";
+
+  status = ShapeExtend_DONE5;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE5 : non adjacent intersection fixed by increasing tolerance of vertex(vertices)\n";
+
+  status = ShapeExtend_DONE6;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE6 : tolerance of edge was increased to hide intersection\n";
+
+  status = ShapeExtend_DONE7;
+  if (sfw->StatusSelfIntersection(status))
+    di << "Info: ShapeExtend_DONE7 : range of some edges was decreased to avoid intersection\n";
+
+  return 0;
+}
+
+#include <Aspect_FillMethod.hxx>
+//=======================================================================
+//function : OCC1188
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC1188 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 2 || argc > 3)
+  {
+    di << "Usage : " << argv[0] << " imagefile [filltype] : Load image as background" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
+  if(AISContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  Aspect_FillMethod aFillType = Aspect_FM_CENTERED;
+  if (argc == 3)
+  {
+    const char* szType = argv[2];
+    if      (strcmp(szType, "NONE"    ) == 0) aFillType = Aspect_FM_NONE;
+    else if (strcmp(szType, "CENTERED") == 0) aFillType = Aspect_FM_CENTERED;
+    else if (strcmp(szType, "TILED"   ) == 0) aFillType = Aspect_FM_TILED;
+    else if (strcmp(szType, "STRETCH" ) == 0) aFillType = Aspect_FM_STRETCH;
+    else
+    {
+      di << "Wrong fill type : " << szType << "\n";
+      di << "Must be one of CENTERED, TILED, STRETCH, NONE" << "\n";
+      return 1;
+    }
+  }
+
+  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
+  V3dView->SetBackgroundImage(argv[1], aFillType, Standard_True);
+
+  return 0;
+}
+
+#include <AIS_Drawer.hxx>
+#include <Graphic3d_MaterialAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+//=======================================================================
+//function : OCC1174_1
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2)
+  {
+    di << "Usage : " << argv[0] << " shape" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
+  if(AISContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape sh = DBRep::Get(argv[1]);
+
+  Handle(AIS_Shape) ais = new AIS_Shape(sh);
+
+  Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_RGB);
+  Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_RGB);
+
+  Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect();
+
+  Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE);
+  front.SetAmbientColor(colf);
+  front.SetDiffuseColor(colf);
+  front.SetSpecularColor(colf);
+  front.SetEmissiveColor(colf);
+  front.SetTransparency(0.0);
+  sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE);
+
+  Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE);
+  back.SetAmbientColor(colb);
+  back.SetDiffuseColor(colb);
+  back.SetSpecularColor(colb);
+  back.SetEmissiveColor(colb);
+  back.SetTransparency(0.0);
+  sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE);
+
+  AISContext->Display(ais,1,0);
+
+  Standard_Real r, g, b; 
+  sa->Color(Aspect_TOFM_FRONT_SIDE).Values(r,g,b, Quantity_TOC_RGB);
+  di << "Info: color on front side (" << r << "," << g << "," << b << ")\n";
+  sa->Color(Aspect_TOFM_BACK_SIDE).Values(r,g,b, Quantity_TOC_RGB);
+  di << "Info: color on back side (" << r << "," << g << "," << b << ")\n";
+
+  return 0;
+}
+
+//=======================================================================
+//function : OCC1174_2
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC1174_2 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 2)
+  {
+    di << "Usage : " << argv[0] << " shape" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
+  if(AISContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape sh = DBRep::Get(argv[1]);
+
+  Handle(AIS_Shape) ais = new AIS_Shape(sh); 
+  AISContext->Display(ais,1,0); 
+  AISContext->SetMaterial(ais,Graphic3d_NOM_SHINY_PLASTIC); 
+
+  Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_RGB); 
+  Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_RGB); 
+  Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect(); 
+
+  Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE); 
+  front.SetAmbientColor(colf); 
+  front.SetDiffuseColor(colf); 
+  front.SetSpecularColor(colf); 
+  front.SetEmissiveColor(colf); 
+  front.SetTransparency(0.4); 
+  sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE); 
+
+  Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE); 
+  back.SetAmbientColor(colb); 
+  back.SetDiffuseColor(colb); 
+  back.SetSpecularColor(colb); 
+  back.SetEmissiveColor(colb); 
+  back.SetTransparency(0.2); 
+  sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE); 
+
+  AISContext->Redisplay(ais,1,0);
+
+  return 0;
+}
+
+#include <Graphic2d_Segment.hxx>
+#include <Prs2d_Length.hxx>
+#include <Prs2d_AspectLine.hxx>
+#include <AIS2D_InteractiveObject.hxx>
+//=======================================================================
+//  OCC672:
+//         OCC672_Length
+//         OCC672_Angle
+//         OCC672_Diameter
+//         OCC672_ShortLength 
+//=======================================================================
+
+static Standard_Integer OCC672_Length (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
+{
+  if (n != 17) {
+    di << " wrong parameters !\n";
+    di << "must be : OCC672_Length x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 TxtAngle TxtPosH TxtPosV\n";
+    return 1;
+  }
+
+  Standard_Real x1=atof(argv[1]);
+  Standard_Real y1=atof(argv[2]);
+  Standard_Real x2=atof(argv[3]);
+  Standard_Real y2=atof(argv[4]);
+  Standard_Real x3=atof(argv[10]);
+  Standard_Real y3=atof(argv[11]);
+  Standard_Real x4=atof(argv[12]);
+  Standard_Real y4=atof(argv[13]);
+  Standard_Real txtAngle=atof(argv[14]);
+  Standard_Real txtPosH=atof(argv[15]);
+  Standard_Real txtPosV=atof(argv[16]);
+
+  di<<"Begin!\n";
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  di<<"Check InteractiveContext\n";
+
+  if(aContext.IsNull()) {
+    di << "use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  di<<"CloseLocalContext\n";
+  aContext->CloseLocalContext();
+
+  di<<"OpenLocalContext\n";
+  aContext->OpenLocalContext();
+  //step0 end  
+  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
+  Handle(Graphic2d_Segment) theSegmA, theSegmB, theSegmC, theSegmD;
+
+  theSegmA = new Graphic2d_Segment( aIO10, x1, y1, x2, y2 );
+  theSegmB = new Graphic2d_Segment( aIO10, x2, y2, x3, y3 );
+  theSegmC = new Graphic2d_Segment( aIO10, x3, y3, x4, y4 );
+  theSegmD = new Graphic2d_Segment( aIO10, x4, y4, x1, y1 );
+
+  aContext->Display( aIO10, Standard_True ); 
+
+  Handle(Prs2d_Length) length = new Prs2d_Length(aIO10, gp_Pnt2d(x1, y1), gp_Pnt2d(x2, y2), argv[5],
+    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
+    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR);
+
+  length->SetTextRelPos(txtPosH,txtPosV);
+  length->SetTextRelAngle(txtAngle);
+
+  Handle(Prs2d_AspectLine) theAspect = new Prs2d_AspectLine(Quantity_NOC_WHITE,
+    Aspect_TOL_SOLID, Aspect_WOL_THIN);
+  aIO10->SetAspect( theAspect,  length);
+  aContext->Display( aIO10, Standard_True );
+
+  Handle(Prs2d_Length) lengthB = new Prs2d_Length(aIO10, gp_Pnt2d(x2, y2), gp_Pnt2d(x3, y3), argv[5],
+    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
+    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR);
+
+  lengthB->SetTextRelPos(txtPosH,txtPosV);
+  lengthB->SetTextRelAngle(txtAngle);
+
+  aIO10->SetAspect( theAspect,  lengthB);
+  aContext->Display( aIO10, Standard_True );
+
+  Handle(Prs2d_Length) lengthC = new Prs2d_Length(aIO10, gp_Pnt2d(x3, y3), gp_Pnt2d(x4, y4), argv[5],
+    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
+    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR);
+
+  lengthC->SetTextRelPos(txtPosH,txtPosV);
+  lengthC->SetTextRelAngle(txtAngle);
+
+  aIO10->SetAspect( theAspect,  lengthC);
+  aContext->Display( aIO10, Standard_True );
+
+  Handle(Prs2d_Length) lengthD = new Prs2d_Length(aIO10, gp_Pnt2d(x4, y4), gp_Pnt2d(x1, y1), argv[5],
+    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
+    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR);
+
+  lengthD->SetTextRelPos(txtPosH,txtPosV);
+  lengthD->SetTextRelAngle(txtAngle);
+
+  aIO10->SetAspect( theAspect,  lengthD);
+  aContext->Display( aIO10, Standard_True );
+  return 0;
+}
+
+#include <Prs2d_Angle.hxx>
+static Standard_Integer OCC672_Angle (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
+{
+  if (n != 15) {
+    di << "Wrong parameters !\n";
+    di << "must be : OCC672_Angle x1 y1 x2 y2 x3 y3 aRadius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV  \n";
+    return 1;
+  }
+
+  Standard_Real x1=atof(argv[1]);
+  Standard_Real y1=atof(argv[2]);
+  Standard_Real x2=atof(argv[3]);
+  Standard_Real y2=atof(argv[4]);
+  Standard_Real x3=atof(argv[5]);
+  Standard_Real y3=atof(argv[6]);
+  Standard_Real aRadius=atof(argv[7]);
+  Standard_Real aTxtScale=atof(argv[9]);
+  Standard_Real anArrAngle=atof(argv[10]);
+  Standard_Real anArrLength=atof(argv[11]);
+  Standard_Real txtAngle=atof(argv[12]);
+  Standard_Real txtPosH=atof(argv[13]);
+  Standard_Real txtPosV=atof(argv[14]);
+
+  di<<"Begin!\n";
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  di<<"Check InteractiveContext\n";
+
+  if(aContext.IsNull()) {
+    di << "use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  di<<"CloseLocalContext\n";
+  aContext->CloseLocalContext();
+
+  di<<"OpenLocalContext\n";
+  aContext->OpenLocalContext();
+
+  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
+  Handle(Graphic2d_Segment) theSegmA, theSegmB;
+  theSegmA = new Graphic2d_Segment( aIO10, x1, y1, x2, y2 );
+  theSegmB = new Graphic2d_Segment( aIO10, x1, y1, x3, y3 );
+  aContext->Display( aIO10, Standard_True ); 
+
+  Handle(Prs2d_Angle) angle = new Prs2d_Angle(aIO10, gp_Pnt2d(x1, y1), gp_Pnt2d(x2, y2),gp_Pnt2d(x3,y3),
+    aRadius,argv[8],aTxtScale,anArrAngle,anArrLength,Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR);
+
+  angle->SetTextRelPos(txtPosH,txtPosV);
+  angle->SetTextAbsAngle(txtAngle);
+
+  aContext->Display( aIO10, Standard_True );
+  return 0; 
+}
+
+#include <Prs2d_Diameter.hxx>
+#include <gp_Circ2d.hxx>
+#include <Graphic2d_Circle.hxx>
+#include <Prs2d_AspectText.hxx>
+static Standard_Integer OCC672_Diameter (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
+{
+  if (n != 13) {
+    di << "Wrong parameters !\n";
+    di << "must be : OCC672_Diameter x1 y1 cx cy radius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV\n";
+    return 1;
+  }
+
+  Standard_Real x1=atof(argv[1]);
+  Standard_Real y1=atof(argv[2]);
+  Standard_Real cx=atof(argv[3]);    //coordinats for circle 
+  Standard_Real cy=atof(argv[4]);    //
+  Standard_Real radius=atof(argv[5]);//radius for circle 
+  Standard_Real aTxtScale=atof(argv[7]);
+  Standard_Real anArrAngle=atof(argv[8]);
+  Standard_Real anArrLength=atof(argv[9]);
+
+  Standard_Real txtAngle=atof(argv[10]);
+  Standard_Real txtPosH=atof(argv[11]);
+  Standard_Real txtPosV=atof(argv[12]);
+
+
+  di<<"Begin!\n";
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  di<<"Check InteractiveContext\n";
+
+  if(aContext.IsNull()) {
+    di << "use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  di<<"CloseLocalContext\n";
+  aContext->CloseLocalContext();
+
+  di<<"OpenLocalContext\n";
+  aContext->OpenLocalContext();
+  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject(); 
+
+  Handle (Graphic2d_Circle) HCirc;
+  HCirc= new Graphic2d_Circle(aIO10,cx,cy,radius);
+
+  gp_Dir2d myDir2d(1,0);
+  gp_Pnt2d myPnt2d(cx,cy);
+  gp_Ax2d myAx2d(myPnt2d,myDir2d);
+  gp_Circ2d myCirc(myAx2d,radius);
+
+  Handle(Prs2d_Diameter) diameter = new Prs2d_Diameter(aIO10, gp_Pnt2d(x1, y1),myCirc,
+    argv[6],aTxtScale,anArrAngle,anArrLength,
+    Prs2d_TOA_FILLED,
+    Prs2d_AS_BOTHAR,Standard_True);
+
+  diameter->SetTextRelPos(txtPosH,txtPosV);
+
+  diameter->SetTextAbsAngle(txtAngle);
+
+  aContext->Display( aIO10, Standard_True );
+
+  return 0;
+}
+
+#include <gp_Lin2d.hxx>
+static Standard_Integer OCC672_ShortLength (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
+{
+  if (n != 17) {
+    di << " wrong parameters !\n";
+    di << "must be : OCC672_ShortLength x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 TxtAngle TxtPosH TxtPosV\n";
+    return 1;
+  }
+
+  Standard_Real x1=atof(argv[1]);
+  Standard_Real y1=atof(argv[2]);
+  Standard_Real x2=atof(argv[3]);
+  Standard_Real y2=atof(argv[4]);
+  Standard_Real x3=atof(argv[10]);
+  Standard_Real y3=atof(argv[11]);
+  Standard_Real x4=atof(argv[12]);
+  Standard_Real y4=atof(argv[13]);
+  Standard_Real txtAngle=atof(argv[14]);
+  Standard_Real txtPosH=atof(argv[15]);
+  Standard_Real txtPosV=atof(argv[16]);
+
+
+  di<<"Begin!\n";
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  di<<"Check InteractiveContext\n";
+
+  if(aContext.IsNull()) {
+    di << "use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  di<<"CloseLocalContext\n";
+  aContext->CloseLocalContext();
+
+  di<<"OpenLocalContext\n";
+  aContext->OpenLocalContext();
+
+  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
+  Handle(Graphic2d_Segment) theSegmA, theSegmB, theSegmC, theSegmD;
+  theSegmB = new Graphic2d_Segment( aIO10, x2, y2, x3, y3 );
+  theSegmD = new Graphic2d_Segment( aIO10, x4, y4, x1, y1 );
+
+  aContext->Display( aIO10, Standard_True ); 
+
+  gp_Pnt2d p3(x3,y3),p2(x2,y2),p1(x1,y1);
+  gp_Vec2d theVec(p3,p2);
+  gp_Dir2d theDir(theVec);
+  gp_Lin2d theLin1(p1,theDir);
+  gp_Lin2d theLin2(p3,theDir);
+
+  Handle(Prs2d_Length) length = new Prs2d_Length(aIO10, p1, theLin2, argv[5],
+    atof(argv[6]), 5.0, 20.0, 5.,
+    Prs2d_TOA_CLOSED,Prs2d_AS_BOTHAR,
+    Standard_True);
+
+
+  Handle(Prs2d_AspectLine) theAspect = new Prs2d_AspectLine(Quantity_NOC_WHITE,
+    Aspect_TOL_SOLID, Aspect_WOL_THIN);
+  length->SetTextRelPos(txtPosH,txtPosV);
+  length->SetTextRelAngle(txtAngle);
+
+  aIO10->SetAspect( theAspect,  length);
+  aContext->Display( aIO10, Standard_True );
+
+  return 0;
+}
+
+#include <TopoDS_Solid.hxx>
+#include <BRepFeat_MakeDPrism.hxx>
+//=======================================================================
+//function : OCCN1
+//purpose  : FEATURE OPERATION (BOSS and SLOT)
+//=======================================================================
+static Standard_Integer OCCN1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 4)
+  {
+    di << "Usage : " << argv[0] << " angle fuse(1 for boss / 0 for slot) length" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  Standard_Real    angle  = atof(argv[1]);
+  Standard_Integer fuse   = atoi(argv[2]);
+  Standard_Real    length = atof(argv[3]);
+
+  BRepBuilderAPI_MakeEdge edge1(gp_Pnt(0, 0, 0), gp_Pnt(50, 0, 0));
+  BRepBuilderAPI_MakeEdge edge2(gp_Pnt(50, 0, 0), gp_Pnt(50, 50, 0));
+  BRepBuilderAPI_MakeEdge edge3(gp_Pnt(50, 50, 0), gp_Pnt(0, 50, 0));
+  BRepBuilderAPI_MakeEdge edge4(gp_Pnt(0, 50, 0), gp_Pnt(0, 0, 0));
+  TopoDS_Edge ted1 = edge1.Edge();
+  TopoDS_Edge ted2 = edge2.Edge();
+  TopoDS_Edge ted3 = edge3.Edge();
+  TopoDS_Edge ted4 = edge4.Edge();
+
+  BRepBuilderAPI_MakeWire wire(ted1, ted2, ted3, ted4);
+  TopoDS_Wire twire = wire.Wire();
+
+  BRepBuilderAPI_MakeFace face(twire);
+  TopoDS_Face tface = face.Face();
+  ////////Handle_AIS_Shape face_ais = new AIS_Shape( tface );
+  ////////aContext->Display(face_ais);
+
+  TopoDS_Solid box;
+  BRepPrimAPI_MakeBox block(gp_Pnt(-50, -50, -150), 150, 150, 100);
+  box = block.Solid();
+
+  TopoDS_Face top_face;
+  top_face = block.TopFace();
+
+  BRepFeat_MakeDPrism slot(box, tface, top_face, angle, fuse,
+    Standard_True);
+
+  slot.Perform(length);
+  TopoDS_Shape S2 = slot.Shape();
+
+  DBRep::Set("OCCN1_tface",tface);
+  DBRep::Set("OCCN1_slot",S2);
+
+  return 0;
+}
+
+#include <BRepPrimAPI_MakeCylinder.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <BRepAlgoAPI_Section.hxx>
+#include <BRepAlgo_Section.hxx>
+//=======================================================================
+//function : OCCN2
+//purpose  : BOOLEAN OPERATION
+//=======================================================================
+static Standard_Integer OCCN2 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc > 2) {
+    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 2) {
+    Standard_Integer IsB = atoi(argv[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def04)
+#endif
+    }
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  BRepPrimAPI_MakeCylinder cylinder(50,200);
+  TopoDS_Shape cylinder_sh = cylinder.Shape();
+
+  BRepPrimAPI_MakeSphere sphere(gp_Pnt(60,0,100),50);
+  TopoDS_Shape sphere_sh = sphere.Shape();
+
+  //BRepAlgoAPI_Section section(cylinder_sh, sphere_sh);
+  //TopoDS_Shape shape = section.Shape();
+
+  TopoDS_Shape shape;
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Section section(cylinder_sh, sphere_sh)" <<"\n";
+    BRepAlgoAPI_Section section(cylinder_sh, sphere_sh);
+    section.Build();
+    if(!section.IsDone()){
+      di << "Error performing intersection: not done." << "\n";
+    }
+    shape = section.Shape();
+  } else {
+    di << "BRepAlgo_Section section(cylinder_sh, sphere_sh)" <<"\n";
+    BRepAlgo_Section section(cylinder_sh, sphere_sh);
+    section.Build();
+    if(!section.IsDone()){
+      di << "Error performing intersection: not done." << "\n";
+    }
+    shape = section.Shape();
+  }
+
+  DBRep::Set("OCCN2_cylinder",cylinder_sh);
+  DBRep::Set("OCCN2_sphere",sphere_sh);
+  DBRep::Set("OCCN2_section",shape);
+
+  return 0;
+}
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <Geom_BezierCurve.hxx>
+
+static Standard_Integer OCC2569 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+  {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  if(argc != 3) {
+    di << "Usage : " << argv[0] << " nbpoles result" << "\n";
+    return 1;
+  }
+
+  int poles=atoi(argv[1]); 
+
+  TColgp_Array1OfPnt arr(1, poles); 
+  for(int i=1; i<=poles; i++) 
+    arr.SetValue(i, gp_Pnt(i+10, i*2+20, i*3+45)); 
+
+  Handle_Geom_BezierCurve bez = new Geom_BezierCurve(arr); 
+  if(bez.IsNull()) {
+    di << "\n The curve is not created.\n";
+  } else {
+    di << "\n Degree = " << bez->Degree() << "\n";   
+  }
+  TopoDS_Edge sh = BRepBuilderAPI_MakeEdge(bez).Edge(); 
+  Handle_AIS_Shape ais = new AIS_Shape(sh); 
+  aContext->Display(ais); 
+  DrawTrSurf::Set(argv[2],bez);
+  return 0;
+}
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
+
+static Standard_Integer OCC1642 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 10) {
+    di<<"Usage: " << argv[0] << " FinalWare FinalFace InitWare InitFace shape FixReorder FixDegenerated FixConnected FixSelfIntersection"<<"\n";
+    return 1;
+  }
+
+  TopoDS_Shape shape = DBRep::Get(argv[5]);
+
+  TopExp_Explorer exp(shape, TopAbs_WIRE);
+  TopoDS_Shape wire = exp.Current();
+
+  Handle(ShapeAnalysis_Wire) advWA = new ShapeAnalysis_Wire;
+  advWA->Load(TopoDS::Wire(wire));
+
+  DBRep::Set(argv[3],wire);
+
+  TopoDS_Face face =
+    BRepBuilderAPI_MakeFace(TopoDS::Wire(wire),Standard_True);
+
+  DBRep::Set(argv[4],face);
+
+  advWA->SetFace(face);
+  float precision_to_ana = 0.0001;
+  advWA->SetPrecision(precision_to_ana);
+
+  TopTools_IndexedMapOfShape M;
+  TopExp::MapShapes(wire, TopAbs_EDGE, M);
+
+  int j= 1;
+  for(j= 1; j<=M.Extent(); ++j) {
+    Standard_Integer num=1;
+    IntRes2d_SequenceOfIntersectionPoint points2d;
+    TColgp_SequenceOfPnt points3d;
+
+    cout << "\n j =" << j << ",  CheckSelfIntersectingEdge = " <<
+      advWA->CheckSelfIntersectingEdge(j, points2d, points3d);
+
+
+    ShapeExtend_Status status = ShapeExtend_FAIL1;
+    if(advWA->StatusSelfIntersection(status))
+
+      status = ShapeExtend_FAIL2;
+    if(advWA->StatusSelfIntersection(status))
+      di << "\n No Vertices found in the edge";
+
+    status = ShapeExtend_DONE1;
+    if(advWA->StatusSelfIntersection(status))
+      di << "\n Self-intersection found in the edge";
+
+    num = points2d.Length();
+    di << "\n No. of self-intersecting edges : " << num;
+
+    for(int i=1; i<=num; ++i) {
+      gp_Pnt pt = points3d(i);
+      di << "\n Intersecting pt : (" << pt.X() << ", " << pt.Y()<< ", " << pt.Z() << ")";
+    }
+
+  }
+
+  Handle_ShapeFix_Wire sfw = new ShapeFix_Wire;
+  sfw->Load(TopoDS::Wire(wire));
+  sfw->SetFace(face);
+  sfw->SetPrecision(Precision::Confusion());
+
+  sfw->FixReorderMode() = 1;
+  sfw->ClosedWireMode() = 1;
+  sfw->FixDegeneratedMode() = 1;
+  sfw->FixConnectedMode() = 1;
+  sfw->ModifyTopologyMode() = 1;
+  sfw->ModifyGeometryMode() = 1;
+  sfw->FixSelfIntersectionMode() = 1;
+  sfw->FixSelfIntersectingEdgeMode() = 1;
+  sfw->FixIntersectingEdgesMode() = 1;
+  sfw->FixNonAdjacentIntersectingEdgesMode() = 1;
+  sfw->FixEdgeCurvesMode() = 1;
+
+  sfw->ModifyRemoveLoopMode() = 1;
+  sfw->SetMaxTolerance(1.0);
+
+  di << "\n FixReorder = " << (Standard_Integer) sfw->FixReorder();
+  di << "\n FixDegenerated = " << (Standard_Integer) sfw->FixDegenerated();
+  di << "\n FixConnected = " << (Standard_Integer) sfw->FixConnected();
+  di << "\n";
+  di << "\n FixSelfIntersection = " << (Standard_Integer) sfw->FixSelfIntersection();
+  di << "\n";
+
+  Draw::Set(argv[6],sfw->FixReorder()) ;
+  Draw::Set(argv[7],sfw->FixDegenerated()) ;
+  Draw::Set(argv[8],sfw->FixConnected()) ;
+  Draw::Set(argv[9],sfw->FixSelfIntersection()) ;
+
+  ShapeExtend_Status status = ShapeExtend_OK;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_OK : No intersection found";
+
+  status = ShapeExtend_FAIL1;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_FAIL1 : analysis failed (edge has no pcurve,or no vertices etc.)";
+
+  status = ShapeExtend_FAIL2;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_FAIL2 : self-intersection was found, but not fixed because of limit of increasing tolerance (MaxTolerance)";
+
+  status = ShapeExtend_FAIL3;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_FAIL3 : intercestion of non adjacent edges found, but not fixed because of limit of increasing tolerance (MaxTolerance)";
+
+  status = ShapeExtend_DONE1;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE1 : tolerance of vertex was increased to fix self-intersection";
+
+  status = ShapeExtend_DONE2;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE2 : vertex was moved to fix self-intersection";
+
+  status = ShapeExtend_DONE3;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE3 : some edges were removed because of intersection";
+
+  status = ShapeExtend_DONE4;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE4 : pcurve(s) was(were) modified";
+
+  status = ShapeExtend_DONE5;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE5 : non adjacent intersection fixed by increasing tolerance of vertex(vertices)";
+
+  status = ShapeExtend_DONE6;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE6 : tolerance of edge was increased to hide intersection";
+
+  status = ShapeExtend_DONE7;
+  if(sfw->StatusSelfIntersection(status))
+    di << "\n ShapeExtend_DONE7 : range of some edges was decreased to avoid intersection";
+
+  TopoDS_Wire finalwire = sfw->Wire();
+
+  DBRep::Set(argv[1],finalwire);
+
+
+  advWA->Load(TopoDS::Wire(finalwire));
+
+  TopoDS_Face fface =
+    BRepBuilderAPI_MakeFace(TopoDS::Wire(finalwire),Standard_True);
+
+  DBRep::Set(argv[2],fface);
+
+  advWA->SetFace(fface);
+
+  TopTools_IndexedMapOfShape fM;
+  TopExp::MapShapes(finalwire, TopAbs_EDGE, fM);
+
+  for(j= 1; j<=fM.Extent(); ++j) {
+    Standard_Integer num=1;
+    IntRes2d_SequenceOfIntersectionPoint points2d;
+    TColgp_SequenceOfPnt points3d;
+
+    di << "\n j =" << j << ",  CheckSelfIntersectingEdge = " <<
+      (Standard_Integer) advWA->CheckSelfIntersectingEdge(j, points2d, points3d);
+
+
+    ShapeExtend_Status status = ShapeExtend_FAIL1;
+    if(advWA->StatusSelfIntersection(status))
+
+      status = ShapeExtend_FAIL2;
+    if(advWA->StatusSelfIntersection(status))
+      di << "\n No Vertices found in the edge";
+
+    status = ShapeExtend_DONE1;
+    if(advWA->StatusSelfIntersection(status))
+      di << "\n Self-intersection found in the edge";
+
+    num = points2d.Length();
+    di << "\n No. of self-intersecting edges : " << num;
+
+    for(int i=1; i<=num; ++i) {
+      gp_Pnt pt = points3d(i);
+      di << "\n Intersecting pt : (" << pt.X() << ", " << pt.Y() << ", " << pt.Z() << ")";
+    }
+
+  }
+
+  di << "\n";
+
+  return 0;
+}
+
+Standard_Integer OCC17480(Draw_Interpretor& di,   Standard_Integer n,   const char ** a)
+{
+  if ( n < 2 ) {
+    cout << "Usage: OCC17480 basic_shape <mode[0:1]>" <<endl;
+    return 0;    
+  }
+
+  TopoDS_Shape brep_pipe =  DBRep::Get(a[1]);
+
+  Standard_Boolean mode = Standard_False;
+  if(n == 3 && atoi(a[2]) == 1)
+    mode = Standard_True;
+
+  Handle_AIS_Shape ais_pipe = new AIS_Shape( brep_pipe );
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  Handle(AIS2D_InteractiveContext) aContext_2d = Viewer2dTest::GetAIS2DContext();
+
+  if(!aContext.IsNull())
+    aContext->Display(ais_pipe);      
+
+  if(!aContext_2d.IsNull())
+    aContext_2d->EraseAll(Standard_True);
+
+  gp_Ax3 ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(0, 1, 0));
+  gp_Pln plane(ax3);
+  gp_Ax2 ax2 = ax3.Ax2();
+
+  HLRAlgo_Projector aProjector = HLRAlgo_Projector(ax2);
+  Handle_AIS2D_ProjShape myDisplayableShape = 
+    new AIS2D_ProjShape(aProjector, 0, mode, Standard_True);
+
+  myDisplayableShape->Add( brep_pipe );
+
+  di << "\n Total number of primitives : " << myDisplayableShape->Length();
+
+  Handle(Graphic2d_Line) mySectProjLines = myDisplayableShape->GetPrimitives();
+  Handle(Graphic2d_Line) mySectProjLinesHLR = myDisplayableShape->GetHLPrimitives();
+
+  Handle_Standard_Type sty = mySectProjLines->DynamicType();
+  Handle_Standard_Type sty1 = mySectProjLinesHLR->DynamicType();
+
+  di << "\n Class Name = " << (char*)sty->Name();
+  di << "\n HLR Class Name = " << (char*)sty1->Name();
+  di << "\n mySectProjLines.IsNull = " << (Standard_Integer) mySectProjLines.IsNull();
+  di << "\n mySectProjLinesHLR.IsNull = " << (Standard_Integer) mySectProjLinesHLR.IsNull();
+
+  Handle(GGraphic2d_SetOfCurves) setCurves;
+  Handle(Graphic2d_SetOfSegments) setSegments;
+
+  if(mySectProjLines->IsKind(STANDARD_TYPE(GGraphic2d_SetOfCurves)))
+  {
+    setCurves = Handle(GGraphic2d_SetOfCurves)::DownCast(mySectProjLines);
+    di << "\n Number of Curves in set = " << setCurves->Length();
+  }
+  if(mySectProjLines->IsKind(STANDARD_TYPE(Graphic2d_SetOfSegments)))    
+  {
+    setSegments = Handle(Graphic2d_SetOfSegments)::DownCast(mySectProjLines);
+    di << "\n Number of Curves in set = " << setSegments->Length();
+  }
+
+  Handle(GGraphic2d_SetOfCurves) setCurvesHLR;
+  Handle(Graphic2d_SetOfSegments) setSegmentsHLR;
+
+  if(mySectProjLinesHLR->IsKind(STANDARD_TYPE(GGraphic2d_SetOfCurves)))
+  {
+    setCurvesHLR = Handle(GGraphic2d_SetOfCurves)::DownCast(mySectProjLinesHLR);
+    di << "\n HLR Number of Curves in set = " << setCurvesHLR->Length();
+  }
+  if(mySectProjLinesHLR->IsKind(STANDARD_TYPE(Graphic2d_SetOfSegments)))
+  {
+    setSegmentsHLR = Handle(Graphic2d_SetOfSegments)::DownCast(mySectProjLinesHLR);
+    di << "\n HLR Number of Curves in set = " << setSegmentsHLR->Length();
+  }
+
+  aContext_2d->Display( myDisplayableShape,Standard_True );
+  return 0;
+}
+
+void QABugs::Commands_17(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("BUC60842", "BUC60842", __FILE__, BUC60842, group);
+  theCommands.Add ("BUC60843", "BUC60843 result_shape name_of_circle name_of_curve [ par1 [ tol ] ]", __FILE__, BUC60843, group);
+  theCommands.Add ("BUC60970", "BUC60970 shape result", __FILE__, BUC60970, group);
+  theCommands.Add ("BUC60818", "BUC60818", __FILE__, BUC60818, group);
+  theCommands.Add ("BUC60915", "BUC60915", __FILE__, BUC60915_1, group);
+  theCommands.Add ("OCC138", "OCC138", __FILE__, OCC138, group);
+  theCommands.Add ("BUC60821","BUC60821",__FILE__,BUC60821,group);
+  theCommands.Add ("OCC353","OCC353",__FILE__,OCC353,group);
+  theCommands.Add ("OCC280","OCC280 hlr=0/1 setsurfecedetail=0/1; set perspecrive view",__FILE__,OCC280,group);
+  theCommands.Add ("OCC232", "OCC232", __FILE__, OCC232 , group);
+  theCommands.Add ("OCC138LC", "OCC138LC", __FILE__, OCC138LC, group);
+  theCommands.Add ("OCC189", "OCC189", __FILE__, OCC189, group);
+  theCommands.Add ("OCC389", "OCC389 name shape1 [shape2] ...", __FILE__, OCC389, group);
+
+  theCommands.Add ("OCC566", "OCC566 shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box", __FILE__, OCC566, group);
+  theCommands.Add ("OCC570", "OCC570 result", __FILE__, OCC570, group);
+
+  theCommands.Add("OCC570mkevol",
+    "OCC570mkevol result object (then use updatevol) [R/Q/P]; mkevol",
+    __FILE__, MKEVOL,group);
+  theCommands.Add("OCC570updatevol",
+    "OCC570updatevol edge u1 rad1 u2 rad2 ...; updatevol",
+    __FILE__, UPDATEVOL,group);
+  theCommands.Add("OCC570updatevollaw",
+    "OCC570updatevollaw edge u1 rad1 u2 rad2 ...; updatevollaw",
+    __FILE__, UPDATEVOL,group);
+  theCommands.Add("OCC570buildevol",
+    "OCC570buildevol; end of the evol fillet computation",
+    __FILE__, BUILDEVOL,group);
+
+  theCommands.Add ("OCC606", "OCC606 result shape [-t]", __FILE__, OCC606, group);
+
+  theCommands.Add ("OCC813", "OCC813 U V", __FILE__, OCC813, group);
+  theCommands.Add ("OCC814", "OCC814", __FILE__, OCC814, group);
+  theCommands.Add ("OCC884", "OCC884 result shape [toler [maxtoler]]", __FILE__, OCC884, group);
+  theCommands.Add ("OCC1188", "OCC1188 imagefile [filltype] : Load image as background", __FILE__, OCC1188, group);
+
+  theCommands.Add ("OCC1174_1", "OCC1174_1 shape", __FILE__, OCC1174_1, group);
+  theCommands.Add ("OCC1174_2", "OCC1174_2 shape", __FILE__, OCC1174_2, group);
+
+  theCommands.Add("OCC672_Length"," OCC672_Length x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 textAngle textPosH textPosV",__FILE__,OCC672_Length,group);
+  theCommands.Add("OCC672_Angle","OCC672_Angle x1 y1 x2 y2 x3 y3 aRadius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV",__FILE__,OCC672_Angle,group);
+  theCommands.Add("OCC672_Diameter","OCC672_Diameter x1 y1 cx cy radius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV",__FILE__,OCC672_Diameter,group);
+  theCommands.Add("OCC672_ShortLength","",__FILE__,OCC672_ShortLength,group);
+
+  theCommands.Add ("OCCN1", "OCCN1 angle fuse(1 for boss / 0 for slot) length", __FILE__, OCCN1, group);
+  theCommands.Add ("OCCN2", "OCCN2", __FILE__, OCCN2, group);
+
+  theCommands.Add ("OCC2569", "OCC2569 nbpoles result", __FILE__, OCC2569, group);
+
+  theCommands.Add ("OCC1642", "OCC1642 FinalWare FinalFace InitWare InitFace shape FixReorder FixDegenerated FixConnected FixSelfIntersection", __FILE__, OCC1642, group);
+
+  theCommands.Add ("OCC17480", "OCC17480 Shape", __FILE__, OCC17480, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_18.cxx b/src/QABugs/QABugs_18.cxx
new file mode 100644 (file)
index 0000000..a64b924
--- /dev/null
@@ -0,0 +1,445 @@
+// Created on: 2002-03-19
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#if defined(WOKC40)
+#define V2D
+#define Viewer2dTest QAViewer2dTest
+#endif
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <ViewerTest_Tool.hxx>
+#include <V3d_Viewer.hxx>
+#include <V3d_View.hxx>
+
+#include <ViewerTest_Tool.hxx>
+#include <V3d_Viewer.hxx>
+#include <V3d_View.hxx>
+#include <PCollection_HExtendedString.hxx>
+
+#include <TDocStd_Application.hxx>
+#include <TDocStd_Document.hxx>
+#include <DDocStd.hxx>
+#include <CDF.hxx>
+
+#include <Resource_Manager.hxx>
+
+#if defined(WOKC40)
+#include <QAViewer2dTest.hxx>
+#else
+#include <Viewer2dTest.hxx>
+#endif
+
+#include <V2d_View.hxx>
+#include <AIS2D_InteractiveObject.hxx>
+#include <Graphic2d_SetOfMarkers.hxx>
+#include <AIS2D.hxx>
+#include <AIS2D_InteractiveContext.hxx>
+#include <V2d_Viewer.hxx>
+
+#include <TopoDS_Wire.hxx>
+#include <BRepTools_WireExplorer.hxx>
+#include <TopoDS_Vertex.hxx>
+#include <TopoDS.hxx>
+#include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <Geom_Curve.hxx>
+#include <GCPnts_UniformAbscissa.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <Standard_Assert.hxx>
+
+#define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
+
+static Quantity_NameOfColor GetColorFromName( const char *name, Standard_Boolean& Found) 
+{ 
+  Quantity_NameOfColor ret = DEFAULT_COLOR;
+  
+  Found = Standard_False;
+  Standard_CString colstring;
+  for(Standard_Integer i=0;i<=514 && !Found;i++)
+    {
+      colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
+      if (!strcasecmp(name,colstring)) {
+       ret = (Quantity_NameOfColor)i;
+       Found = Standard_True;
+       break;
+      }
+    }
+  
+  return ret;
+}
+
+
+static Standard_Integer BUC60851 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("buc60851");
+  ViewerTest_Tool::InitViewerTest (context);
+  Handle(V3d_Viewer)  aV3dViewer= context->CurrentViewer();
+  Handle(V3d_View) aV3d_View = aV3dViewer->ActiveView();
+  for (Standard_Integer i=0;i<1000;++i) {
+    aV3d_View->TriedronDisplay();
+    aV3d_View->TriedronErase();
+  }
+  aV3d_View->TriedronDisplay();
+
+  return 0;
+}
+
+static Standard_Integer OCC216 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  Handle(PCollection_HExtendedString) HExtendedString = new PCollection_HExtendedString("");
+  HExtendedString.Nullify();
+  di << "OCC216: Deleting PCollection_HExtendedString initialized by empty string : OK" <<"\n";
+
+  return 0;
+}
+
+static Standard_Integer OCC267 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 3) {
+    di << "ERROR OCC267: Usage : " << argv[0] << " DOC path" << "\n";
+    return 1;
+  }
+
+  Handle(TDocStd_Document) D;
+  if (!DDocStd::GetDocument(argv[1],D)) return 1;
+  TCollection_ExtendedString path (argv[2]);
+  Handle(TDocStd_Application) A;
+  if (!DDocStd::Find(A)) return 1;
+
+  PCDM_StoreStatus theStatus = A->SaveAs(D,path);
+  if (theStatus == PCDM_SS_OK ) {
+    di << "OCC267 : PCDM_StoreStatus = PCDM_SS_OK" << "\n";
+  } else {
+    di << "OCC267 : PCDM_StoreStatus = Bad_Store_Status" << "\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC181 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 5) {
+    di << "ERROR OCC181: Usage : " << argv[0] << " FileName path1 path2 verbose=0/1" << "\n";
+    return 1;
+  }
+  Standard_CString aFileName = argv[1];
+  Standard_CString aDir1 = argv[2];
+  Standard_CString aDir2 = argv[3];
+  Standard_Integer verboseInt = atoi(argv[4]);
+
+  Standard_Boolean verboseBool = Standard_False;
+  if (verboseInt != 0) {
+   verboseBool = Standard_True;
+  }
+
+  TCollection_AsciiString Env1, Env2, CSF_ = "set env(CSF_";
+  Env1 = CSF_ + aFileName + "UserDefaults) " + aDir1;
+  Env2 = CSF_ + aFileName + "UserDefaults) " + aDir2;
+
+  di.Eval(Env1.ToCString());
+
+  Resource_Manager aManager(aFileName, verboseBool);
+
+  di.Eval(Env2.ToCString());
+
+  Standard_Boolean aStatus = aManager.Save();
+
+  if (aStatus) {
+    di << "\nOCC181 : Status = TRUE" << "\n";
+  } else {
+    di << "\nOCC181 : Status = FALSE" << "\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC402bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  if(aContext.IsNull()) { 
+    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  if ( !(argc == 7 || argc == 8) ) {
+    di << "ERROR : Usage : " << argv[0] << " IndexMarker>0 TypeOfDetection=0/1/2/3/4 X Y Width Height [Angle=0.0]" << "\n";
+    return 1;
+  }
+
+  Standard_Integer IndexMarker = atoi(argv[1]);
+  if (IndexMarker <= 0) { 
+    di << "ERROR : IndexMarker>0" << "\n";
+    return 1;
+  }
+
+  Standard_Integer TypeOfDetectionInteger = atoi(argv[2]);
+  AIS2D_TypeOfDetection TypeOfDetection;
+  switch (TypeOfDetectionInteger) {
+  case 0:
+  case 1:
+  case 2:
+  case 3:
+  case 4:
+    TypeOfDetection = (AIS2D_TypeOfDetection) TypeOfDetectionInteger;
+    break;
+  default:
+    di << "ERROR : TypeOfDetection=0/1/2/3/4" << "\n";
+    return 1;
+  }
+
+  Quantity_Length X = atof(argv[3]);
+  Quantity_Length Y = atof(argv[4]);
+  Quantity_Length Width  = atof(argv[5]);
+  Quantity_Length Height = atof(argv[6]);
+  Quantity_PlaneAngle  PlaneAngle;
+  if ( argc == 7) {
+    PlaneAngle = 0.0;
+  } else {
+    PlaneAngle = atof(argv[7]);
+  }
+
+  Handle(V2d_View) View = Viewer2dTest::CurrentView();
+  //Handle(V2d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
+
+  Handle(AIS2D_InteractiveObject) obj = new AIS2D_InteractiveObject();
+  Handle(Graphic2d_SetOfMarkers) markers = new Graphic2d_SetOfMarkers( obj );
+
+  markers->Add(IndexMarker, X, Y, Width, Height, PlaneAngle);
+
+  aContext->Display( obj, Standard_False );
+  obj->SetHighlightMode( TypeOfDetection );
+  //aContext->SetDetectionMode( TypeOfDetection );
+
+  View->Fitall();
+
+  return 0;
+}
+
+static Standard_Real delta_percent (Standard_Real a, Standard_Real b)
+{
+  Standard_Real result;
+  if (b != 0.) {
+    result = fabs( (a - b) / b ) * 100.;
+  } else if (a != 0.) {
+    result = fabs( (a - b) / a ) * 100.;
+  } else {
+    result = 0.;
+  }
+  return result;
+}
+
+static Standard_Integer OCC367 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 7) {
+    di << "ERROR : Usage : " << argv[0] << " shape step goodX goodY goodZ percent_tolerance" << "\n";
+    return 1;
+  }
+
+  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
+  Standard_Real l = atof(argv[2]);
+  Standard_Real goodX = atof(argv[3]);
+  Standard_Real goodY = atof(argv[4]);
+  Standard_Real goodZ = atof(argv[5]);
+  Standard_Real percent = atof(argv[6]);
+  Standard_Boolean Status = Standard_False;
+
+  // Find the first vertex of the wire
+  BRepTools_WireExplorer wire_exp(myTopoDSWire);
+  TopoDS_Vertex vlast;
+  {
+    TopoDS_Vertex vw1, vw2;
+    TopExp::Vertices(myTopoDSWire,vw1,vw2);
+    TopoDS_Vertex ve1, ve2;
+    TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
+    TopExp::Vertices(edge,ve1,ve2);
+    if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
+      vlast = vw1;
+    else {
+      Standard_ASSERT_RAISE(vw2.IsSame(ve1) || vw2.IsSame(ve2), "Disconnected vertices");
+      vlast = vw2;
+    }
+  }
+  Standard_Integer EdgeIndex = 0;
+  Standard_Real FirstEdgeX, FirstEdgeY, FirstEdgeZ, deltaX, deltaY, deltaZ;
+  FirstEdgeX = FirstEdgeY = FirstEdgeZ = deltaX = deltaY = deltaZ = 0.;
+  for ( ; wire_exp.More(); wire_exp.Next())
+    {
+      EdgeIndex++;
+      di << "\n\n New Edge \n"   << "\n";
+      Standard_Real newufirst, newulast;
+      TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
+      Standard_Real ufirst, ulast;
+      Handle(Geom_Curve) acurve;
+      TopoDS_Vertex ve1, ve2;
+      TopExp::Vertices(edge,ve1,ve2);
+      if (ve1.IsSame(vlast))
+       {
+          acurve = BRep_Tool::Curve(edge, ufirst, ulast);
+          newufirst = ufirst;
+          newulast  = ulast;
+          vlast = ve2;
+       }
+      else
+       {
+          Standard_ASSERT_RAISE(ve2.IsSame(vlast), "Not the same vertex");
+          Standard_ASSERT_RAISE(wire_exp.Orientation() == TopAbs_REVERSED, "Wire should be REVERSED");
+          acurve = BRep_Tool::Curve( edge, ufirst, ulast );
+          newufirst = acurve->ReversedParameter( ufirst );
+          newulast  = acurve->ReversedParameter( ulast );
+          acurve = acurve->Reversed( );
+          vlast = ve1;
+       }
+      
+      GeomAdaptor_Curve   curve;
+      GCPnts_UniformAbscissa  algo;
+      curve.Load(acurve);
+      algo.Initialize( curve, l, newufirst, newulast );
+      if (!algo.IsDone())
+        di << "Not Done!!!"   << "\n";
+      Standard_Integer maxIndex =algo.NbPoints();
+      for (Standard_Integer Index = 1; Index<=maxIndex;Index++) {
+        Standard_Real t = algo.Parameter(Index);
+        gp_Pnt      pt3 = curve.Value(t);
+        di << "Parameter t = " << t   << "\n";
+        di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z()  << "\n";
+       if (EdgeIndex == 1 && Index == maxIndex) {
+         FirstEdgeX = pt3.X();
+         FirstEdgeY = pt3.Y();
+         FirstEdgeZ = pt3.Z();
+         deltaX = delta_percent(FirstEdgeX, goodX);
+         deltaY = delta_percent(FirstEdgeY, goodY);
+         deltaZ = delta_percent(FirstEdgeZ, goodZ);
+         if (deltaX <= percent && deltaY <= percent && deltaZ <= percent) {
+           Status = Standard_True;
+         }
+       }
+      }
+    }
+  di << "\n\nFirstEdge = " << FirstEdgeX <<" " << FirstEdgeY <<" " << FirstEdgeZ << "\n";
+  di << "deltaX = " << deltaX << " deltaY = " << deltaY << " deltaZ = " << deltaZ << "\n";
+  if (Status) {
+    di << argv[0] << " : OK" << "\n";
+  } else {
+    di << argv[0] << " : ERROR" << "\n";
+  }
+
+  return 0;
+}
+
+static Standard_Integer OCC71bug (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+
+  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
+  V3dView->EnableGLLight( Standard_False );  
+  V3dView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.07);
+  aContext->UpdateCurrentViewer();
+  return 0;
+}
+
+static Standard_Integer OCC403bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  if(aContext.IsNull()) { 
+    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " ColorName1 ColorName2" << "\n";
+    return 1;
+  }
+
+  Standard_Boolean Found;
+  Quantity_NameOfColor NameOfColor1 = GetColorFromName(argv[1] ,Found);
+  if ( !Found ) {
+    di << "ERROR: " << argv[1] << " - color not found" << "\n";
+    return 1;
+  }
+  Quantity_NameOfColor NameOfColor2 = GetColorFromName(argv[2] ,Found);
+  if ( !Found ) {
+    di << "ERROR: " << argv[2] << " - color not found" << "\n";
+    return 1;
+  }
+
+  Quantity_Color Color1(NameOfColor1);
+  Quantity_Color Color2(NameOfColor2);
+
+  Handle(V2d_View) View = Viewer2dTest::CurrentView();
+  Handle(V2d_Viewer) Viewer = View->Viewer();
+  Viewer->SetGridColor(Color1, Color2);
+
+  return 0;
+}
+
+static Standard_Integer OCC404bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
+  if(aContext.IsNull()) { 
+    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  if ( argc != 4) {
+    di << "ERROR : Usage : " << argv[0] << " R G B" << "\n";
+    return 1;
+  }
+
+  Quantity_Parameter R1 = (Quantity_Parameter) atof(argv[1]);
+  Quantity_Parameter R2 = (Quantity_Parameter) atof(argv[2]);
+  Quantity_Parameter R3 = (Quantity_Parameter) atof(argv[3]);
+
+  Quantity_Color Color;
+  Color.SetValues(R1, R2, R3, Quantity_TOC_RGB);
+
+  Handle(V2d_View) View = Viewer2dTest::CurrentView();
+  View->SetBackground(Color);
+  View->Update();
+
+  return 0;
+}
+
+void QABugs::Commands_18(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add("BUC60851", "BUC60851", __FILE__, BUC60851, group);
+  theCommands.Add("OCC216", "OCC216", __FILE__, OCC216, group);
+  theCommands.Add("OCC267", "OCC267 DOC path", __FILE__, OCC267, group);
+  theCommands.Add("OCC181", "OCC181 FileName path1 path2 verbose=0/1", __FILE__, OCC181, group);
+  theCommands.Add("OCC402", "OCC402 TypeOfDetection=0/1/2/3/4 X Y Width Height [Angle=0.0]", __FILE__, OCC402bug, group);
+  theCommands.Add("OCC367", "OCC367 shape step goodX goodY goodZ percent_tolerance", __FILE__, OCC367, group);
+  theCommands.Add("OCC71", "OCC71", __FILE__, OCC71bug, group);
+  theCommands.Add("OCC403", "OCC403 ColorName1 ColorName2", __FILE__, OCC403bug, group);
+  theCommands.Add("OCC404", "OCC404 R G B; Set Background Color", __FILE__, OCC404bug, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_19.cxx b/src/QABugs/QABugs_19.cxx
new file mode 100644 (file)
index 0000000..cdb55f4
--- /dev/null
@@ -0,0 +1,80 @@
+// Created on: 2002-05-21
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <gp_Pnt2d.hxx>
+#include <GCE2d_MakeSegment.hxx>
+#include <Geom2d_TrimmedCurve.hxx>
+#include <DrawTrSurf.hxx>
+
+#include <PCollection_HAsciiString.hxx>
+
+//static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
+static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 4) {
+    di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
+    return 1;
+  }
+
+  gp_Pnt2d P1, P2;
+  if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
+    di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
+    return 1;
+  }
+  if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
+    di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
+    return 1;
+  }
+
+  GCE2d_MakeSegment MakeSegment(P1,P2);
+  Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
+  DrawTrSurf::Set(argv[1], TrimmedCurve);
+  return 0;
+}
+
+static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
+{
+  for(Standard_Integer i= 0;i <= 20;i++){
+    Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
+    pstr->Clear();
+  }
+  di << "OCC142: OK" << "\n";
+  return 0;
+}
+
+void QABugs::Commands_19(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
+  theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_2.cxx b/src/QABugs/QABugs_2.cxx
new file mode 100644 (file)
index 0000000..e467df7
--- /dev/null
@@ -0,0 +1,209 @@
+// Created on: 2002-07-18
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Vertex.hxx>
+
+#include <TopExp_Explorer.hxx>
+#include <TopoDS_Face.hxx>
+#include <TopoDS.hxx>
+#include <BRepBndLib.hxx>
+#include <gp_Pln.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAlgoAPI_Section.hxx>
+#include <BRepAlgo_Section.hxx>
+#include <Precision.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#include <stdio.h>
+
+//=======================================================================
+//function : OCC527 
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC527(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  try
+  {
+    OCC_CATCH_SIGNALS
+    // 1. Verify amount of arguments of the command
+    //if (argc < 2) { di << "OCC527 FAULTY. Use : OCC527 shape "; return 0;} 
+    if (argc < 2 || argc > 3) {
+      di << "Usage : " << argv[0] << " shape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+      return 1;
+    }
+    Standard_Boolean IsBRepAlgoAPI = Standard_True;
+    if (argc == 3) {
+      Standard_Integer IsB = atoi(argv[2]);
+      if (IsB != 1) {
+       IsBRepAlgoAPI = Standard_False;
+//#if ! defined(BRepAlgo_def04)
+//     di << "Error: There is not BRepAlgo_Section class" << "\n";
+//     return 1;
+//#endif
+      }
+    }
+    
+    // 2. Get selected shape
+    TopoDS_Shape aShape = DBRep::Get(argv[1]);
+    if(aShape.IsNull()) { di << "OCC527 FAULTY. Entry shape is NULL"; return 0;} 
+
+    // 3. Explode entry shape on faces and build sections from Zmin to Zmax with step aStep
+    const Standard_Real Zmin = -40.228173882121, Zmax = 96.408126285268, aStep = 1.0;
+    char str[100]; str[0] = 0; sprintf(str,"Test range: [%f, %f] with step %f\n",Zmin,Zmax,aStep); di << str;
+    int nbf = 0;
+    TopExp_Explorer aExp1;
+    for (aExp1.Init(aShape,TopAbs_FACE); aExp1.More(); aExp1.Next())
+    {
+      // Process one face
+      str[0] = 0; sprintf(str,"Face #%d: \t",nbf++); di << str;
+      TopoDS_Face aFace = TopoDS::Face(aExp1.Current());
+      
+      // Build BndBox in order to avoid try of building section 
+      // if plane of the one does not intersect BndBox of the face
+      Bnd_Box aFaceBox;
+      BRepBndLib::Add(aFace,aFaceBox);
+      Standard_Real X1,X2,Y1,Y2,Z1,Z2;
+      aFaceBox.Get(X1,Y1,Z1,X2,Y2,Z2);
+
+      // Build sections from Zmin to Zmax with step aStep
+      Standard_Boolean wasBuilt = Standard_False;
+      double gmaxdist = 0.0, gzmax = Zmax;
+      for (double zcur = Zmax; zcur > Zmin; zcur -= aStep)
+      {
+        // If plane of the section does not intersect BndBox of the face do nothing
+        if(zcur < Z1 || zcur > Z2 ) continue;
+                
+        // Build current section
+        gp_Pln pl(0,0,1,-zcur);
+//#if ! defined(BRepAlgoAPI_def01)
+//        BRepAlgoAPI_Section aSection(aFace,pl,Standard_False);
+//#else
+//        BRepAlgo_Section aSection(aFace,pl,Standard_False);
+//#endif
+//        aSection.Approximation(Standard_True);
+//        aSection.Build();
+//        // If section was built meassure distance between vertexes and plane of the one. Max distance is stored.
+//        if (aSection.IsDone())
+       
+       Standard_Boolean IsDone;
+       TopoDS_Shape aResult;
+       if (IsBRepAlgoAPI) {
+         di << "BRepAlgoAPI_Section aSection(aFace,pl,Standard_False)" <<"\n";
+         BRepAlgoAPI_Section aSection(aFace,pl,Standard_False);
+         aSection.Approximation(Standard_True);
+         aSection.Build();
+         IsDone = aSection.IsDone();
+         aResult = aSection.Shape();
+       } else {
+         di << "BRepAlgo_Section aSection(aFace,pl,Standard_False)" <<"\n";
+         BRepAlgo_Section aSection(aFace,pl,Standard_False);
+         aSection.Approximation(Standard_True);
+         aSection.Build();
+         IsDone = aSection.IsDone();
+         aResult = aSection.Shape();
+       }
+
+        if (IsDone)
+         {
+//         TopoDS_Shape aResult = aSection.Shape();
+           if (!aResult.IsNull())
+             {
+            double lmaxdist = 0.0;
+            double lmaxtoler = 0.0;
+            TopExp_Explorer aExp2;
+            for (aExp2.Init(aResult,TopAbs_VERTEX); aExp2.More(); aExp2.Next())
+            {
+              TopoDS_Vertex aV = TopoDS::Vertex(aExp2.Current());
+              Standard_Real  toler = BRep_Tool::Tolerance(aV);
+              double dist = pl.Distance(BRep_Tool::Pnt(aV));
+              if (dist > lmaxdist) lmaxdist = dist;
+              wasBuilt = Standard_True;
+      // If section was built check distance beetwen vertexes and plane of the one
+      str[0] =0;
+//       if (wasBuilt) 
+//       {
+//         if(gmaxdist > Precision::Confusion())
+//           sprintf(str,"Dist=%f, Param=%f FAULTY\n",gmaxdist,gzmax);
+//         else
+//           sprintf(str,"Dist=%f, Param=%f\n",gmaxdist,gzmax);
+        if(dist > toler)
+          sprintf(str,"Dist=%f, Toler=%f, Param=%f FAULTY\n",dist,toler,gzmax);
+        else
+          sprintf(str,"Dist=%f, Toler=%f, Param=%f\n",dist,toler,gzmax);
+//       }
+//       else sprintf(str,"No result\n");
+      di << str;
+            }
+            if (lmaxdist > gmaxdist)
+            {
+              gmaxdist = lmaxdist;
+              gzmax = zcur;
+            }
+          }
+        }
+      }
+    }
+  }
+  catch (Standard_Failure) {di << "OCC527 Exception \n" ;return 0;}
+  
+  return 0;
+}
+
+#include <StlMesh_Mesh.hxx>
+#include <StlTransfer.hxx>
+//=======================================================================
+//function : OCC1048
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC1048 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  // Verify amount of arguments of the command
+  if (argc < 2) { di << "Usage : " << argv[0] <<" shape"; return 1;}
+
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+
+  Standard_Real theDeflection = 0.006;
+  Handle(StlMesh_Mesh) theStlMesh = new StlMesh_Mesh;
+  StlTransfer::BuildIncrementalMesh(aShape, theDeflection, Standard_False, theStlMesh);
+
+  Standard_Integer NBTRIANGLES = theStlMesh->NbTriangles();
+  di<<"Info: Number of triangles = "<<NBTRIANGLES<<"\n";
+
+  return 0;
+}
+
+void QABugs::Commands_2(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  //theCommands.Add("OCC527", "OCC527 shape", __FILE__, OCC527, group);  
+  theCommands.Add("OCC527", "OCC527 shape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC527, group);  
+  theCommands.Add("OCC1048", "OCC1048 shape", __FILE__, OCC1048, group);  
+  return;
+}
diff --git a/src/QABugs/QABugs_3.cxx b/src/QABugs/QABugs_3.cxx
new file mode 100644 (file)
index 0000000..060903f
--- /dev/null
@@ -0,0 +1,2328 @@
+// Created on: 2002-06-17
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+#include <QABugs.hxx>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include<Draw_Interpretor.hxx>
+#include<TopLoc_Location.hxx>
+#include<TopoDS_Face.hxx>
+#include<TopoDS.hxx>
+#include<DBRep.hxx>
+#include<Geom_Surface.hxx>
+#include<BRep_Tool.hxx>
+#include<GeomInt_IntSS.hxx>
+#include<BRepBuilderAPI_MakeEdge.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include<tcl.h>
+
+static int BUC60623(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
+{
+  if(argc!=4)
+  {
+    di << "Usage : " << a[0] << " result Shape1 Shape2" << "\n";
+    return -1;
+  }
+
+  TopLoc_Location L1;
+  TopLoc_Location L2;
+  TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[2],TopAbs_FACE));
+  TopoDS_Face F2 = TopoDS::Face(DBRep::Get(a[3],TopAbs_FACE));
+  Handle(Geom_Surface) GSF1 = BRep_Tool::Surface(F1, L1);
+  Handle(Geom_Surface) GSF2 = BRep_Tool::Surface(F2, L2);
+  GeomInt_IntSS Inter;
+  Inter.Perform(GSF1,GSF2, BRep_Tool::Tolerance(F1));
+  if (!Inter.IsDone()) {
+    di << "Intersection not done" << "\n";
+    return 1;
+  }
+  Standard_Integer nbsol = Inter.NbLines();
+  if(!nbsol) {
+    di << "The number of solutions is zero!"   << "\n";
+    return 0;
+  }
+  Handle(Geom_Curve) Sol = Inter.Line(1);
+  if(!Sol.IsNull()) {
+    DBRep::Set(a[1], BRepBuilderAPI_MakeEdge(Sol));
+      return 0;
+    } else di << "The first solution is Null!"   << "\n";
+
+  di << "fini" << "\n";
+  return 0;
+}
+
+#include<ViewerTest.hxx>
+#include<AIS_InteractiveContext.hxx>
+#include<AIS_Shape.hxx>
+  
+static int BUC60569(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=2)
+  {
+    di << "Usage : " << argv[0] << " shape" << "\n";
+    return -1;
+  }
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  TopoDS_Shape theShape =  DBRep::Get(argv[1]);
+
+  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
+  myAISContext->Display( anAISShape, Standard_True );
+  myAISContext->OpenLocalContext(); 
+  myAISContext->ActivateStandardMode(TopAbs_FACE);
+  return 0;
+}
+
+static int BUC60614(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=2)
+  {
+    di << "Usage : "<< argv[0] << " shape" << "\n";
+    return -1;
+  }
+
+  //  di.Eval("vinit");
+
+  TopoDS_Shape theShape =  DBRep::Get(argv[1]);
+
+//  ViewerTest::GetAISContext(); 
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;    
+  }
+  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
+  myAISContext->Display( anAISShape, Standard_True );
+  myAISContext->OpenLocalContext(); 
+  myAISContext->ActivateStandardMode(TopAbs_COMPOUND);
+//  myAISContext->ActivateStandardMode(TopAbs_SOLID);
+//  di.Eval("vfit");
+//  cout << "vfini" << endl;
+  return 0;
+}
+
+#include<BRep_Builder.hxx>
+#include<BRepTools_ShapeSet.hxx>
+#include<BRepTools.hxx>
+#include<BRepAdaptor_HSurface.hxx>
+#include<TopOpeBRep_PointClassifier.hxx>
+#include<Precision.hxx>
+#ifdef WNT
+#include<stdio.h>
+#endif
+
+static int BUC60609(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+//  char file1[100];
+  gp_Pnt2d uvSurf;
+  double U,V;
+  TopAbs_State state;
+  
+  if(argc < 2){
+    printf("Usage: %s  draw_format_face\n [name] [interactive (0|1)]",argv[0]);
+    return(-1);
+  }
+  
+  // MKV 30.03.05
+#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
+  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#else
+  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#endif
+  
+  Standard_Character  *file1 = new Standard_Character [strlen(DD)+strlen(argv[1])+2];
+  sprintf(file1,"%s/%s",DD,argv[1]);
+  
+  filebuf fic;
+  istream in(&fic);
+  if (!fic.open(file1,ios::in)) {
+    di << "Cannot open file for reading : " << file1 << "\n";
+    delete file1;
+    return(-1);
+  }
+
+  TopoDS_Shape theShape;
+  char typ[255];
+  in >> typ;
+  if (!in.fail()) {
+    if( !strcmp(typ, "DBRep_DrawableShape") ){
+      BRep_Builder B;
+      BRepTools_ShapeSet S(B);
+      S.Read(in);
+      S.Read(theShape,in);
+    }else{
+      di << "Wrong entity type in " << file1 << "\n";
+      delete file1;
+      return(-1);
+    }
+  }
+
+  const TopoDS_Face &face = TopoDS::Face (theShape);
+
+  if(argc > 2){
+    DBRep::Set(argv[2],face);
+  }
+
+  Standard_Boolean inter=Standard_False ;
+  
+  if(argc > 3){
+    inter= (atof(argv[3]) == 0) ? Standard_False : Standard_True ;
+  }
+
+  Standard_Real faceUMin,faceUMax,faceVMin,faceVMax;
+  
+  BRepTools::UVBounds (face, faceUMin,faceUMax,faceVMin,faceVMax);
+
+  di << "The bounds of the trimmed face:" << "\n";
+  di << faceUMin << " <= U <= " << faceUMax << "\n";
+  di << faceVMin << " <= V <= " << faceVMax << "\n";
+  
+  Handle(BRepAdaptor_HSurface) hsurfa = new BRepAdaptor_HSurface(face);
+  
+  TopOpeBRep_PointClassifier PClass;
+
+  di << "Now test the point classifier by inputting U,V values" << "\n";
+  di << "inside or outside the bounds displayed above" << "\n";
+  di << "Type stop to exit" << "\n";
+  
+  // Please register this:
+  // ***********************************************
+  // Note also that for periodic surfaces such as nimpod_1.topo,
+  // the U/V values may be +- 2pi compared to the actual face bounds
+  // (because U,V is probably coming from a Geom package routine).
+  // Hence IT WOULD BE USEFUL IF TopOpeBRep_PointClassifier COULD
+  // COPE WITH PERIODIC SURFACES, i.e. U,V +-Period giving same result.
+  // *************************************************
+  if(inter && (argc != 6)) {
+//    while(cin){
+      di << "Input U:   " << "\n";
+//      cin >> U;
+//      if(!cin) {
+       delete file1;
+       return(0);
+//      }
+      di << "Input V:   " << "\n";
+//      cin >> V;
+//      if(!cin) {
+       delete file1;
+       return(0);
+//      }
+      
+      uvSurf = gp_Pnt2d(U, V);
+      
+      //gp_Pnt2d uvSurf(0.14,5.1);  // outside!!!
+      //gp_Pnt2d uvSurf2(1.28,5.1); // inside
+    
+      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
+      if(state == TopAbs_IN || state == TopAbs_ON){
+       di << "U=" << U << " V=" << V << "  classified INSIDE" << "\n";
+      }else{
+       di << "U=" << U << " V=" << V << "  classified OUTSIDE" << "\n";
+      }
+//    }
+  } else {
+    if(argc != 6) {
+      uvSurf = gp_Pnt2d(0.14,5.1);
+      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
+      if(state == TopAbs_IN || state == TopAbs_ON){
+       di << "U=" << 0.14 << " V=" << 5.1 << "  classified INSIDE" << "\n";
+      }else{
+       di << "U=" << 0.14 << " V=" << 5.1 << "  classified OUTSIDE" << "\n";
+      }
+
+      uvSurf = gp_Pnt2d(1.28,5.1);
+      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
+      if(state == TopAbs_IN || state == TopAbs_ON){
+       di << "U=" << 1.28 << " V=" << 5.1 << "  classified INSIDE" << "\n";
+      }else{
+       di << "U=" << 1.28 << " V=" << 5.1 << "  classified OUTSIDE" << "\n";
+      }
+    } else {
+      uvSurf = gp_Pnt2d(atof(argv[4]),atof(argv[5]));
+      state = PClass.Classify(face,uvSurf,Precision::PConfusion());
+      if(state == TopAbs_IN || state == TopAbs_ON){
+       di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << "  classified INSIDE" << "\n";
+      }else{
+       di << "U=" << atof(argv[4]) << " V=" << atof(argv[5]) << "  classified OUTSIDE" << "\n";
+      }
+    }
+  }
+  return 0;
+}
+
+#if ! defined(WNT)
+void stringerror(int state)
+{
+ printf("%s",((state&ios::eofbit) !=0)? " [eof]": "");
+ printf("%s",((state&ios::failbit)!=0)? " [fail]":"");
+ printf("%s",((state&ios::badbit) !=0)? " [bad]": "");
+ printf("%s\n",(state==ios::goodbit)? " [ok]": "");
+}
+
+
+//#if defined(LIN)
+//#include <strstream>
+//#else
+//#include <strstream.h>
+//#endif
+#ifdef HAVE_IOSTREAM
+#include <iostream>
+#include <sstream>
+using namespace std;
+#elif defined (HAVE_IOSTREAM_H)
+#include <iostream.h>
+#include <strstream.h>
+#else
+#error "check config.h file or compilation options: either HAVE_IOSTREAM or HAVE_IOSTREAM_H should be defined"
+#endif
+static int UKI61075(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/) {
+ double da,db;
+ char buffer1[128];
+#ifndef USE_STL_STREAM
+ ostrstream stringout1(buffer1,sizeof(buffer1));
+ istrstream stringin1(buffer1,sizeof(buffer1));
+#else
+ ostringstream stringout1(buffer1);
+ istringstream stringin1(buffer1); 
+#endif
+ char buffer2[128];
+#ifndef USE_STL_STREAM
+ ostrstream stringout2(buffer2,sizeof(buffer2));
+ istrstream stringin2(buffer2,sizeof(buffer2));
+#else
+ ostringstream stringout2(buffer1);
+ istringstream stringin2(buffer1); 
+#endif
+
+ stringout1.precision(17);
+ stringout2.precision(17);
+
+ da=-(DBL_MAX);
+ db=DBL_MAX;
+ printf("Valeurs originales :\n\t%.17lg %.17lg\n",da,db);
+
+ stringout1<<da<<' '<<db<<"\n";
+#ifndef USE_STL_STREAM
+ buffer1[stringout1.pcount()]='\0';
+#else
+ buffer1[stringout1.str().length()]= '\0' ;
+#endif
+
+ printf("Valeurs ecrites dans le fichier :\n\t%s",buffer1);
+
+ da=db=0.;
+ stringin1>>da>>db;
+ printf("Valeurs relues :\n\t%.17lg %.17lg",da,db);
+ stringerror(stringin1.rdstate());
+
+ stringout2<<da<<' '<<db<<"\n";
+#ifndef USE_STL_STREAM
+ buffer2[stringout2.pcount()]='\0';
+#else
+ buffer2[stringout2.str().length()]='\0';
+#endif
+
+ printf("Valeurs reecrites :\n\t%s",buffer2);
+
+ da=db=0.;
+ stringin2>>da>>db;
+ printf("Valeurs relues a nouveau :\n\t%.17lg %.17lg",da,db);
+ stringerror(stringin2.rdstate());
+ return(0);
+}
+#endif
+
+#include<BRepAlgoAPI_Section.hxx>
+#include<BRepAlgo_Section.hxx>
+
+#include<Geom_Plane.hxx>
+#include<DrawTrSurf.hxx>
+
+//static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane]";
+static Standard_CString St = " \"trimsphere\"/\"sphere\" [result] [name] [plane] [BRepAlgoAPI/BRepAlgo = 1/0]";
+
+static int BUC60585(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  
+  //if(argc<2) {
+  //  cerr << "Usage : " << argv[0] << St << endl;
+  //  return -1;
+  //}
+  if(argc < 2 || argc > 6) {
+    di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 6) {
+    Standard_Integer IsB = atoi(argv[5]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def04)
+//      di << "Error: There is not BRepAlgo_Section class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  
+  gp_Dir N;
+  if(!strcmp(argv[1],"trimsphere")) {
+//////////////////////////////////////////
+// Uncomment for trimmed sphere bug:
+//    filename = "trimsphere.topo";
+    N=gp_Dir( 0.0, -1.0, 0.0 );
+//////////////////////////////////////////
+  } else if(!strcmp(argv[1],"sphere")) {
+
+//////////////////////////////////////////
+// Uncomment for untrimmed sphere bug:
+
+//    filename="sphere.topo";
+    N=gp_Dir( 0.0, -0.75103523489975432, -0.66026212668838646 );
+    
+//////////////////////////////////////////
+  } else {
+    di << "Usage : " << argv[0] << St << "\n";
+    return -1;
+  }
+  
+  // MKV 30.03.05
+#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
+  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#else
+  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#endif
+
+  Standard_Character  *filename = new Standard_Character [strlen(DD)+17];
+  sprintf(filename,"%s/%s.topo",DD,argv[1]);
+
+  filebuf fic;
+  istream in(&fic);
+  if (!fic.open(filename,ios::in)) {
+    di << "Cannot open file for reading : " << filename << "\n";
+    delete filename;
+    return -1;
+  }
+  
+  // Read in the shape
+  
+  BRep_Builder B;
+  BRepTools_ShapeSet S(B);
+  S.Read(in);
+  TopoDS_Shape theShape;
+  S.Read(theShape,in);
+  
+  // Create the plane
+  
+  gp_Pnt O( 2036.25, -97.5, -1460.499755859375 );
+  gp_Dir A( 1.0,  0.0, 0.0 );
+  
+  gp_Ax3 PLA( O, N, A );
+  gp_Pln Pl(PLA);
+  
+  // Perform the section
+  
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
+//#else
+//  BRepAlgo_Section Sec( theShape, Pl, Standard_False);
+//#endif
+
+  TopoDS_Shape res;
+  
+  try{
+    OCC_CATCH_SIGNALS
+//      Sec.Approximation(Standard_True);
+
+    //Sec.Build();
+    //if(!Sec.IsDone()){
+    //  cout << "Error performing intersection: not done." << endl;
+    //  delete filename;
+    //  return -1;
+    //}
+    //res = Sec.Shape();
+
+    if (IsBRepAlgoAPI) {
+      di << "BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False)" <<"\n";
+      BRepAlgoAPI_Section Sec( theShape, Pl, Standard_False);
+      Sec.Build();
+      if(!Sec.IsDone()){
+       di << "Error performing intersection: not done." << "\n";
+       delete filename;
+       return -1;
+      }
+      res = Sec.Shape();
+    } else {
+      di << "BRepAlgo_Section Sec( theShape, Pl, Standard_False)" <<"\n";
+      BRepAlgo_Section Sec( theShape, Pl, Standard_False);
+      Sec.Build();
+      if(!Sec.IsDone()){
+       di << "Error performing intersection: not done." << "\n";
+       delete filename;
+       return -1;
+      }
+      res = Sec.Shape();
+    }
+    
+  }catch(Standard_Failure){
+    Handle(Standard_Failure) error = Standard_Failure::Caught();
+    di << "Error performing intersection: not done." << "\n";
+    delete filename;
+    return -1;
+  }
+  
+  if(argc>3) DBRep::Set(argv[3],theShape);
+
+  if(argc>2) DBRep::Set(argv[2],res);
+
+  if(argc>4) {
+    Handle(Geom_Geometry) result;
+    Handle(Geom_Plane) C = new Geom_Plane(Pl);
+    result=C;
+    DrawTrSurf::Set(argv[4],result);
+  }
+  
+  di << "Done" << "\n";
+
+  delete filename;
+  
+  return 0;
+}
+
+#include<TopoDS_Compound.hxx>
+
+static int BUC60547(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " name"   << "\n";
+    return -1;
+  }
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  
+  // MKV 30.03.05
+#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
+  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#else
+  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+#endif
+
+  Standard_Character *Ch = new Standard_Character[strlen(argv[1])+3];
+
+  Standard_Character *FileName = new Standard_Character[strlen(DD)+13];
+  TopoDS_Shape free_1,free_2,free_3,free_4;
+  BRep_Builder B;
+  sprintf(FileName,"%s/%s",DD,"buc60547a.brep");
+  BRepTools::Read(free_1,FileName,B);
+  sprintf(FileName,"%s/%s",DD,"buc60547b.brep");
+  BRepTools::Read(free_2,FileName,B);
+  sprintf(FileName,"%s/%s",DD,"buc60547c.brep");
+  BRepTools::Read(free_3,FileName,B);
+  sprintf(FileName,"%s/%s",DD,"buc60547d.brep");
+  BRepTools::Read(free_4,FileName,B);
+  sprintf(Ch,"%s_%i",argv[1],1);
+  DBRep::Set(Ch,free_1);
+  di << Ch << " ";
+  sprintf(Ch,"%s_%i",argv[1],2);
+  DBRep::Set(Ch,free_2);
+  di << Ch << " ";
+  sprintf(Ch,"%s_%i",argv[1],3);
+  DBRep::Set(Ch,free_3);
+  di << Ch << " ";
+  sprintf(Ch,"%s_%i",argv[1],4);
+  DBRep::Set(Ch,free_4);
+  di << Ch << " ";
+  
+//  Handle(AIS_Shape) S1 = new AIS_Shape(free_1); 
+//  Handle(AIS_Shape) S2 = new AIS_Shape(free_2); 
+//  Handle(AIS_Shape) S3 = new AIS_Shape(free_3); 
+//  Handle(AIS_Shape) S4 = new AIS_Shape(free_4);
+  
+//  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+
+//  myAISContext->Display(S1); 
+//  myAISContext->Display(S2); 
+//  myAISContext->Display(S3); 
+//  myAISContext->Display(S4);
+
+//  di.Eval("vfit");
+  
+  TopoDS_Compound Com; 
+  BRep_Builder bui;
+  bui.MakeCompound(Com); 
+  bui.Add(Com,free_1); 
+  bui.Add(Com,free_2); 
+  bui.Add(Com,free_3); 
+  bui.Add(Com,free_4); 
+
+  sprintf(Ch,"%s_%c",argv[1],'c');
+  DBRep::Set(Ch,Com);
+  di << Ch << " ";
+
+  Handle(AIS_Shape) SC = new AIS_Shape(Com);
+  myAISContext->Display(SC); // nothing on the screen If I save the compound :
+
+  sprintf(FileName,"%s/%s",DD,"free.brep");
+
+  BRepTools::Write(Com,FileName); 
+
+  delete Ch;
+  delete FileName;
+  
+  return 0;
+}
+
+#include<BRepBuilderAPI_MakeVertex.hxx>
+#include<TCollection_ExtendedString.hxx>
+#include<AIS_LengthDimension.hxx>
+
+static Standard_Integer BUC60632(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
+{
+  
+  Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
+  if(myAIScontext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+  myAIScontext->EraseAll();
+  
+  TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0,0,0)); 
+  TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10,10,0)); 
+  
+  Handle(AIS_Shape) Ve1 = new AIS_Shape(V1);
+  Handle(AIS_Shape) Ve2 = new AIS_Shape(V2);
+  
+  myAIScontext->Display(Ve1); 
+  myAIScontext->Display(Ve2); 
+  
+  Handle(Geom_Plane) Plane1 = new Geom_Plane(gp_Pnt(0,0,0),gp_Dir(0,0,1)); 
+  TCollection_ExtendedString Ext1("Dim1"); 
+  Handle(AIS_LengthDimension) Dim1 = new AIS_LengthDimension(V1,V2,Plane1,atof(a[2]),Ext1); 
+  
+  myAIScontext->SetDisplayMode(Dim1, atof(a[1]));
+  myAIScontext->Display(Dim1);
+  return 0;
+}
+
+#include<TopoDS_Wire.hxx>
+
+static Standard_Integer BUC60652(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
+{
+  if(argc!=2) {
+    di << "Usage : BUC60652 fase"   << "\n";
+    return 1;
+  }
+  TopoDS_Shape shape = DBRep::Get( argv[1] ); 
+  TopoDS_Face face = TopoDS::Face( shape ); 
+  TopoDS_Wire ow = BRepTools::OuterWire( face ); 
+  DBRep::Set( "w", ow ); 
+  return 0; 
+}
+
+#include <BRepAlgo_BooleanOperations.hxx>
+  
+static Standard_Integer defNbPntMax = 30;
+static Standard_Real defTol3d = 1.e-7;
+static Standard_Real defTol2d = 1.e-7;
+static Standard_Boolean defRelativeTol=Standard_True;
+Standard_Integer NbPntMax = defNbPntMax;
+Standard_Real Toler3d =defTol3d;
+Standard_Real Toler2d = defTol2d;
+Standard_Boolean RelativeTol= defRelativeTol;
+//              //== // ksection : operateur section appelant BRepAlgo_BooleanOperation
+//== // ksection : operateur section appelant BRepAlgo_BooleanOperations
+//=======================================================================
+Standard_Integer ksection(Draw_Interpretor& di, Standard_Integer n, const char ** a) {
+  if (n < 8) {
+    di << "Usage : " << a[0] << " resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol"   << "\n";
+    return -1;
+  }
+  // a[1]= resultat
+  // a[2]= shell1
+  // a[3]= shell2
+  // a[4]= NbPntMax
+  // a[5]= Toler3d
+  // a[6]= Toler2d
+  // a[7]= RelativeTol
+  TopoDS_Shape s1 = DBRep::Get(a[2],TopAbs_SHELL);
+  TopoDS_Shape s2 = DBRep::Get(a[3],TopAbs_SHELL);
+  if (s1.IsNull() || s2.IsNull()) return 1;
+  NbPntMax=atoi(a[4]);
+  Toler3d=atof(a[5]);
+  Toler2d=atof(a[6]);
+  RelativeTol=atoi(a[7]);
+
+  di << "BRepAlgo_BooleanOperations myalgo" << "\n";
+  BRepAlgo_BooleanOperations myalgo;
+
+  myalgo.Shapes(s1, s2);
+  myalgo.SetApproxParameters(NbPntMax,Toler3d,Toler2d,RelativeTol);
+  TopoDS_Shape res; res = myalgo.Section();
+  DBRep::Set(a[1],res);
+  return 0;
+}
+
+#include <Geom_Axis2Placement.hxx>
+#include <AIS_Trihedron.hxx>
+
+static Standard_Integer BUC60574(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
+{
+  
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+  
+  Handle(Geom_Axis2Placement) atrihedronAxis = new Geom_Axis2Placement(gp::XOY()); 
+  Handle(AIS_Trihedron) atri = new AIS_Trihedron(atrihedronAxis); 
+  gp_Trsf aTrsf; 
+  gp_Vec trans(5,5,5); 
+  aTrsf.SetTranslation(trans); 
+  TopLoc_Location aLoc(aTrsf); 
+  myAISContext->SetLocation(atri,aLoc); 
+  myAISContext->Display(atri,0,-1,Standard_True, Standard_True);
+  myAISContext->OpenLocalContext(Standard_False, 
+                                Standard_True,Standard_False,Standard_False); 
+  myAISContext->Load(atri,3,Standard_True);
+
+  return 0;
+}
+
+#include <TopoDS_Solid.hxx>
+#include <BRepPrimAPI_MakeBox.hxx>
+#include <BRepPrimAPI_MakeSphere.hxx>
+
+#include <BRepAlgoAPI_Fuse.hxx>
+#include <BRepAlgo_Fuse.hxx>
+
+#include <V3d_Plane.hxx>
+#include <V3d_View.hxx>
+#include <gce_MakePln.hxx>
+
+static Standard_Integer BUC60698(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
+{
+  if(argc > 2) {
+    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 2) {
+    Standard_Integer IsB = atoi(a[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+  TopoDS_Solid box = BRepPrimAPI_MakeBox(1,1,1).Solid();
+  TopoDS_Shape sphere = BRepPrimAPI_MakeSphere(gp_Pnt(0.5,0.5,0.5),0.6).Shape();
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  TopoDS_Shape fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
+//#else
+//  TopoDS_Shape fuse = BRepAlgo_Fuse(box,sphere).Shape();
+//#endif
+
+  TopoDS_Shape fuse;
+  if (IsBRepAlgoAPI) {
+    di << "fuse = BRepAlgoAPI_Fuse(box,sphere).Shape()" <<"\n";
+    fuse = BRepAlgoAPI_Fuse(box,sphere).Shape();
+  } else {
+    di << "fuse = BRepAlgo_Fuse(box,sphere).Shape()" <<"\n";
+    fuse = BRepAlgo_Fuse(box,sphere).Shape();
+  }
+
+  Handle_AIS_Shape theAISShape = new AIS_Shape(fuse);
+  myAISContext->Display(theAISShape);
+  di.Eval("vfit");
+  gp_Pln thegpPln = gce_MakePln(gp_Pnt(0.5,0.5,0.5),gp_Dir(0,0,1));
+  Standard_Real A,B,C,D;
+  thegpPln.Coefficients(A,B,C,D);
+  Handle_V3d_Plane thePlane = new V3d_Plane(A,B,C,D);
+  myAISContext->CurrentViewer()->AddPlane (thePlane); // add to defined planes list
+  for (myAISContext->CurrentViewer()->InitActiveViews();
+       myAISContext->CurrentViewer()->MoreActiveViews ();
+       myAISContext->CurrentViewer()->NextActiveViews ()) {
+    try {
+      OCC_CATCH_SIGNALS
+      myAISContext->CurrentViewer()->ActiveView()->SetPlaneOn(thePlane);
+    }
+    catch(Standard_Failure) {
+      di << "SetPlaneOn catched 1" << "\n";
+    }
+#ifdef WNT
+    catch(...) {
+      di << "SetPlaneOn catched 1" << "\n";
+    }
+#endif
+  }//ActiveView loop
+  for (myAISContext->CurrentViewer()->InitDefinedViews();
+       myAISContext->CurrentViewer()->MoreDefinedViews ();
+       myAISContext->CurrentViewer()->NextDefinedViews ()) {
+    try {
+      OCC_CATCH_SIGNALS
+      myAISContext->CurrentViewer()->DefinedView()->SetPlaneOn(thePlane);
+    }
+    catch(Standard_Failure) {
+      di << "SetPlaneOn catched 1" << "\n";
+    }
+#ifdef WNT
+    catch(...) {
+      di << "SetPlaneOn catched 2" << "\n";
+    }
+#endif
+  }//DefinedView loop
+  myAISContext->UpdateCurrentViewer();
+  myAISContext->OpenLocalContext();
+  myAISContext->ActivateStandardMode(TopAbs_FACE);
+  return 0;
+}
+
+static Standard_Integer BUC60699(Draw_Interpretor& di, Standard_Integer /*n*/, const char ** a)
+{
+  
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+  TopoDS_Solid B1 = BRepPrimAPI_MakeBox (1,1,1).Solid();
+  TopAbs_ShapeEnum theType = B1.ShapeType();
+  if ( theType == TopAbs_SOLID ) {
+    di << "It is a solid."   << "\n";
+  } else {
+    di << "It is not solid."   << "\n";
+  }
+  myAISContext->Display(new AIS_Shape(B1)); 
+  myAISContext->OpenLocalContext();
+  TopAbs_ShapeEnum amode = TopAbs_SOLID;
+  myAISContext->ActivateStandardMode(amode);
+  di.Eval("vfit");
+  di.Eval("QAMoveTo 200 200");
+  di.Eval("QASelect 200 200");
+  myAISContext->InitSelected() ;
+  if ( myAISContext->MoreSelected() ) {
+    if (myAISContext->HasSelectedShape() ) {
+      di << "has selected shape : OK"   << "\n";
+    } else {
+      di << "has selected shape : bugged - Faulty "   << "\n";
+    }
+  }
+  return 0;
+}
+
+static Standard_Integer GER61394(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
+{
+  if(argc > 2) {
+    di << "Usage : " << argv[0] << " [1/0]" << "\n";
+    return -1;
+  }
+  
+  Handle(AIS_InteractiveContext) myAIScontext = ViewerTest::GetAISContext();
+  if(myAIScontext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  
+  if((argc == 2) && (atof(argv[1]) == 0))
+    myV3dView->SetAntialiasingOff();
+  else
+    myV3dView->SetAntialiasingOn();
+  myV3dView->Update();
+  return 0;
+}
+
+
+#define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
+
+//=======================================================================
+//function : GetColorFromName
+//purpose  : get the Quantity_NameOfColor from a string
+//=======================================================================
+
+static Quantity_NameOfColor GetColorFromName( const char *name ) 
+{ 
+  Quantity_NameOfColor ret = DEFAULT_COLOR;
+  
+  Standard_Boolean Found = Standard_False;
+  Standard_CString colstring;
+  for(Standard_Integer i=0;i<=514 && !Found;i++)
+    {
+      colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
+      if (!strcasecmp(name,colstring)) {
+       ret = (Quantity_NameOfColor)i;
+       Found = Standard_True;
+      }
+    }
+  
+  return ret;
+}
+   
+static Standard_Integer setcolor (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
+{
+
+Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+if(myAISContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+
+switch (argc){
+
+ case 2:
+   {
+     di <<"case 2 : This command will change the background color to " << argv[1]<< "\n";
+//   setcolor <name> 
+//   Change the background color of the view with a predefined name Graphic3d_NOC_<name>  
+
+     myV3dView -> SetBackgroundColor(GetColorFromName(argv[1]));
+     myV3dView -> Redraw();
+   break;
+   }
+
+ case 3:
+   {
+     di <<"case 3 : This command will change the color of the objects to "<< argv[2]<< "\n";
+//   setcolor <object> <name> 
+//   Change the object color with a predefined name 
+
+     TopoDS_Shape aShape = DBRep::Get(argv[1]);
+     Handle(AIS_InteractiveObject) myShape = new AIS_Shape (aShape);
+     myAISContext->SetColor(myShape,GetColorFromName(argv[2]),Standard_True);
+     myAISContext->Display(myShape,Standard_True);
+     myAISContext->UpdateCurrentViewer();
+//     return 0;
+   break;
+   }
+ case 4:
+   {
+     di <<"case 4 : This command will change the background color to <r> <g> <b> :"<< argv[1] << argv[2] << argv[3] << "\n";
+
+//   setcolor <r> <g> <b> 
+//   Change the background color of the view with the color values <r>,<g>,<b> 
+//   A color value must be defined in the space [0.,1.] 
+
+     Standard_Real QuantityOfRed   = atoi(argv[1]);
+     Standard_Real QuantityOfGreen = atoi(argv[2]);
+     Standard_Real QuantityOfBlue  = atoi(argv[3]);
+     myV3dView->SetBackgroundColor(Quantity_TOC_RGB,QuantityOfRed,QuantityOfGreen,QuantityOfBlue);
+     myV3dView->Redraw();
+   break;
+   }
+
+ case 5:
+   {
+    di <<"case 5 : This command will change the color of the objects to <r> <g> <b> : "<<argv[2]<< argv[3]<< argv[4]<< "\n";
+
+//  setcolor <object> <r> <g> <b> 
+//  change the object color with RGB values. 
+
+
+    Standard_Real QuantityOfRed   = atof(argv[2]);
+    Standard_Real QuantityOfGreen = atof(argv[3]);
+    Standard_Real QuantityOfBlue  = atof(argv[4]);
+
+    TopoDS_Shape aShape = DBRep::Get(argv[1]);
+    Handle(AIS_InteractiveObject) myShape =  new AIS_Shape (aShape);
+    myAISContext->SetColor(myShape,Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB),Standard_True);
+    myAISContext->Display(myShape,Standard_True);
+    myAISContext->UpdateCurrentViewer();
+//  myShape->SetColor(Quantity_Color(QuantityOfRed,QuantityOfGreen,QuantityOfBlue,Quantity_TOC_RGB));
+//  myShape->Redisplay();
+   break;
+   }
+ }
+return 0;
+}
+
+static Standard_Integer BUC60726 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
+{
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  
+  if(argc != 2) {
+    di << "Usage : " << argv[0] << " 0/1" << "\n";
+  }
+
+  if(atoi(argv[1]) == 0) {
+    myAISContext->CloseAllContexts();
+    BRepPrimAPI_MakeBox B(gp_Pnt(-400.,-400.,-100.),200.,150.,100.);
+    Handle(AIS_Shape) aBox = new AIS_Shape(B.Shape());
+    myAISContext->Display(aBox);
+  } else if(atoi(argv[1]) == 1) {
+    myAISContext->CloseAllContexts();
+    myAISContext->OpenLocalContext();
+    myAISContext->ActivateStandardMode(TopAbs_EDGE);
+  } else if(atoi(argv[1]) == 2) {
+    myAISContext->CloseAllContexts();
+    myAISContext->OpenLocalContext();
+    myAISContext->ActivateStandardMode(TopAbs_FACE);
+  } else {
+    di << "Usage : " << argv[0] << " 0/1" << "\n";
+    return -1;
+  }
+  
+  return 0;
+}
+
+#include <BRepBndLib.hxx>
+#include <Bnd_HArray1OfBox.hxx>
+  
+static Standard_Integer BUC60729 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** /*argv*/ )
+{
+  Bnd_Box aMainBox;
+  TopoDS_Shape aShape = BRepPrimAPI_MakeBox(1,1,1).Solid();
+
+  BRepBndLib::Add(aShape , aMainBox );
+
+  Standard_Integer siMaxNbrBox = 6;
+  Bnd_BoundSortBox m_BoundSortBox;
+  m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
+  TopExp_Explorer aExplorer(aShape,TopAbs_FACE);
+  Standard_Integer i;
+
+
+//  Bnd_Box __emptyBox; // Box is void !
+//  Handle_Bnd_HArray1OfBox __aSetOfBox = new Bnd_HArray1OfBox( 1, siMaxNbrBox, __emptyBox ); 
+
+  for (i=1,aExplorer.ReInit(); aExplorer.More(); aExplorer.Next(),i++ ) 
+    { 
+      const TopoDS_Shape& aFace = aExplorer.Current();
+      Bnd_Box aBox;
+      BRepBndLib::Add( aFace, aBox );
+      m_BoundSortBox.Add( aBox, i );
+//      __aSetOfBox->SetValue( i, aBox ); 
+    } 
+//  m_BoundSortBox.Initialize( aMainBox, siMaxNbrBox );
+  
+  return 0;
+}
+
+static Standard_Integer BUC60724(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
+{
+  TCollection_AsciiString as1("");
+  TCollection_AsciiString as2('\0');
+  if((as1.ToCString()!=NULL) || (as1.ToCString() != ""))
+    di << "Faulty : the first string is not zero string : " << as1.ToCString() << "\n";
+
+  if((as2.ToCString()!=NULL) || (as2.ToCString() != ""))
+    di << "Faulty : the second string is not zero string : " << as2.ToCString() << "\n";
+  
+  return 0;
+}
+
+#include <UnitsAPI.hxx>
+
+static Standard_Integer BUC60727(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/ )
+{
+di <<"Program Test" << "\n";
+UnitsAPI::SetLocalSystem(UnitsAPI_MDTV); //length is mm 
+di <<"AnyToLS (3,mm) = " << UnitsAPI::AnyToLS(3.,"mm") << "\n"; // result was WRONG. 
+
+   return 0;
+}
+
+#include <gp_Circ.hxx>
+#include <Geom_Circle.hxx>
+#include <GeomAPI.hxx>
+#include <Geom2d_CartesianPoint.hxx>
+#include <Geom2dGcc_QualifiedCurve.hxx>
+#include <Geom2dGcc_Circ2d2TanRad.hxx>
+#include <Geom2d_Circle.hxx>
+#include <ProjLib.hxx>
+
+static Standard_Integer BUC60792(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  gp_Pnt pt3d(0, 20, 150);
+  gp_Ax2 anAx2(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0), gp_Dir(0, 0, 1));
+  gp_Circ circ(anAx2, 50.0); 
+  Handle_Geom_Circle gcir = new Geom_Circle(circ); 
+  Handle_Geom_Plane pln = new Geom_Plane(gp_Ax3(gp_Pnt(0, 0, 0), gp_Dir(1, 0, 0))); 
+  Handle_Geom2d_Curve gcir1 = GeomAPI::To2d(gcir, pln->Pln()); 
+  TopoDS_Shape sh1 = BRepBuilderAPI_MakeEdge(gcir1, pln).Shape(); 
+  Handle_AIS_Shape ais1 = new AIS_Shape(sh1); 
+  aContext->SetColor(ais1, Quantity_NOC_INDIANRED); 
+  aContext->Display(ais1); 
+  DBRep::Set("sh0",sh1);
+  gp_Pnt2d thepoint; 
+//  local_get_2Dpointfrom3Dpoint(pt3d, pln->Pln(), thepoint); 
+  thepoint = ProjLib::Project(pln->Pln(),pt3d);
+  Handle_Geom2d_CartesianPoint ThePoint = new Geom2d_CartesianPoint(thepoint); 
+  Geom2dAdaptor_Curve acur1(gcir1) ; 
+  Geom2dGcc_QualifiedCurve qcur1(acur1, GccEnt_outside) ; 
+  Geom2dGcc_Circ2d2TanRad cirtanrad(qcur1, ThePoint, 200.0, 0.0001); 
+  printf("\n No. of solutions = %d\n", cirtanrad.NbSolutions()); 
+  Handle_Geom2d_Circle gccc; 
+  if( cirtanrad.NbSolutions() ) { 
+    for( int i = 1; i<=cirtanrad.NbSolutions(); i++) { 
+      gp_Circ2d ccc = cirtanrad.ThisSolution(i); 
+      gccc = new Geom2d_Circle(ccc); 
+      TopoDS_Shape sh = BRepBuilderAPI_MakeEdge(gccc, pln).Shape();
+      Standard_Character aStr[5];
+      sprintf(aStr,"sh%d",i);
+      DBRep::Set(aStr,sh);
+      Handle_AIS_Shape ais = new AIS_Shape(sh); 
+      if( i ==1 ) 
+       aContext->SetColor(ais, Quantity_NOC_GREEN); 
+      if( i == 2) 
+       aContext->SetColor(ais, Quantity_NOC_HOTPINK); 
+      aContext->Display(ais); 
+      Standard_Real ParSol1, ParSol2, ParArg1, ParArg2; 
+      gp_Pnt2d PntSol1, PntSol2; 
+      cirtanrad.Tangency1(i, ParSol1, ParArg1, PntSol1);
+      printf("%f\t%f\t\t%f\t%f\n",ParSol1, ParArg1,PntSol1.X(),PntSol1.Y());
+      cirtanrad.Tangency2(i, ParSol2, ParArg2, PntSol2); 
+      printf("%f\t%f\t\t%f\t%f\n",ParSol2, ParArg2,PntSol2.X(),PntSol2.Y());
+    }
+  }
+  return 0;
+}
+
+#include <TColgp_Array2OfPnt.hxx>
+#include <Geom_BezierSurface.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <Geom_OffsetSurface.hxx>
+#include <BRepFilletAPI_MakeFillet2d.hxx>
+#include <GeomProjLib.hxx>
+#include <Geom_TrimmedCurve.hxx>
+
+static Standard_Integer BUC60811(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
+{
+  if(argc == 4) {
+    TopLoc_Location L1;
+    TopoDS_Edge aEdge = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
+    TopoDS_Face aFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
+    Standard_Real f = 0.0, l = 0.0; 
+    Handle(Geom_Curve) GC = BRep_Tool::Curve(aEdge,f,l);
+    Handle(Geom_Surface) GS = BRep_Tool::Surface(aFace, L1);
+    GC = new Geom_TrimmedCurve(GC, f, l); 
+    Handle(Geom_Curve) projCurve = GeomProjLib::Project(GC,GS); 
+    BRepBuilderAPI_MakeWire *myWire; 
+    myWire = new BRepBuilderAPI_MakeWire(); 
+    myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge());
+    DBRep::Set(argv[1],myWire->Wire());
+    return  0;
+  }
+  
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  
+//step 1. creating a Bezier Surface and a patch 
+  TopoDS_Face FP; 
+  TopoDS_Shape FP1; 
+  TopoDS_Solid solid; 
+  Handle(AIS_Shape) ais1; 
+  Handle_AIS_Shape ais2; 
+  Handle(Geom_BezierSurface) BZ1;
+  TColgp_Array2OfPnt array1(1,3,1,3);
+  array1.SetValue(1,1,gp_Pnt(0,100,0));
+  array1.SetValue(1,2,gp_Pnt(200,100,0));
+  array1.SetValue(1,3,gp_Pnt(400,100,0)); 
+  array1.SetValue(2,1,gp_Pnt(0,200,100)); 
+  array1.SetValue(2,2,gp_Pnt(200,200,100)); 
+  array1.SetValue(2,3,gp_Pnt(400,200,100)); 
+  array1.SetValue(3,1,gp_Pnt(0,300,0)); 
+  array1.SetValue(3,2,gp_Pnt(200,300,0)); 
+  array1.SetValue(3,3,gp_Pnt(400,300,0)); 
+  BZ1 = new Geom_BezierSurface(array1);
+  BRepBuilderAPI_MakeFace bzf1( BZ1, Precision::Confusion() );
+  TopoDS_Face F1= bzf1.Face();
+  ais1 = new AIS_Shape(F1);
+  DBRep::Set("F1",F1);
+  aContext->SetMaterial(ais1,Graphic3d_NOM_ALUMINIUM,Standard_False);
+  aContext->Display(ais1);
+  BRep_Builder B;
+  TopoDS_Shell shell;
+  B.MakeShell(shell);
+  B.Add(shell, bzf1); 
+  B.MakeSolid(solid);
+  B.Add(solid,shell); 
+  gp_Dir D(0, 0, 1.0f); 
+  BRepBuilderAPI_MakeWire mkw; 
+  gp_Pnt p1 = gp_Pnt(150., 150.0, 260.);
+  gp_Pnt p2 = gp_Pnt(350., 150., 260.); 
+  BRepBuilderAPI_MakeEdge* E1 = new BRepBuilderAPI_MakeEdge(p1,p2); 
+  mkw.Add(*E1); 
+  p1 = gp_Pnt(350., 150., 260.); 
+  p2 = gp_Pnt(350., 250., 260.); 
+  BRepBuilderAPI_MakeEdge* E2 = new BRepBuilderAPI_MakeEdge(p1,p2); 
+  mkw.Add(*E2); 
+  p1 = gp_Pnt(350., 250., 260.); 
+  p2 = gp_Pnt(300., 250.0, 260.); 
+  BRepBuilderAPI_MakeEdge* E3 = new BRepBuilderAPI_MakeEdge(p1,p2);
+  mkw.Add(*E3); 
+  p1 = gp_Pnt(300., 250.0, 260.); 
+  p2 = gp_Pnt(200., 200.0, 260.); 
+  BRepBuilderAPI_MakeEdge* E4 = new BRepBuilderAPI_MakeEdge(p1,p2); 
+  mkw.Add(*E4); 
+  p1 = gp_Pnt(200., 200.0, 260.); 
+  p2 = gp_Pnt(150., 200.0, 260.); 
+  BRepBuilderAPI_MakeEdge* E5 = new BRepBuilderAPI_MakeEdge(p1,p2);
+  mkw.Add(*E5); 
+  p1 = gp_Pnt(150., 200.0, 260.); 
+  p2 = gp_Pnt(150., 150.0, 260.); 
+  BRepBuilderAPI_MakeEdge* E6 = new BRepBuilderAPI_MakeEdge(p1,p2);
+  mkw.Add(*E6); 
+  FP = BRepBuilderAPI_MakeFace(mkw.Wire()); 
+  ais2 = new AIS_Shape( FP ); 
+  aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False); 
+  aContext->Display( ais2 );
+
+  DBRep::Set("FP",FP);
+  
+//step 2. offseting the surface. 
+  Handle_Geom_OffsetSurface offsurf; 
+  offsurf = new Geom_OffsetSurface(BZ1, -100); 
+  BRepBuilderAPI_MakeFace bzf2( offsurf, Precision::Confusion() ); 
+  TopoDS_Face F2= bzf2.Face(); 
+  Handle_AIS_Shape ais22 = new AIS_Shape(F2); 
+  aContext->Display(ais22); 
+  DBRep::Set("F2",F2);
+  
+//step 3. filleting the patch. 
+//( I want to project wire of this patch on offseted surface above) 
+  BRepFilletAPI_MakeFillet2d fillet( FP ); 
+  TopExp_Explorer Ex; 
+  Ex.Init(FP, TopAbs_VERTEX); 
+  TopoDS_Vertex v1 = TopoDS::Vertex(Ex.Current()); 
+  fillet.AddFillet(v1, 20); 
+  printf("\nError is %d ", fillet.Status()); 
+  Ex.Next(); 
+  TopoDS_Vertex V2 = TopoDS::Vertex(Ex.Current()); 
+  fillet.AddFillet(V2, 20); 
+  printf("\nError is %d ", fillet.Status());
+  fillet.Build(); 
+  FP1 = fillet.Shape(); 
+  ais2 = new AIS_Shape( FP1 ); 
+  aContext->SetMaterial(ais2,Graphic3d_NOM_ALUMINIUM,Standard_False); 
+  aContext->Display( ais2 ); 
+
+  DBRep::Set("FP1",FP1);
+  
+//step 4. Projecting the wire of this patch on offsetted surface. 
+//  TopExp_Explorer Ex; 
+  BRepBuilderAPI_MakeWire *myWire; 
+  myWire = new BRepBuilderAPI_MakeWire(); 
+  for (Ex.Init( FP1, TopAbs_EDGE); Ex.More(); Ex.Next()) 
+    { 
+      TopoDS_Edge e1 = TopoDS::Edge(Ex.Current()); 
+      Standard_Real f = 0.0, l = 0.0; 
+      Handle_Geom_Curve newBSplin = BRep_Tool::Curve(e1, f, l);
+      newBSplin = new Geom_TrimmedCurve(newBSplin, f, l); 
+      Handle(Geom_Curve) projCurve = GeomProjLib::Project(newBSplin,offsurf); 
+      myWire->Add((BRepBuilderAPI_MakeEdge(projCurve)).Edge()); 
+    } 
+  Handle_AIS_Shape ais33 = new AIS_Shape( myWire->Wire() ); 
+  aContext->Display(ais33);
+
+  DBRep::Set("Wire",myWire->Wire());
+  
+  return 0;
+}
+
+#include<GeomAPI_ExtremaCurveCurve.hxx>
+
+static int BUC60825(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+
+{
+  if(argc < 3){
+    printf("Usage: %s edge1 edge2",argv[0]);
+    return(-1);
+  }
+        TopoDS_Edge E1 = TopoDS::Edge(DBRep::Get(argv[1])),
+       E2 = TopoDS::Edge(DBRep::Get(argv[2]));
+
+       Standard_Real fp , lp;
+
+       Handle(Geom_Curve) C1 = BRep_Tool::Curve(E1 , fp , lp),
+        C2 = BRep_Tool::Curve(E2 , fp , lp);
+
+       GeomAPI_ExtremaCurveCurve aExt(C1 , C2);
+
+       di << "NB RESULTS : " << aExt.NbExtrema() << "\n";
+
+       return 0;
+}
+
+#include <BRepBuilderAPI_MakePolygon.hxx>
+#include <BRepOffsetAPI_ThruSections.hxx>
+
+static int OCC10006(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc > 2) {
+    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 2) {
+    Standard_Integer IsB = atoi(argv[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  double bottompoints1[12] = { 10, -10, 0, 100, -10, 0, 100, -100, 0, 10, -100, 0};
+  double toppoints1[12] = { 0, 0, 10, 100, 0, 10, 100, -100, 10, 0, -100, 10};
+  double bottompoints2[12] = { 0, 0, 10.00, 100, 0, 10.00, 100, -100, 10.00, 0, -100, 10.00};
+  double toppoints2[12] = { 0, 0, 250, 100, 0, 250, 100, -100, 250, 0, -100, 250};
+  BRepBuilderAPI_MakePolygon bottompolygon1, toppolygon1, bottompolygon2, toppolygon2;
+  gp_Pnt tmppnt;
+  for (int i=0;i<4;i++) {
+    tmppnt.SetCoord(bottompoints1[3*i], bottompoints1[3*i+1], bottompoints1[3*i+2]);
+    bottompolygon1.Add(tmppnt);
+    tmppnt.SetCoord(toppoints1[3*i], toppoints1[3*i+1], toppoints1[3*i+2]);
+    toppolygon1.Add(tmppnt);
+    tmppnt.SetCoord(bottompoints2[3*i], bottompoints2[3*i+1], bottompoints2[3*i+2]);
+    bottompolygon2.Add(tmppnt);
+    tmppnt.SetCoord(toppoints2[3*i], toppoints2[3*i+1], toppoints2[3*i+2]);
+    toppolygon2.Add(tmppnt);
+  }
+  bottompolygon1.Close();
+  DBRep::Set("B1",bottompolygon1.Shape());
+  toppolygon1.Close();
+  DBRep::Set("T1",toppolygon1.Shape());
+  bottompolygon2.Close();
+  DBRep::Set("B2",bottompolygon2.Shape());
+  toppolygon2.Close();
+  DBRep::Set("T2",toppolygon2.Shape());
+  BRepOffsetAPI_ThruSections loft1(Standard_True, Standard_True);
+  loft1.AddWire(bottompolygon1.Wire());
+  loft1.AddWire(toppolygon1.Wire());
+  loft1.Build();
+  BRepOffsetAPI_ThruSections loft2(Standard_True, Standard_True);
+  loft2.AddWire(bottompolygon2.Wire());
+  loft2.AddWire(toppolygon2.Wire());
+  loft2.Build();
+  if (loft1.Shape().IsNull() || loft2.Shape().IsNull())
+    return 1;
+  DBRep::Set("TS1",loft1.Shape());
+  DBRep::Set("TS2",loft2.Shape());
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
+//#else
+//  BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
+//#endif
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
+    BRepAlgoAPI_Fuse result(loft1.Shape(), loft2.Shape());
+    DBRep::Set("F",result.Shape());
+  } else {
+    di << "BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape())" <<"\n";
+    BRepAlgo_Fuse result(loft1.Shape(), loft2.Shape());
+    DBRep::Set("F",result.Shape());
+  }
+
+//  DBRep::Set("F",result.Shape());
+  return 0;
+}
+
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <GC_MakeTrimmedCone.hxx>
+
+static Standard_Integer BUC60856(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv )
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+
+  gp_Ax2  Cone_Ax;                                                                
+  double R1=8, R2=16, H1=20, H2=40, angle;                                       
+  gp_Pnt P0(0,0,0),                                                              
+  P1(0,0,20), P2(0,0,45);                                                        
+  angle = 2*M_PI;                                                                  
+  Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
+  TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
+  Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
+  aContext->Display(ais1);
+  aContext->SetColor(ais1, Quantity_NOC_BLUE1);
+  
+  Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2,R1, 0).Value();
+  TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
+  Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
+  aContext->Display(ais2);
+  aContext->SetColor(ais2, Quantity_NOC_RED);
+  return 0;
+}
+
+#if ! defined(WNT)
+//#include <fstream.h>
+#ifdef HAVE_FSTREAM
+# include <fstream>
+#elif defined (HAVE_FSTREAM_H)
+# include <fstream.h> 
+#endif
+//#include <Standard_Stream.hxx>
+//==========================================================================
+//function : CoordLoad
+//           chargement d une face dans l explorer.
+//==========================================================================
+static Standard_Integer coordload (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{ 
+  char line[256];
+  char X[30], Y[30];
+  int fr;
+  TopoDS_Vertex V1,V2;
+  TopoDS_Edge Edge;
+  TopoDS_Wire Wire;
+  TopoDS_Face Face;
+
+  if (argc < 3) return 1;
+
+  ifstream file(argv[2], ios::in);
+  if(!file)
+    {
+      di<<"unable to open "<<argv[2]<<" for input"<<"\n";
+      return 2;
+    }
+  BRepBuilderAPI_MakeWire WB;
+
+  file.getline(line,80);
+  for(int i=0;i<30;i++) X[i]=Y[i]=0;
+  fr = sscanf(line,"%20c%20c",&X,&Y);
+  V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
+
+  for(;;)
+    {
+      file.getline(line,80);
+      if (!file) break;
+         for(int i=0;i<30;i++) X[i]=Y[i]=0;
+         fr = sscanf(line,"%20c%20c",&X,&Y);
+         V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(atof(X),atof(Y),0.0));
+         Edge = BRepBuilderAPI_MakeEdge(V1,V2);
+         WB.Add(Edge);
+         V1=V2;
+  }
+  
+  file.close();
+  if (WB.IsDone()) Wire = WB.Wire();
+  Face = BRepBuilderAPI_MakeFace(Wire);
+
+  DBRep::Set (argv[1],Face);
+  return 0;
+}
+#endif
+
+static Standard_Integer TestMem (Draw_Interpretor& /*di*/,
+                                Standard_Integer /*nb*/, 
+                                const char ** /*arg*/) 
+{
+  TCollection_ExtendedString aString(1024*1024, 'A');
+  return 0;
+}
+
+static Standard_Integer BUC60876_ (Draw_Interpretor& di,
+                                Standard_Integer argc, 
+                                const char ** argv) 
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }    
+  if((argc != 2) && (argc != 3)) {
+    di<< "usage : " << argv[0] << " shape [mode==1]" << "\n";
+    return -1;
+  }
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+  Handle(AIS_InteractiveObject) anIO = new AIS_Shape(aShape);
+//  Handle(AIS_InteractiveObject) anIOa = ViewerTest::GetAISShapeFromName(argv[1]);
+  anIO->SetHilightMode((argc == 3) ? atoi(argv[2]) : 1);
+  aContext->Display(anIO);
+  return 0;
+}
+
+//=======================================================================
+//function : buc60773
+//purpose  : 
+//=======================================================================
+
+#include<TCollection_HAsciiString.hxx>
+
+static Standard_Integer BUC60773 (Draw_Interpretor& /*di*/, Standard_Integer /*n*/, const char ** /*a*/)
+{
+  Handle(TCollection_HAsciiString) hAscii = new TCollection_HAsciiString();
+  Standard_CString aStr = hAscii->ToCString();
+  TCollection_AsciiString aAscii(aStr);  
+  
+  return 0;
+}
+
+#include<BRepPrimAPI_MakeCylinder.hxx>
+#include<BRepPrimAPI_MakeCone.hxx>
+
+static int TestCMD(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+
+{
+  if(argc > 2) {
+    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 2) {
+    Standard_Integer IsB = atoi(argv[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  //Cylindre 36.085182 20.0 8.431413 88.04671 20.0 38.931416 10.0
+
+  Standard_Real x11 = 36.085182;
+  Standard_Real y11 = 20.0;
+  Standard_Real z11 = 8.431413;
+  Standard_Real x12 = 88.04671;
+  Standard_Real y12 = 20.0;
+  Standard_Real z12 = 38.931416;
+  Standard_Real radius = 10.0;
+
+  gp_Pnt base1(x11, y11, z11);
+  gp_Dir vect1(x12-x11, y12-y11, z12-z11);
+  gp_Ax2 axis1(base1, vect1);
+  Standard_Real height1 = sqrt( ((x12-x11)*(x12-x11)) + ((y12-y11)*(y12-y11)) + ((z12-z11)*(z12-z11)) );
+  BRepPrimAPI_MakeCylinder cylinder(axis1, radius, height1);
+
+  TopoDS_Shape SCyl = cylinder.Shape();
+  DBRep::Set("cyl", SCyl);
+
+   
+  //Cone 70.7262 20.0 28.431412 105.36722 20.0 48.431416 6.0 3.0
+  Standard_Real x21 = 70.7262;
+  Standard_Real y21 = 20.0;
+  Standard_Real z21 = 28.431412;
+  Standard_Real x22 = 105.36722;
+  Standard_Real y22 = 20.0;
+  Standard_Real z22 = 48.431416;
+  Standard_Real radius1 = 6.0;
+  Standard_Real radius2 = 3.0;
+
+  gp_Pnt base2(x21, y21, z21);
+  gp_Dir vect2(x22-x21, y22-y21, z22-z21);
+  gp_Ax2 axis2(base2, vect2);
+  Standard_Real height2 = sqrt( ((x22-x21)*(x22-x21)) + ((y22-y21)*(y22-y21)) + ((z22-z21)*(z22-z21)) );
+  BRepPrimAPI_MakeCone cone(axis2, radius1, radius2, height2);
+
+  TopoDS_Shape SCon = cone.Shape();
+  DBRep::Set("con", SCon);
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
+//#else
+//  BRepAlgo_Fuse SFuse(SCyl, SCon);
+//#endif
+//
+//  if(! SFuse.IsDone() )
+//    cout<<"Error: Boolean fuse operation failed !"<<endl;
+//
+//  TopoDS_Shape fuse = SFuse.Shape();
+
+  TopoDS_Shape fuse;
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Fuse SFuse(SCyl, SCon)" <<"\n";
+    BRepAlgoAPI_Fuse SFuse(SCyl, SCon);
+    if(! SFuse.IsDone() )
+      di<<"Error: Boolean fuse operation failed !"<<"\n";
+    fuse = SFuse.Shape();
+  } else {
+    di << "BRepAlgo_Fuse SFuse(SCyl, SCon)" <<"\n";
+    BRepAlgo_Fuse SFuse(SCyl, SCon);
+    if(! SFuse.IsDone() )
+      di<<"Error: Boolean fuse operation failed !"<<"\n";
+    fuse = SFuse.Shape();
+  }
+
+  DBRep::Set("fus", fuse);
+       
+  return 0;
+}
+
+#include <Dico_DictionaryOfInteger.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <TopExp.hxx>
+#include <TopoDS_Iterator.hxx>
+
+//---------------------------------------------------------------------------------------
+
+static Standard_Integer statface (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
+
+{  
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+  if(aShape.IsNull())
+  {
+    di<<"Invalid input shape"<<"\n";
+    return 1;
+  }
+  Handle(Dico_DictionaryOfInteger) aDico = new Dico_DictionaryOfInteger();
+  Handle(TColStd_HSequenceOfAsciiString) aSequence = new TColStd_HSequenceOfAsciiString;
+  Standard_CString aString;
+  Standard_Integer i=1,j=1,k=1,l=1,aa=1;
+  TopExp_Explorer expl;
+  Standard_Real f3d,l3d;
+  for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
+  {
+    // SURFACES
+    TopoDS_Face aFace = TopoDS::Face (expl.Current());
+    Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace);
+    aString = aSurface->DynamicType()->Name();
+
+    if(aDico->GetItem(aString,aa) != 0)
+    {
+      aDico->GetItem(aString,aa);
+      aDico->SetItem(aString,aa+1);
+    } else  {
+      aDico->SetItem(aString,1);
+      aSequence->Append(aString);
+      aa=1;
+      i++;
+    }
+  }
+  // PCURVES
+  for(expl.Init(aShape,TopAbs_FACE);expl.More();expl.Next())
+  {
+    TopoDS_Face aFace = TopoDS::Face (expl.Current());
+    TopoDS_Iterator anIt(aFace);
+    TopoDS_Wire aWire = TopoDS::Wire (anIt.Value());
+    TopoDS_Iterator it (aWire); 
+    for (; it.More(); it.Next()) {
+      TopoDS_Edge Edge = TopoDS::Edge (it.Value());
+    Handle(Geom2d_Curve) aCurve2d = BRep_Tool::CurveOnSurface(Edge,aFace,f3d,l3d);
+    aString = aCurve2d->DynamicType()->Name();
+        if(aDico->GetItem(aString,aa) != 0)
+        {         
+          aDico->GetItem(aString,aa);
+          aDico->SetItem(aString,aa+1);
+        } else  {
+          aDico->SetItem(aString,1);
+          aSequence->Append(aString);
+          i++;
+          aa=1;
+        }
+    }
+  }
+  // 3d CURVES
+  TopExp_Explorer exp;
+  for (exp.Init(aShape,TopAbs_EDGE); exp.More(); exp.Next()) 
+  {
+      TopoDS_Edge Edge = TopoDS::Edge (exp.Current());
+      Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (Edge,f3d,l3d);
+      if(aCurve3d.IsNull())
+      {
+        l++;
+        goto aLabel;
+      }
+      aString = aCurve3d->DynamicType()->Name();
+        if(aDico->GetItem(aString,aa) != 0)
+        {
+          aDico->GetItem(aString,aa);
+          aDico->SetItem(aString,aa+1);
+        } else  {
+          aDico->SetItem(aString,1);
+          aSequence->Append(aString);
+          i++;
+          aa=1;
+        }
+    aLabel:;
+    }
+  // Output 
+  di<<"\n";
+  for(j=1;j<i;j++)
+    {
+      aDico->GetItem(aSequence->Value(j),aa);
+      di<<aa<<"   --   "<<aSequence->Value(j).ToCString()<<"\n";
+    }    
+
+  di<<"\n";
+  di<<"Degenerated edges :"<<"\n";
+  di<<l<<"   --    "<<"Degenerated edges "<<"\n";
+
+  return 0;
+
+}
+
+#include <BRepBuilderAPI_Transform.hxx>
+
+static Standard_Integer BUC60841(Draw_Interpretor& di, Standard_Integer argc, const char ** argv )
+{
+  if(argc > 2) {
+    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 2) {
+    Standard_Integer IsB = atoi(argv[1]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+
+  gp_Ax2 Ax2 = gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0));
+  BRepPrimAPI_MakeCylinder cyl(Ax2, 260, 150);
+  //BRepPrimAPI_MakeCylinder cyl(gp_Ax2(gp_Pnt(0, 621, 78), gp_Dir(0, 1,0)), 260, 150);
+
+  TopoDS_Shape sh1 = cyl.Shape();
+  DBRep::Set("sh1",sh1);
+  gp_Trsf trsf1, trsf2;
+  trsf1.SetTranslation(gp_Pnt(0.000000,700.000000,-170.000000),
+                       gp_Pnt(0.000000,700.000000,-95.000000));
+  trsf2.SetRotation(gp_Ax1(gp_Pnt(0.000000,700.000000,-170.000000),
+                           gp_Dir(0.000000,0.000000,1.000000)), 0.436111);
+  BRepBuilderAPI_Transform trans1(sh1, trsf1);
+  TopoDS_Shape sh2 = trans1.Shape();
+  DBRep::Set("sh2",sh2);
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Fuse fuse1(sh1, sh2);
+//#else
+//  BRepAlgo_Fuse fuse1(sh1, sh2);
+//#endif
+//
+//  TopoDS_Shape fsh1 = fuse1.Shape();
+
+  TopoDS_Shape fsh1;
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Fuse fuse1(sh1, sh2)" <<"\n";
+    BRepAlgoAPI_Fuse fuse1(sh1, sh2);
+    fsh1 = fuse1.Shape();
+  } else {
+    di << "BRepAlgo_Fuse fuse1(sh1, sh2)" <<"\n";
+    BRepAlgo_Fuse fuse1(sh1, sh2);
+    fsh1 = fuse1.Shape();
+  }
+
+  DBRep::Set("fsh1",fsh1);
+  BRepBuilderAPI_Transform trans2(fsh1, trsf2);
+  TopoDS_Shape sh3 = trans2.Shape();
+  DBRep::Set("sh3",sh3);
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
+//#else
+//  BRepAlgo_Fuse fuse2(fsh1,sh3);
+//#endif
+//
+//  TopoDS_Shape fsh2 = fuse2.Shape();
+
+  TopoDS_Shape fsh2;
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Fuse fuse2(fsh1,sh3)" <<"\n";
+    BRepAlgoAPI_Fuse fuse2(fsh1,sh3);
+    fsh2 = fuse2.Shape();
+  } else {
+    di << "BRepAlgo_Fuse fuse2(fsh1,sh3)" <<"\n";
+    BRepAlgo_Fuse fuse2(fsh1,sh3);
+    fsh2 = fuse2.Shape();
+  }
+
+  DBRep::Set("fsh2",fsh2);
+  Handle_AIS_Shape aisp1 = new AIS_Shape(fsh2);
+//  aContext->Display(aisp1);
+  return 0;
+}
+
+#include <ShapeBuild_Edge.hxx>
+
+static Standard_Integer BUC60874(Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** argv )
+{
+  TopoDS_Edge e = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
+  ShapeBuild_Edge().BuildCurve3d(e);
+  DBRep::Set("ED",e);
+  return 0;
+}
+
+
+#include<TDF_Label.hxx>
+#include<TDataStd_TreeNode.hxx>
+
+#include<DDocStd.hxx>
+
+#include<DDF.hxx>
+
+#include<TDocStd_Modified.hxx>
+#include<TDF_ListIteratorOfDeltaList.hxx>
+#include<TDocStd_Document.hxx>
+#include<TDocStd_Application.hxx>
+#include<TDF_Delta.hxx>
+#include<TDataXtd_Constraint.hxx>
+#include<TPrsStd_AISPresentation.hxx>
+#include<TPrsStd_AISViewer.hxx>
+#include<TNaming_Builder.hxx>
+#include<TNaming_Naming.hxx>
+#include<TNaming_NamedShape.hxx>
+  
+static int BUC60817(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
+  
+  TDF_Label L1,L2;
+  Handle(TDataStd_TreeNode) TN1,TN2;
+
+  DDF::AddLabel(DF,"0:2",L1);
+  TN1 = TDataStd_TreeNode::Set(L1);
+
+  DDF::AddLabel(DF,"0:3",L2);
+  TN2 = TDataStd_TreeNode::Set(L2);
+
+  TN1->Append(TN2);
+  if(!(TN2->IsDescendant(TN1))) {di<<3;return 0;}
+  if((TN1->IsDescendant(TN2))) {di<<4;return 0;}
+
+  di<<0;
+  return 0;
+}
+
+static int BUC60831_1(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<-1;
+    return 0;
+  }
+
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) {di<<-2;return 0;}
+  
+  TDF_Label L;
+  DDF::FindLabel(DF,"0:1",L,Standard_False);
+  Handle(TDocStd_Modified) MDF;
+  if (!L.Root().FindAttribute (TDocStd_Modified::GetID(), MDF)) {
+    MDF = new TDocStd_Modified();
+    L.Root().AddAttribute(MDF);
+  }
+
+  di<<!MDF->IsEmpty();
+  return 0;
+}
+
+static int BUC60831_2(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=3) {
+    di << "Usage : " << argv[0] << " D Label" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) DF;
+  if (!DDF::GetDF(argv[1],DF)) {di<<2;return 0;}
+  
+  TDF_Label L;
+  DDF::FindLabel(DF,argv[2],L,Standard_False);
+
+  TDocStd_Modified::Add(L);
+  
+  di<<0;
+  return 0;
+}
+
+static int BUC60836(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<1;
+    return 0;
+  }
+
+
+  Handle(TDF_Data) aDF;
+  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
+
+  Handle(TDocStd_Document) aDocument;
+  if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<3;return 0;}
+   
+  TDF_Label L;
+  Handle(TDataStd_TreeNode) TN;
+
+  aDocument->NewCommand();
+  DDF::AddLabel(aDF,"0:2",L);
+  TN = TDataStd_TreeNode::Set(L);
+
+  aDocument->NewCommand();
+  DDF::AddLabel(aDF,"0:3",L);
+  TN = TDataStd_TreeNode::Set(L);
+
+  aDocument->NewCommand();
+  DDF::AddLabel(aDF,"0:4",L);
+  TN = TDataStd_TreeNode::Set(L);
+  aDocument->NewCommand();
+
+  TDF_DeltaList Us,Rs;
+  Us = aDocument->GetUndos();
+  Rs = aDocument->GetUndos();
+
+  Standard_Integer i;
+  char Names[10][5]={"n1","n2","n3","n4","n5","n6","n7","n8","n9","n10"};  
+
+  TDF_ListIteratorOfDeltaList IDL;
+  for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
+    Handle(TDF_Delta) D = IDL.Value();
+    TCollection_ExtendedString S(Names[i-1]);
+    D->SetName(S);
+//    cout<<" U"<<i<<"="<<D->Name()<<endl;
+  }
+  
+  aDocument->Undo();
+  aDocument->Undo();
+  
+  Us = aDocument->GetUndos();
+  Rs = aDocument->GetRedos();
+
+  for(IDL.Initialize(Us),i=1;IDL.More();IDL.Next(),i++){
+    Handle(TDF_Delta) D = IDL.Value();
+//    cout<<" U"<<i<<"="<<D->Name()<<endl;
+  }
+
+  TCollection_ExtendedString n2name ("n2");
+  for(IDL.Initialize(Rs),i=1;IDL.More();IDL.Next(),i++){
+    Handle(TDF_Delta) D = IDL.Value();
+    if ( i == 1 && ! D->Name().IsEqual (n2name) ) 
+    {
+      di << 4;
+      return 0;
+   }
+  }
+
+  di<<0;
+  return 0;
+}
+
+static int BUC60847(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=3) {
+    di << "Usage : " << argv[0] << " D Shape" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) aDF;
+  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
+  
+  TopoDS_Shape s = DBRep::Get(argv[2]);
+  if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
+  TDF_Label L;
+  DDF::AddLabel(aDF, "0:2", L);
+  TNaming_Builder SI (L);
+  SI.Generated(s);
+
+  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
+
+  TNaming_Naming aNN;
+  NS=aNN.Name(L,s,s);
+//  if (!NS->IsEmpty()) {di<<3;return 0;}
+  if (NS->IsEmpty()) {di<<4;return 0;}
+  di<<0;
+  return 0;
+}
+
+static int BUC60862(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=3) {
+    di << "Usage : " << argv[0] << " D Shape" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) aDF;
+  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
+  
+  TopoDS_Shape s = DBRep::Get(argv[2]);
+  if (s.IsNull()) { di <<"shape not found"<< "\n"; di<<3;return 0;}
+  TDF_Label L;
+  DDF::AddLabel(aDF, "0:2", L);
+  TNaming_Builder SI (L);
+  SI.Generated(s);
+
+  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
+
+  TNaming_Naming aNN;
+  NS=aNN.Name(L,s,s);
+  if (NS->IsEmpty()) {di<<4;return 0;}
+  di<<0;
+  return 0;
+}
+
+static int BUC60867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if (argc == 2) {
+    TCollection_ExtendedString path (argv[1]); 
+    Handle(TDocStd_Application) A;
+    if (!DDocStd::Find(A)) {di<<1;return 0;}
+    Handle(TDocStd_Document) D;
+    Standard_Integer insession = A->IsInSession(path);
+    if (insession > 0) {  
+      di <<"document " << insession << "  is already in session" << "\n";
+      di<<2;
+      return 0;
+    }
+    PCDM_ReaderStatus Result = A->Open(path,D);
+    if(Result==PCDM_RS_OK){
+      di<<0;
+      return 0; 
+    }
+  }
+  di<<3;
+  return 0;
+}
+
+static int BUC60910(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) aDF;
+  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
+  
+  TDF_Label L;
+  DDF::AddLabel(aDF, "0:2", L);
+  Handle(TPrsStd_AISPresentation) AISP = new TPrsStd_AISPresentation;
+
+  AISP->Set(L,TDataXtd_Constraint::GetID());
+
+  if (AISP->HasOwnMode()) {di<<3;return 0;}
+  AISP->SetMode(3);
+  Standard_Integer Mode = AISP->Mode();
+  if (Mode!=3) {di<<4;return 0;}
+  if (!AISP->HasOwnMode()) {di<<5;return 0;}
+  AISP->UnsetMode();
+  if (AISP->HasOwnMode()) {di<<6;return 0;}
+  di<<0;
+  return 0;
+}
+
+static int BUC60925(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<1;
+    return 0;
+  }
+
+  Handle(TDF_Data) aDF;
+  if (!DDF::GetDF(argv[1],aDF)) {di<<2;return 0;}
+  
+  TDF_Label L;
+  DDF::AddLabel(aDF, "0:2", L);
+  TDF_LabelMap LM;
+  LM.Add(L);
+  
+  Handle(TNaming_NamedShape) NS = new TNaming_NamedShape;
+//  Handle(TNaming_Name) NN = new TNaming_Name;
+  TNaming_Name NN;
+
+  NN.Type(TNaming_IDENTITY);
+  NN.Append(NS);
+  Standard_Boolean Res = NN.Solve(L,LM);
+  
+  if (Res!=Standard_False) {di<<3;return 0;}
+  di<<0;
+  return 0;
+}
+
+static int BUC60932(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  if(argc!=2) {
+    di << "Usage : " << argv[0] << " D" << "\n";
+    di<<1;
+    return 0;
+  }
+
+
+  Handle(TDocStd_Document) aDocument;
+  if (!DDocStd::GetDocument(argv[1], aDocument)) {di<<2;return 0;}
+   
+  if(!aDocument->InitDeltaCompaction()) {di<<3;return 0;}
+  if(!aDocument->PerformDeltaCompaction()) {di<<4;return 0;}
+
+  di<<0;
+  return 0;
+}
+
+//=======================================================================
+//function : AISWidth
+//purpose  : AISWidth (DOC,entry,[width])
+// abv: testing command for checking bug BUC60917 in TPrsStd_AISPresentation
+//=======================================================================
+
+static int AISWidth(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+
+  if (argc >= 3) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(argv[1],D)) {di<<(-1);return 0;}
+    TDF_Label L;
+    if (!DDF::FindLabel(D->GetData(),argv[2],L)) {di<<(-2);return 0;}
+
+    Handle(TPrsStd_AISViewer) viewer;
+    if( !TPrsStd_AISViewer::Find(L, viewer) ) {di<<(-3);return 0;}
+
+    Handle(TPrsStd_AISPresentation) prs;
+    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
+      if( argc == 4 ) {
+        prs->SetWidth(atof(argv[3]));
+        TPrsStd_AISViewer::Update(L);
+      }
+      else {
+       if (prs->HasOwnWidth()){ 
+//         cout << "Width = " << prs->Width() << endl;
+         di<<prs->Width();
+       }
+       else{
+         di << "AISWidth: Warning : Width wasn't set" << "\n";
+         di<<(-4);
+       }
+      }
+      return 0;
+    }
+  }
+  di << "AISWidth : Error"   << "\n";
+  di<<(-5);
+  return 0;
+}
+
+//=======================================================================
+//function : BUC60921 ( & BUC60954 )
+//purpose  : Test memory allocation of OCAF in Undo/Redo operations
+//=======================================================================
+
+static Standard_Integer BUC60921 (Draw_Interpretor& di,
+                                  Standard_Integer nb, 
+                                  const char ** arg) 
+{
+  if (nb >= 4) {     
+    Handle(TDocStd_Document) D;
+    if (!DDocStd::GetDocument(arg[1],D)) {di<<1;return 0;}
+    TDF_Label L;
+    DDF::AddLabel(D->GetData(),arg[2],L);
+
+    BRep_Builder B;
+    TopoDS_Shape S;
+    BRepTools::Read ( S, arg[3], B );
+    
+    TNaming_Builder tnBuild(L);
+    tnBuild.Generated(S);
+//    di << "File " << arg[3] << " added";
+    di<<0;
+    return 0;
+  }
+  di << "BUC60921 Doc label brep_file: directly read brep file and put shape to the label"   << "\n";
+  di<<2;
+  return 0;
+}
+
+#include<IGESControl_Reader.hxx>
+#include<BRepPrimAPI_MakeHalfSpace.hxx>
+
+static Standard_Integer BUC60951_(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
+{
+  //if(argc!=2)
+  //  {
+  //    cerr << "Usage : " << a[0] << " file.igs" << endl;
+  //    return -1;
+  //  }
+  if(argc < 2 || argc > 3) {
+    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
+    return 1;
+  }
+  Standard_Boolean IsBRepAlgoAPI = Standard_True;
+  if (argc == 3) {
+    Standard_Integer IsB = atoi(a[2]);
+    if (IsB != 1) {
+      IsBRepAlgoAPI = Standard_False;
+#if ! defined(BRepAlgo_def01)
+//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
+//      return 1;
+#endif
+    }
+  }
+  
+  Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext(); 
+
+  if(myContext.IsNull()) {
+    di << "use 'vinit' command before " << a[0] << "\n";
+    return -1;
+  }
+
+//  IGESControlStd_Reader reader;
+  IGESControl_Reader reader;
+  reader.ReadFile(a[1]);
+  reader.TransferRoots();
+  TopoDS_Shape shape = reader.OneShape();
+  printf("\n iges1 shape type = %d", shape.ShapeType() );
+  TopTools_IndexedMapOfShape list;
+  TopExp::MapShapes(shape, TopAbs_FACE, list);
+  printf("\n No. of faces = %d", list.Extent());
+
+  TopoDS_Shell shell;
+  BRep_Builder builder;
+  builder.MakeShell(shell);
+  for(int i=1;i<=list.Extent(); i++) { 
+    TopoDS_Face face = TopoDS::Face(list.FindKey(i));
+    builder.Add(shell, face);
+  }
+
+  BRepPrimAPI_MakeHalfSpace half(shell, gp_Pnt(0, 0, 20));
+  TopoDS_Solid sol = half.Solid();
+  gp_Ax2 anAx2(gp_Pnt(-800.0, 0.0, 0), gp_Dir(0, 0, -1));
+  BRepPrimAPI_MakeCylinder cyl(anAx2, 50, 300);
+  TopoDS_Shape sh = cyl.Shape();
+
+//#if ! defined(BRepAlgoAPI_def01)
+//  BRepAlgoAPI_Fuse fuse(sol, sh);
+//#else
+//  BRepAlgo_Fuse fuse(sol, sh);
+//#endif
+//
+//  sh = fuse.Shape();
+
+  if (IsBRepAlgoAPI) {
+    di << "BRepAlgoAPI_Fuse fuse(sol, sh)" <<"\n";
+    BRepAlgoAPI_Fuse fuse(sol, sh);
+    sh = fuse.Shape();
+  } else {
+    di << "BRepAlgo_Fuse fuse(sol, sh)" <<"\n";
+    BRepAlgo_Fuse fuse(sol, sh);
+    sh = fuse.Shape();
+  }
+
+  Handle(AIS_Shape) res = new AIS_Shape(sh);
+  myContext->Display( res );
+  return 0;
+}
+
+void QABugs::Commands_3(Draw_Interpretor& theCommands) {
+  const char *group = "QABugs";
+
+  theCommands.Add("BUC60623","BUC60623 result Shape1 Shape2",__FILE__,BUC60623,group);
+  theCommands.Add("BUC60569","BUC60569 shape",__FILE__,BUC60569,group);
+  theCommands.Add("BUC60614","BUC60614 shape",__FILE__,BUC60614,group);
+  theCommands.Add("BUC60609","BUC60609 shape [name] [interactive (0|1)]",__FILE__,BUC60609,group);
+#if ! defined(WNT)
+  theCommands.Add("UKI61075","UKI61075",__FILE__,UKI61075,group);
+#endif
+  theCommands.Add("BUC60585",St,__FILE__,BUC60585,group);
+  theCommands.Add("BUC60547","BUC60547 name",__FILE__,BUC60547,group);
+  theCommands.Add("BUC60632","BUC60632 mode length",__FILE__,BUC60632,group);
+  theCommands.Add("BUC60652","BUC60652 face",__FILE__,BUC60652,group);
+  theCommands.Add("ksection","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);
+  theCommands.Add("BUC60682","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
+  theCommands.Add("BUC60669","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
+  theCommands.Add("PRO19626","ksection resultat shell1 shell2 NbPntMax Toler3d Toler2d RelativeTol",__FILE__,ksection,group);  
+  theCommands.Add("BUC60574","BUC60574 ",__FILE__,BUC60574,group);
+
+  theCommands.Add("BUC60698","BUC60698 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60698,group);
+
+  theCommands.Add("BUC60699","BUC60699 ",__FILE__,BUC60699,group);
+  theCommands.Add("GER61394","GER61394 [1/0]",__FILE__,GER61394,group);
+  theCommands.Add("GER61351","GER61351 name/object name/r g b/object r g b",__FILE__,setcolor,group);
+  theCommands.Add("setcolor","setcolor name/object name/r g b/object r g b",__FILE__,setcolor,group);
+
+  theCommands.Add("BUC60726","BUC60726 0/1",__FILE__,BUC60726,group);
+  theCommands.Add("BUC60729","BUC60729",__FILE__,BUC60729,group);
+  theCommands.Add("BUC60724","BUC60724",__FILE__,BUC60724,group);
+  theCommands.Add("BUC60727","BUC60727",__FILE__,BUC60727,group);
+  theCommands.Add("BUC60792","BUC60792",__FILE__,BUC60792,group);
+  theCommands.Add("BUC60811","BUC60811",__FILE__,BUC60811,group);
+
+  theCommands.Add("BUC60825","BUC60825",__FILE__,BUC60825,group);
+
+  theCommands.Add("OCC10006","OCC10006 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,OCC10006,group);
+
+  theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
+
+#if ! defined(WNT)
+  theCommands.Add("coordload","load coord from file",__FILE__,coordload);
+#endif
+
+  theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
+  theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);
+  theCommands.Add("BUC60876","BUC60876 shape",__FILE__,BUC60876_,group); 
+  theCommands.Add("BUC60773","BUC60773",__FILE__,BUC60773,group); 
+
+  theCommands.Add("TestCMD","TestCMD [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,TestCMD,group);
+
+  theCommands.Add("statface","statface face",__FILE__,statface,group);
+
+  theCommands.Add("BUC60841","BUC60841 [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60841,group);
+
+  theCommands.Add("BUC60874","BUC60874",__FILE__,BUC60874,group);
+
+  theCommands.Add("BUC60817","BUC60817 D",__FILE__,BUC60817,group);
+  theCommands.Add("BUC60831_1","BUC60831_1 D",__FILE__,BUC60831_1,group);
+  theCommands.Add("BUC60831_2","BUC60831_2 D Label",__FILE__,BUC60831_2,group);
+  theCommands.Add("BUC60836","BUC60836 D",__FILE__,BUC60836,group);
+  theCommands.Add("BUC60847","BUC60847 D Shape",__FILE__,BUC60847,group);
+  theCommands.Add("BUC60862","BUC60862 D Shape",__FILE__,BUC60862,group);
+  theCommands.Add("BUC60867","BUC60867",__FILE__,BUC60867,group);
+  theCommands.Add("BUC60910","BUC60910 D",__FILE__,BUC60910,group);
+  theCommands.Add("BUC60925","BUC60925 D",__FILE__,BUC60925,group);
+  theCommands.Add("BUC60932","BUC60932 D",__FILE__,BUC60932,group);
+  theCommands.Add("AISWidth","AISWidth (DOC,entry,[width])",__FILE__,AISWidth,group);
+  theCommands.Add("BUC60921","BUC60921 Doc label brep_file",__FILE__,BUC60921,group);
+
+  theCommands.Add("BUC60951","BUC60951 file.igs [BRepAlgoAPI/BRepAlgo = 1/0]",__FILE__,BUC60951_, group );
+
+}
diff --git a/src/QABugs/QABugs_4.cxx b/src/QABugs/QABugs_4.cxx
new file mode 100644 (file)
index 0000000..ea0ee22
--- /dev/null
@@ -0,0 +1,155 @@
+// Created on: 2002-03-19
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <BRepPrimAPI_MakeSphere.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <AIS_Drawer.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+
+//#include <AcisData_AcisModel.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+
+#include <tcl.h>
+
+static Standard_Integer BUC60738 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+  }
+  
+  TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(gp_Pnt(-40,0,0),20).Shape();
+  Handle_AIS_Shape theAISShape = new AIS_Shape(theSphere);
+
+  //display mode = Shading
+  theAISShape->SetDisplayMode(1);
+       
+  //get the drawer
+  Handle_AIS_Drawer theDrawer = theAISShape->Attributes();
+  Handle_Prs3d_ShadingAspect theShadingAspect = theDrawer->ShadingAspect();
+  Handle_Graphic3d_AspectFillArea3d theAspectFillArea3d = theShadingAspect->Aspect();
+       
+  //allow to display the edges
+  theAspectFillArea3d->SetEdgeOn();
+  //set the style to Dash
+
+  //but the style is not set to dash : it is always solid
+  theAspectFillArea3d->SetEdgeLineType (Aspect_TOL_DASH); 
+  theAspectFillArea3d->SetEdgeColor(Quantity_Color(Quantity_NOC_GREEN)); 
+  theAspectFillArea3d->SetInteriorStyle(Aspect_IS_EMPTY);
+  theShadingAspect->SetAspect(theAspectFillArea3d);
+  theDrawer->SetShadingAspect(theShadingAspect);
+  theAISShape->SetAttributes(theDrawer);
+
+  aContext->Display(theAISShape);  
+  
+  return 0;
+}
+
+static int BUC60606(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+
+  di << "Use satread command instead of " << argv[0] << "\n";
+  return -1;
+
+  if(argc!=3) {
+    di << "Usage : " << argv[0] << "name filename" << "\n";
+    return -1;
+  }
+//   Handle_AcisData_AcisModel satModel = new AcisData_AcisModel(); 
+//   Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
+
+//   Standard_Character  *filename = new Standard_Character [strlen(DD)+strlen(argv[2])+1];
+//   sprintf(filename,"%s/%s",DD,argv[2]);
+
+//   satModel->ReadSaveFile(filename);
+  
+//   Standard_Boolean success = !satModel.IsNull(); 
+//   cout << "n<-- SAT model read : " << (success?"true":"false") << endl << flush; 
+//   if ( success ) {
+//     Standard_Character *Ch=new Standard_Character [strlen(argv[1])+3];
+//     Handle_TopTools_HSequenceOfShape satShapes = satModel->GetShapes();
+//     Standard_Integer nbs=satShapes->Length();
+//     for(Standard_Integer i=1;i<=nbs;i++) {
+//       TopoDS_Shape xShape = satShapes->Value(i);
+//       if(!xShape.IsNull()) {
+//     sprintf(Ch,"%s_%i",argv[1],i);
+//     DBRep::Set(Ch,xShape);
+//       } else cout << "The shape " << argv[1] << "_" << i << " is NULL !" << endl;
+//     }
+//   }
+  
+
+  return 0;
+}
+
+static int BUC60627(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
+  di << "Use satread command instead of " << argv[0] << "\n";
+  return -1;
+
+  // perform the conversion
+  // as in AcisData.cdl --- that's alright
+//   if(argc!=3) {
+//     cerr << "Usage : " << argv[0] << " BREP file" << endl;
+//     return -1;
+//   }
+//   TopoDS_Shape shapeModel=DBRep::Get(argv[1]);
+//   Handle(AcisData_AcisModel) satModel = new AcisData_AcisModel();
+//   satModel->AddShape( shapeModel ); // memorizes "kegel2.brep"
+//   Standard_CString stringData;
+//   Standard_Integer nbChar; // write intermediate stringin order to compute ACIS data
+//   satModel->WriteStringData( stringData, nbChar );
+//   if ( satModel->IsDone() ) {
+//     satModel = new AcisData_AcisModel();
+//     satModel->ReadStringData( stringData );
+//     if ( satModel->IsDone() ) {
+//       // write into file
+//       satModel->WriteSaveFile( argv[2] );
+//       if ( ! satModel->IsDone() ) {
+//     cout << "The SAT madel does not wroute."   << endl;
+//       }
+//     } else cout << "The SAT model does not read from a string."   << endl;
+//     // satModel->ReadStringData( stringData );
+//   } else cout << "The SAT model does not wroute into a string."   << endl;
+//   // satModel->WriteStringData( stringData, nbChar );
+  return 1;
+}
+
+void QABugs::Commands_4(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add("BUC60738","BUC60738",__FILE__,BUC60738,group);
+  theCommands.Add("BUC60606","BUC60606 name",__FILE__,BUC60606,group);
+  theCommands.Add("BUC60627","BUC60627 name",__FILE__,BUC60627,group);
+  
+  return;
+}
diff --git a/src/QABugs/QABugs_5.cxx b/src/QABugs/QABugs_5.cxx
new file mode 100644 (file)
index 0000000..c31774d
--- /dev/null
@@ -0,0 +1,130 @@
+// Created on: 2004-06-25
+// Created by: QA Admin (qa)
+// Copyright (c) 2004-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <Adaptor3d_HCurve.hxx>
+#include <Geom_Curve.hxx>
+#include <DrawTrSurf.hxx>
+#include <GeomAdaptor_HCurve.hxx>
+#include <TopoDS_Shape.hxx>
+#include <DBRep.hxx>
+#include <GeomAdaptor_HSurface.hxx>
+#include <BRepAdaptor_CompCurve.hxx>
+#include <TopoDS.hxx>
+#include <BRepAdaptor_HCompCurve.hxx>
+#include <IntCurveSurface_HInter.hxx>
+#include <IntCurveSurface_IntersectionPoint.hxx>
+#include <TopoDS_Edge.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <Standard_ErrorHandler.hxx>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static Standard_Integer OCC6001 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc < 4)
+  {
+    di<<"missing parameters"<<"\n";
+    return 1;
+  }
+  const char *name = argv[1];
+  Handle(Adaptor3d_HCurve) hcurve;
+  Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
+  if (!curve.IsNull())
+    hcurve = new GeomAdaptor_HCurve(curve);
+  else
+  {
+    TopoDS_Shape wire = DBRep::Get(argv[2]);
+    if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
+    {
+      di<<"incorrect 1st parameter, curve or wire expected"<<"\n";
+      return 1;
+    }
+    BRepAdaptor_CompCurve comp_curve(TopoDS::Wire(wire));
+    hcurve = new BRepAdaptor_HCompCurve(comp_curve);
+  }
+  Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(argv[3]);
+  Handle(GeomAdaptor_HSurface) hsurf = new GeomAdaptor_HSurface(surf);
+  IntCurveSurface_HInter inter;
+  inter.Perform(hcurve, hsurf);
+  int nb = inter.NbPoints();
+  if (!inter.IsDone() || nb == 0)
+  {
+    di<<"no intersections";
+    return 0;
+  }
+  for (int i=1; i <= nb; i++)
+  {
+    const IntCurveSurface_IntersectionPoint &int_pnt = inter.Point(i);
+    double par = int_pnt.W();
+    gp_Pnt p = int_pnt.Pnt();
+    di<<"inter "<<i<<": W = "<<par<<"\n"
+      <<"\tpnt = "<<p.X()<<" "<<p.Y()<<" "<<p.Z()<<"\n";
+    char n[20], *pname=n;
+    sprintf(n,"%s_%d",name,i);
+    DrawTrSurf::Set(pname,p);
+  }
+
+  return 0;
+
+}
+
+static Standard_Integer OCC5696 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if (argc != 1)
+  {
+    di << "Usage : " << argv[0] << "\n";
+    return 1;
+  }
+  TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0,0,0),gp_Pnt(2,0,0));
+  TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edge);
+  BRepAdaptor_CompCurve curve(wire);
+  Standard_Real first = curve.FirstParameter();
+  Standard_Real last = curve.LastParameter();
+  Standard_Real par = (first + last)/2;
+  Standard_Real par_edge;
+  TopoDS_Edge edge_found;
+  try {
+    OCC_CATCH_SIGNALS
+    curve.Edge(par,edge_found,par_edge);  // exception is here
+    di << "par_edge = " << par_edge << "\n";
+  }
+
+  catch (Standard_Failure) {di << "OCC5696 Exception \n" ;return 0;}
+
+  return 0;
+}
+
+void QABugs::Commands_5(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC6001", "OCC6001 name curve/wire surface\n\t\tintersect curve by surface", 
+                   __FILE__, OCC6001, group);
+
+  theCommands.Add ("OCC5696", "OCC5696", 
+                   __FILE__, OCC5696, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_6.cxx b/src/QABugs/QABugs_6.cxx
new file mode 100644 (file)
index 0000000..69e92bb
--- /dev/null
@@ -0,0 +1,130 @@
+// Created on: 2002-05-22
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <V3d_Viewer.hxx>
+#include <V3d_View.hxx>
+#include <Graphic3d_AspectMarker3d.hxx>
+
+static Standard_Integer OCC281bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) 
+    { 
+    cerr << "use 'vinit' command before " << argv[0] << "\n";
+    return -1;
+    }
+  if(argc < 4) {
+    di << "Usage : " << argv[0] << " x y TypeOfMarker(0-12)" << "\n";
+    return 1;
+  }
+
+  Standard_Integer x,y,TypeOfMarker;
+  x = atoi(argv[1]);
+  y = atoi(argv[2]);
+  TypeOfMarker = atoi(argv[3]);
+  if( x <= 0) {
+    di << "Bad value x=" << x << "\n";
+    return 1;
+  }
+  if( y <= 0) {
+    di << "Bad value y=" << y << "\n";
+    return 1;
+  }
+  if( TypeOfMarker < 0 || TypeOfMarker > 12) {
+    di << "Bad value TypeOfMarker=" << TypeOfMarker << "\n";
+    return 1;
+  }
+  Aspect_TypeOfMarker AspectTypeOfMarker( (Aspect_TypeOfMarker) TypeOfMarker);
+  /*
+        enumeration TypeOfMarker is     TOM_POINT,
+                                        TOM_PLUS,
+                                        TOM_STAR,
+                                        TOM_O,
+                                        TOM_X,
+                                        TOM_O_POINT,
+                                        TOM_O_PLUS,
+                                        TOM_O_STAR,
+                                        TOM_O_X,
+                                        TOM_BALL,
+                                        TOM_RING1,
+                                        TOM_RING2,
+                                        TOM_RING3,
+                                        TOM_USERDEFINED 
+        end TypeOfMarker;
+        ---Purpose: Definition of types of markers
+        --
+        --          TOM_POINT   point   .
+        --          TOM_PLUS    plus    +
+        --          TOM_STAR    star    *
+        --          TOM_O       circle  O
+        --          TOM_X       cross   x
+        --          TOM_O_POINT a point in a circle
+        --          TOM_O_PLUS  a plus in a circle
+        --          TOM_O_STAR  a star in a circle
+        --          TOM_O_X     a cross in a circle
+        --          TOM_BALL    a ball with 1 color and different saturations
+        --          TOM_RING1   a large ring
+        --          TOM_RING2   a medium ring
+        --          TOM_RING3   a small ring
+        --          TOM_USERDEFINED     defined by Users
+        --
+        ---Category: Enumerations
+  */
+
+  Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
+  Handle(V3d_View) aView = ViewerTest::CurrentView();
+
+  aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
+  Handle(Graphic3d_AspectMarker3d) GridAsp = new Graphic3d_AspectMarker3d(AspectTypeOfMarker, Quantity_NOC_BLUE1, 10.);
+  aViewer->SetGridEcho(GridAsp);
+
+  if (aViewer->IsActive()) {
+    if (aViewer->GridEcho()) {
+      V3d_Coordinate X,Y,Z;
+      aView->ConvertToGrid(x,y,X,Y,Z);
+    } else {
+      di << "NOT aViewer->GridEcho()" << "\n";
+      return 1;
+    }
+  } else {
+    di << "NOT aViewer->IsActive()" << "\n";
+    return 1;
+  }
+  return 0;
+}
+
+void QABugs::Commands_6(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("OCC281", "OCC281 x y TypeOfMarker(0-12)", __FILE__, OCC281bug, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_7.cxx b/src/QABugs/QABugs_7.cxx
new file mode 100644 (file)
index 0000000..c76ffd5
--- /dev/null
@@ -0,0 +1,330 @@
+// Created on: 2002-10-11
+// Created by: Michael KUZMITCHEV
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColStd_Array1OfReal.hxx>
+#include <TColStd_Array1OfInteger.hxx>
+#include <Geom_BSplineCurve.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomAPI_ExtremaCurveCurve.hxx>
+
+const Standard_Integer Glob_NbPoles = 195;
+const Standard_Real Glob_Poles[Glob_NbPoles][3] = 
+{
+   { 60000, 31.937047503393231, 799.36226142892554 },
+   { 60000.000000027772, 16.712487623992825, 799.97053069028755 },
+   { 59999.999999875639, 7.3723603687660546, 799.97042131653711 },
+   { 60000.000000331296, 1.2070383839533065, 799.90534456032105 },
+   { 59999.999999361171, -2.5807810139032785, 799.77442818789041 },
+   { 60000.000000952597, -4.7405254527655112, 799.70146419719595 },
+   { 59999.999998867599, -5.3922917628932563, 799.62943054158143 },
+   { 60000.000001091154, -5.1399175234965044, 799.63364074172011 },
+   { 59999.999999142601, -3.6992503431468067, 799.67179299415568 },
+   { 60000.000000546061, -1.6910663098148713, 799.76799688166773 },
+   { 59999.999999725333, 1.1886267067330731, 799.91818018455035 },
+   { 60000.000000101914, 4.5979596894282677, 800.11782874041273 },
+   { 59999.999999977204, 8.5921385739756673, 800.36980220999453 },
+   { 60000.000000018619, 16.600658956791417, 800.90755378048414 },
+   { 59999.999999985768, 26.040687605616604, 801.59827916977554 },
+   { 60000.000000052918, 30.448324872994441, 801.9310695501531 },
+   { 59999.999999883308, 35.089921752286457, 802.29194004854389 },
+   { 60000.000000186978, 39.947755013962528, 802.68007678107051 },
+   { 59999.99999976845, 45.005892525213071, 803.09465896567826 },
+   { 60000.000000227068, 50.249778854659326, 803.53486876081706 },
+   { 59999.999999821659, 55.665932960782108, 803.9998957687626 },
+   { 60000.000000112479, 61.241734208767859, 804.48893829648762 },
+   { 59999.999999943684, 66.965272918611916, 805.00120177704798 },
+   { 60000.000000021486, 72.8252416954995, 805.53589657709654 },
+   { 59999.99999999431, 78.810843745189473, 806.09223572876306 },
+   { 60000.000000004045, 87.962119756404547, 806.95803383418911 },
+   { 59999.99999999725, 97.349976765262795, 807.869010426567 },
+   { 60000.000000017491, 100.50428991828356, 808.17759139897635 },
+   { 59999.99999994829, 103.68239055379394, 808.49099684342912 },
+   { 60000.000000105072, 106.88305649144334, 808.80912918631941 },
+   { 59999.999999835563, 110.10508187457555, 809.13189073948308 },
+   { 60000.000000207947, 113.34727572158297, 809.45918381767103 },
+   { 59999.999999784653, 116.60846040037053, 809.79091039912782 },
+   { 60000.000000180742, 119.88747020406682, 810.12697237079749 },
+   { 59999.999999880296, 123.18314981484644, 810.46727114678265 },
+   { 60000.000000059626, 126.49435287223255, 810.81170785335109 },
+   { 59999.999999979838, 129.81994045902351, 811.16018308253979 },
+   { 60000.000000015229, 134.8281992328765, 811.68880383859914 },
+   { 59999.99999998945, 139.86373510893441, 812.2260602582727 },
+   { 60000.000000059066, 141.54513692067022, 812.40609267860532 },
+   { 59999.999999845008, 143.22928798266199, 812.58705944070834 },
+   { 60000.000000278043, 144.91604799540772, 812.7689478797023 },
+   { 59999.999999621934, 146.60527693312631, 812.95174532592102 },
+   { 60000.000000407505, 148.29683501034282, 813.13543899059755 },
+   { 59999.999999644526, 149.99058265886663, 813.32001613307352 },
+   { 60000.000000252723, 151.68638048575326, 813.5054638442823 },
+   { 59999.999999853622, 153.38408925794459, 813.69176926621947 },
+   { 60000.000000068765, 155.08356985703421, 813.87891939578799 },
+   { 59999.999999973967, 156.7846832610312, 814.06690122038856 },
+   { 60000.00000002468, 159.33859412935516, 814.35010184114628 },
+   { 59999.999999977736, 161.89555354531564, 814.63511466528189 },
+   { 60000.000000145039, 162.74819471256941, 814.73031865086841 },
+   { 59999.999999608634, 163.60113987644607, 814.82572069112655 },
+   { 60000.000000709108, 164.45437167903589, 814.92131914784375 },
+   { 59999.999999031643, 165.3078727497936, 815.0171123286641 },
+   { 60000.000001042623, 166.16162573916125, 815.11309861889924 },
+   { 59999.999999097396, 167.01561326831904, 815.20927628960794 },
+   { 60000.000000630716, 167.86981798631649, 815.30564372626975 },
+   { 59999.999999648215, 168.72422251240596, 815.40219920078994 },
+   { 60000.000000151289, 169.57880948189478, 815.4989410625825 },
+   { 59999.999999954052, 170.43356151298337, 815.5958676029403 },
+   { 60000.000000034408, 171.71591108030151, 815.74153190228753 },
+   { 59999.999999976135, 172.9985538007256, 815.88760410128577 },
+   { 60000.000000129759, 173.42613177350728, 815.93633994702668 },
+   { 59999.999999664251, 173.85373796967124, 815.98512067846866 },
+   { 60000.00000060827, 174.28137021936112, 816.03394612011459 },
+   { 59999.99999914426, 174.70902633885802, 816.08281598496671 },
+   { 60000.000000969369, 175.13670416564241, 816.13173017155248 },
+   { 59999.999999107844, 175.56440150794049, 816.18068832455049 },
+   { 60000.00000066567, 175.9921162052986, 816.22969037578832 },
+   { 59999.999999602165, 176.41984606692156, 816.27873598355484 },
+   { 60000.00000018561, 176.84758892491178, 816.3278250228899 },
+   { 59999.999999935775, 177.27534259516338, 816.37695722529566 },
+   { 60000.000000054533, 177.91698605475608, 816.45071998561696 },
+   { 59999.999999955864, 178.55864403901305, 816.52457892469988 },
+   { 60000.000000281914, 178.7725313764083, 816.54920923644852 },
+   { 59999.999999214248, 178.98641977813006, 816.57385016025694 },
+   { 60000.000001492997, 179.20030898752373, 816.59850173903158 },
+   { 59999.999997853804, 179.41419870083473, 816.62316380941468 },
+   { 60000.000002424618, 179.62808869307457, 816.647836551757 },
+   { 59999.999997816361, 179.84197863289955, 816.6725196831527 },
+   { 60000.000001566797, 180.05586830671322, 816.69721343479125 },
+   { 59999.999999121159, 180.26975739282756, 816.72191756454924 },
+   { 60000.00000036486, 180.48364565146377, 816.74663219124841 },
+   { 59999.999999904954, 180.69753279192835, 816.7713572079532 },
+   { 60000.000000054562, 181.0183614269956, 816.8084603269557 },
+   { 59999.999999978463, 181.33918632988278, 816.84558675379014 },
+   { 60000.000000049782, 181.44612751539663, 816.85796481705847 },
+   { 59999.999999914071, 181.55306821881811, 816.87034546240886 },
+   { 60000.000000125139, 181.66000840292782, 816.88272868833144 },
+   { 59999.999999843392, 181.76694804030186, 816.89511449082431 },
+   { 60000.000000167289, 181.87388708628473, 816.90750286566583 },
+   { 59999.999999847467, 181.98082551962966, 816.9198938103757 },
+   { 60000.000000119864, 182.08776329350809, 816.93228732197861 },
+   { 59999.999999917491, 182.19470038386558, 816.94468339453306 },
+   { 60000.000000050633, 182.30163675019068, 816.9570820285785 },
+   { 59999.999999972366, 182.40857236133851, 816.96948321649302 },
+   { 60000.000000032509, 182.56897459276843, 816.98808882907122 },
+   { 59999.999999965934, 182.7293749693155, 817.00670017517837 },
+   { 60000.000000238462, 182.78284155215263, 817.01290459816312 },
+   { 59999.999999345615, 182.83630791626743, 817.01910964099045 },
+   { 60000.00000119608, 182.88977407140584, 817.02531535916364 },
+   { 59999.999998362182, 182.94323998619015, 817.03152164472851 },
+   { 60000.000001757064, 182.99670569682132, 817.03772865736005 },
+   { 59999.999998499035, 183.05017115047181, 817.04393620474377 },
+   { 60000.00000101691, 183.10363639052409, 817.05014447471717 },
+   { 59999.999999469313, 183.15710137432194, 817.05635331513508 },
+   { 60000.000000196254, 183.21056612270786, 817.06256282498509 },
+   { 59999.999999961823, 183.26403061846696, 817.06877295237007 },
+   { 60000.000000031148, 183.37095910597188, 817.0811944807366 },
+   { 59999.999999975873, 183.47788656385964, 817.09361853568328 },
+   { 60000.000000078871, 183.53291535756762, 817.10001332133618 },
+   { 59999.999999822408, 183.57465447580566, 817.10486251586156 },
+   { 60000.000000306398, 183.67093862701302, 817.11605868308925 },
+   { 59999.999999580868, 183.62493711493508, 817.11070057755603 },
+   { 60000.000000457883, 183.83983154073323, 817.13569840343439 },
+   { 59999.999999600586, 183.70298550843307, 817.11977179379392 },
+   { 60000.000000274122, 183.92091406059222, 817.14512405357789 },
+   { 59999.999999859414, 183.87191278066462, 817.13941945054194 },
+   { 60000.000000045809, 183.96882854112027, 817.15069318206758 },
+   { 59999.99999999682, 184.01172713386404, 817.15568252551441 },
+   { 60000.000000002117, 199.05860625274244, 818.90605990894926 },
+   { 60000.000000011685, 213.77441984052732, 820.66779572748067 },
+   { 59999.999999945896, 228.63273752574398, 822.50191665906459 },
+   { 60000.000000137385, 243.60930053773387, 824.4160390659564 },
+   { 59999.999999745312, 257.44864608947171, 826.20557537898253 },
+   { 60000.000000371336, 272.37732017567259, 828.28374145687258 },
+   { 59999.999999564294, 283.4609507719199, 829.76911975631128 },
+   { 60000.000000411754, 297.87730027160165, 831.94635758332913 },
+   { 59999.999999691667, 308.39894455125989, 833.48120705572103 },
+   { 60000.000000175751, 321.04689540263291, 835.47802201470222 },
+   { 59999.999999930937, 332.7974681685576, 837.36295119087083 },
+   { 60000.000000012922, 344.23852019267594, 839.26003269871717 },
+   { 59999.999999978521, 380.87159046869039, 845.50264944092885 },
+   { 60000.000000031927, 417.67053058140004, 852.32838657260925 },
+   { 59999.999999895757, 443.71876268540638, 857.33613824789597 },
+   { 60000.00000023668, 470.42282907220516, 863.40925211937144 },
+   { 59999.999999591026, 506.36442771103123, 868.70489233101273 },
+   { 60000.000000559063, 504.29569767668107, 873.82665736030435 },
+   { 59999.999999387175, 618.22680165126303, 889.69085497467483 },
+   { 60000.00000054048, 520.96760954336719, 878.60259543512541 },
+   { 59999.999999620944, 695.15397128954748, 909.33199431749756 },
+   { 60000.000000202854, 652.21259368585868, 902.32746593221361 },
+   { 59999.999999925931, 713.31441817738153, 914.25671409207371 },
+   { 60000.000000011525, 744.93626878652026, 920.45067498376648 },
+   { 59999.999999986139, 851.85145355849977, 941.08553924856312 },
+   { 60000.000000015752, 955.13474569084099, 960.32812261133847 },
+   { 59999.99999996031, 1019.9477908992111, 972.25457694191095 },
+   { 60000.000000078573, 1109.7424197388102, 989.27219905591903 },
+   { 59999.999999866697, 1103.4472241364576, 986.24901738812696 },
+   { 60000.000000196575, 1283.5502566789903, 1025.857653448167 },
+   { 59999.999999756859, 1241.170752696316, 1010.5034788173898 },
+   { 60000.000000241002, 1380.0598100152401, 1044.321387312001 },
+   { 59999.999999814674, 1417.3346489504095, 1047.4285724180056 },
+   { 60000.000000106025, 1498.5882349740116, 1064.7148393296281 },
+   { 59999.999999959189, 1562.4075471540843, 1076.5692870450682 },
+   { 60000.000000006847, 1632.0446827427525, 1089.9951747091934 },
+   { 59999.999999992855, 1819.187180960379, 1125.8766969823027 },
+   { 60000.000000006774, 2005.7867190244558, 1161.6893152514506 },
+   { 59999.999999993102, 2127.1610378717864, 1184.8982806691761 },
+   { 59999.999999983789, 2224.9504474907289, 1204.7794295042536 },
+   { 60000.000000076092, 2423.4034586285211, 1239.2849934128672 },
+   { 59999.999999843334, 2352.5108743508281, 1233.9178625300717 },
+   { 60000.00000021555, 2789.1958451831979, 1304.7841887599538 },
+   { 59999.999999781059, 2516.5832651666447, 1267.6317850640198 },
+   { 60000.000000168911, 2997.8479508975411, 1347.2273537129538 },
+   { 59999.999999901927, 2872.9560675152225, 1329.8998228537541 },
+   { 60000.000000040534, 3100.1634765888271, 1371.640798220885 },
+   { 59999.999999990199, 3186.6552406648925, 1389.3336814233451 },
+   { 60000.000000019143, 3570.5318534479206, 1462.8626017289478 },
+   { 59999.999999969914, 3906.3811637172125, 1522.697974792497 },
+   { 60000.000000105116, 4081.0496155485694, 1554.1195061318422 },
+   { 59999.999999764274, 4440.4680391955444, 1682.9362787226369 },
+   { 60000.000000389882, 4025.4579062184348, 1482.6543564450828 },
+   { 59999.999999500047, 5340.2058728577267, 2096.5041911809035 },
+   { 60000.000000509819, 4233.9915572764976, 1518.9299243967394 },
+   { 59999.999999583706, 5430.8345183928068, 2200.8401562891845 },
+   { 60000.000000267981, 5054.5402162751188, 1969.4793692255021 },
+   { 59999.999999871681, 5428.966058504895, 2244.2141001944756 },
+   { 60000.000000038024, 5546.4649349764723, 2352.3606428637349 },
+   { 59999.999999998952, 5706.4753141683368, 2517.0835536242184 },
+   { 59999.999999991771, 6129.2268892602051, 3030.8327236291348 },
+   { 60000.000000020089, 6420.3065439166912, 3661.6495160497966 },
+   { 59999.99999990526, 6235.8646808219391, 3444.1541944672813 },
+   { 60000.000000247288, 8126.8536394010316, 8890.661747328244 },
+   { 59999.99999954299, 2104.925285609057, -7996.1134321147983 },
+   { 60000.00000064441, 14264.475617875083, 34652.739991203249 },
+   { 59999.999999283253, -1684.3290491164355, -33238.811620330394 },
+   { 60000.000000641696, 13782.902589951687, 46532.286752882486 },
+   { 59999.999999532913, 2699.6074087223524, -19079.410940396814 },
+   { 60000.000000275439, 9084.6892111341349, 21937.827319607131 },
+   { 59999.999999871587, 6474.8937324409353, 5006.3713661893671 },
+   { 60000.000000044485, 7350.4434791870981, 10709.698171043074 },
+   { 59999.999999990541, 7306.414330937022, 10560.108503883888 },
+   { 60000, 7397.0783263606427, 11218.963217145942 }
+};
+
+const Standard_Integer Glob_NbKnots = 17;
+const Standard_Real Glob_Knots[Glob_NbKnots] = 
+{
+0,0.0087664292723375857,0.015654339342331427,0.019098294377328347,
+0.020820271894826808,0.021681260653576038,0.022111755032950653,0.022327002222637962,
+0.022434625817481617,0.022488437614903441,0.022542249412325268,0.037523693790797889,
+0.071526893170125505,0.1421299556831544,0.26514857375331263,0.51350664396810353,
+1 };
+
+const Standard_Integer Glob_Mults[Glob_NbKnots] = 
+{
+15,12,12,12,12,12,12,12,
+12,12,12,12,12,12,12,12,
+15 };
+
+//=======================================================================
+//function :  OCC862
+//purpose  : 
+//=======================================================================
+static Standard_Integer OCC862 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if ( argc != 3) {
+    di << "ERROR : Usage : " << argv[0] << " curve1 curve2" << "\n";
+    return 1;
+  }
+
+  Standard_Integer i;
+  // Fill array of poles
+  TColgp_Array1OfPnt aPoles(1,Glob_NbPoles);
+  for (i = 0; i < Glob_NbPoles; i++)
+    aPoles.SetValue(i+1,gp_Pnt(Glob_Poles[i][0],Glob_Poles[i][1],Glob_Poles[i][2]));
+  // Fill array of knots
+  TColStd_Array1OfReal aKnots(1,Glob_NbKnots);
+  for (i = 0; i < Glob_NbKnots; i++)
+    aKnots.SetValue(i+1,Glob_Knots[i]);
+  // Fill array of mults
+  TColStd_Array1OfInteger aMults(1,Glob_NbKnots);
+  for (i = 0; i < Glob_NbKnots; i++)
+    aMults.SetValue(i+1,Glob_Mults[i]);
+  // Create B-Spline curve
+  const Standard_Real aDegree = 14;
+  Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles,aKnots,aMults,aDegree);
+
+  // Create trimmed line
+  gp_XYZ p1(60000,-7504.83,6000);
+  gp_XYZ p2(60000, 7504.83,6000);
+  Handle(Geom_Line) L = new Geom_Line(gp_Pnt(p1),gp_Dir(p2-p1));
+  Handle(Geom_TrimmedCurve) C2 = new Geom_TrimmedCurve(L,0.0,(p2-p1).Modulus());
+
+  DrawTrSurf::Set(argv[1],C1);
+  DrawTrSurf::Set(argv[2],C2);
+
+  // Try to find extrema
+  // IMPORTANT: it is not allowed to input infinite curves !
+  GeomAPI_ExtremaCurveCurve Ex(C1,C2/*,C1f,C1l,C2f,C2l*/);
+  if (Ex.Extrema().IsParallel())
+  {
+    di<<"Info: Infinite number of extrema, distance = "<<Ex.LowerDistance()<<"\n";
+  }
+  else
+  {
+    // Check if extrema were found
+    const Standard_Integer nbEx = Ex.NbExtrema();
+    if (nbEx)
+    {
+      // Get minimal distance data
+      gp_Pnt P1, P2;
+      Ex.NearestPoints(P1,P2);
+      Standard_Real U1, U2;
+      Ex.LowerDistanceParameters(U1,U2);
+      const Standard_Real D = Ex.LowerDistance();
+      // IMPORTANT: minimal distance here means accuracy reached in intersection
+      di<<"Info: Minimal distance is "<<D<<"\n";
+      di<<"Info: Minimal points are ("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<"), ("<<P2.X()<<","<<P2.Y()<<","<<P2.Z()<<")"<<"\n";
+      di<<"Info: Minimal parameters are ("<<U1<<"), ("<<U2<<")"<<"\n";
+    }
+    else
+    {
+      di<<"Error: extrema not found"<<"\n";
+    }
+  }
+  
+  return 0;
+}
+
+void QABugs::Commands_7(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group);  
+  return;
+}
diff --git a/src/QABugs/QABugs_8.cxx b/src/QABugs/QABugs_8.cxx
new file mode 100644 (file)
index 0000000..777ecc3
--- /dev/null
@@ -0,0 +1,271 @@
+// Created on: 2002-03-19
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <TColStd_Array2OfReal.hxx>
+#include <V3d_View.hxx>
+#include <Visual3d_View.hxx>
+
+#include <BRepOffsetAPI_Sewing.hxx>
+
+#include <AIS_ListOfInteractive.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+
+#include <BRepPrimAPI_MakeBox.hxx>
+
+static Standard_Integer BUC60753 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if(argc!=3)
+  {
+    di << "Usage : " << argv[0] << " mode (0 <=mode<=5) ratio (0.0<=ration<=1.0)" <<"\n";
+    return -1;
+  }
+
+  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
+  if(myAISContext.IsNull()) {
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+           
+  Standard_Real Alpha = M_PI/10.;
+  Standard_Real CosAlpha = Cos (Alpha);
+  Standard_Real SinAlpha = Sin (Alpha);
+  Standard_Real MoinsCosAlpha = Cos (-Alpha);
+  Standard_Real MoinsSinAlpha = Sin (-Alpha);
+  TColStd_Array2OfReal TrsfI (0, 3, 0, 3);
+  TColStd_Array2OfReal TrsfX (0, 3, 0, 3);
+  TColStd_Array2OfReal TrsfY (0, 3, 0, 3);
+  TColStd_Array2OfReal TrsfZ (0, 3, 0, 3);
+  TColStd_Array2OfReal Trsfx (0, 3, 0, 3);
+  TColStd_Array2OfReal Trsfy (0, 3, 0, 3);
+  TColStd_Array2OfReal Trsfz (0, 3, 0, 3);
+  Standard_Integer i,j;
+  for (i=0; i<=3; i++)
+    for (j=0; j<=3; j++)
+      if (i == j) { 
+       TrsfX.SetValue (i, j, 1.0);
+       TrsfY.SetValue (i, j, 1.0);
+       TrsfZ.SetValue (i, j, 1.0);
+       Trsfx.SetValue (i, j, 1.0);
+       Trsfy.SetValue (i, j, 1.0);
+       Trsfz.SetValue (i, j, 1.0);
+       TrsfI.SetValue (i, j, 1.0);
+      } else { 
+       TrsfX.SetValue (i, j, 0.0);
+       TrsfY.SetValue (i, j, 0.0);
+       TrsfZ.SetValue (i, j, 0.0);
+       Trsfx.SetValue (i, j, 0.0);
+       Trsfy.SetValue (i, j, 0.0);
+       Trsfz.SetValue (i, j, 0.0);
+       TrsfI.SetValue (i, j, 0.0);
+      }
+       
+  // Rotation Alpha autour de l'axe X
+  TrsfX.SetValue (1, 1, CosAlpha);
+  TrsfX.SetValue (2, 2, CosAlpha);
+  TrsfX.SetValue (1, 2, -SinAlpha);
+  TrsfX.SetValue (2, 1, SinAlpha);
+  
+  // Rotation Alpha autour de l'axe Y
+  TrsfY.SetValue (0, 0, CosAlpha);
+  TrsfY.SetValue (2, 2, CosAlpha);
+  TrsfY.SetValue (0, 2, SinAlpha);
+  TrsfY.SetValue (2, 0, -SinAlpha);
+  
+  // Rotation Alpha autour de l'axe Z
+  TrsfZ.SetValue (0, 0, CosAlpha);
+  TrsfZ.SetValue (1, 1, CosAlpha);
+  TrsfZ.SetValue (0, 1, -SinAlpha);
+  TrsfZ.SetValue (1, 0, SinAlpha);
+  
+  // Rotation -Alpha autour de l'axe X
+  Trsfx.SetValue (1, 1, MoinsCosAlpha);
+  Trsfx.SetValue (2, 2, MoinsCosAlpha);
+  Trsfx.SetValue (1, 2, -MoinsSinAlpha);
+  Trsfx.SetValue (2, 1, MoinsSinAlpha);
+  
+  // Rotation -Alpha autour de l'axe Y
+  Trsfy.SetValue (0, 0, MoinsCosAlpha);
+  Trsfy.SetValue (2, 2, MoinsCosAlpha);
+  Trsfy.SetValue (0, 2, MoinsSinAlpha);
+       Trsfy.SetValue (2, 0, -MoinsSinAlpha);
+  
+  // Rotation -Alpha autour de l'axe Z
+  Trsfz.SetValue (0, 0, MoinsCosAlpha);
+  Trsfz.SetValue (1, 1, MoinsCosAlpha);
+  Trsfz.SetValue (0, 1, -MoinsSinAlpha);
+  Trsfz.SetValue (1, 0, MoinsSinAlpha);
+  
+  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
+  
+  myV3dView->SetAnimationMode(Standard_True,Standard_True);
+  myAISContext-> SetDegenerateModel((Aspect_TypeOfDegenerateModel) atoi(argv[1]),atof(argv[2]));
+  
+//               Timer.Reset ();
+//               Timer.Start ();
+  myV3dView->SetAnimationModeOn();
+  myV3dView->SetComputedMode ( Standard_False );
+  for (i=0;i<40;i++) {
+    myV3dView->View()->SetTransform (Trsfz);
+    myV3dView->View()->Update ();
+  }
+  myV3dView->SetAnimationModeOff();
+//               Timer.Stop ();
+//               Timer.Show (cout);   
+
+  return 0;
+}
+
+static Standard_Integer  OCC162 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 2 ) {
+    di << "Usage : " << argv[0] << " name" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+  if (aShape.IsNull()) return 0;
+
+  Standard_Real tolValue = 0.0001;
+  BRepOffsetAPI_Sewing sew(tolValue);
+  sew.Add(aShape);
+  sew.Perform();
+  TopoDS_Shape aSewed = sew.SewedShape();
+  
+  return 0;    
+}
+
+static Standard_Integer  OCC172 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  
+  AIS_ListOfInteractive aListOfIO;
+  aContext->DisplayedObjects(aListOfIO);
+  AIS_ListIteratorOfListOfInteractive It;
+  for (It.Initialize(aListOfIO);It.More();It.Next())
+    {
+      aContext->AddOrRemoveCurrentObject(It.Value());
+    }
+  
+  return 0;    
+}
+
+static Standard_Integer  OCC204 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 2 ) {
+    di << "Usage : " << argv[0] << " updateviewer=0/1" << "\n";
+    return 1;
+  }
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if (aContext.IsNull()) { 
+    di << "use 'vinit' command before " << argv[0] << "\n";
+    return 1;
+  }
+  Standard_Boolean UpdateViewer = Standard_True;
+  Standard_Integer IntegerUpdateViewer = atoi(argv[1]);
+  if (IntegerUpdateViewer == 0) {
+    UpdateViewer = Standard_False;
+  }
+
+  Standard_Integer deltaY = -500;
+  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0 + deltaY, 0),  gp_Pnt(100, 100 + deltaY, 100));
+  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120 + deltaY, 120),  gp_Pnt(300, 300 + deltaY,300));
+  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320 + deltaY, 320),  gp_Pnt(500, 500 + deltaY,500));
+
+  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
+  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
+  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
+
+  aContext->Display(ais1);
+  aContext->Display(ais2);
+  aContext->Display(ais3);
+
+  aContext->AddOrRemoveCurrentObject(ais1);
+  aContext->AddOrRemoveCurrentObject(ais2);
+  aContext->AddOrRemoveCurrentObject(ais3);
+
+  //printf("\n No of currents = %d", aContext->NbCurrents());
+
+  aContext->InitCurrent();
+  
+  //int count = 1;
+  while(aContext->MoreCurrent())
+  {
+    //printf("\n count is = %d",  count++);
+    Handle_AIS_InteractiveObject ais = aContext->Current();
+    aContext->Remove(ais, UpdateViewer);
+    aContext->InitCurrent();
+  }
+  
+  return 0;    
+}
+
+#include <gp_Lin.hxx>
+#include <BRepClass3d_Intersector3d.hxx>
+#include <TopoDS.hxx>
+static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+  if ( argc != 8 ) {
+    di << "Usage : " << argv[0] << " Shape PntX PntY PntZ DirX DirY DirZ" << "\n";
+    return 1;
+  }
+
+  TopoDS_Shape aShape = DBRep::Get(argv[1]);
+  if (aShape.IsNull()) return 0;
+
+  gp_Pnt aP1(atof(argv[2]), atof(argv[3]), atof(argv[4]));
+  gp_Dir aD1(atof(argv[5]), atof(argv[6]), atof(argv[7]));
+  gp_Lin aL1(aP1,aD1);
+  BRepClass3d_Intersector3d aI1;
+  aI1.Perform(aL1, -250, 1e-7, TopoDS::Face(aShape));
+  if(aI1.IsDone() && aI1.HasAPoint()) {
+    gp_Pnt aR1 = aI1.Pnt();
+    di << aR1.X() << " " << aR1.Y() << " " << aR1.Z() << "\n";
+  }
+
+  return 0;
+}
+
+void QABugs::Commands_8(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add("BUC60753", "BUC60753 mode ratio", __FILE__, BUC60753, group);
+  theCommands.Add("OCC162", "OCC162 name", __FILE__, OCC162, group);
+  theCommands.Add("OCC172", "OCC172", __FILE__, OCC172, group);
+  theCommands.Add("OCC204", "OCC204 updateviewer=0/1", __FILE__, OCC204, group);
+  theCommands.Add("OCC1651", "OCC1651 Shape PntX PntY PntZ DirX DirY DirZ", __FILE__, OCC1651, group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_9.cxx b/src/QABugs/QABugs_9.cxx
new file mode 100644 (file)
index 0000000..27a754e
--- /dev/null
@@ -0,0 +1,160 @@
+// Created on: 2002-03-18
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs.hxx>
+
+#include <Draw_Interpretor.hxx>
+#include <DBRep.hxx>
+#include <DrawTrSurf.hxx>
+#include <AIS_InteractiveContext.hxx>
+#include <ViewerTest.hxx>
+#include <AIS_Shape.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <gp_Ax2.hxx>
+#include <gp_Pnt.hxx>
+#include <Geom_RectangularTrimmedSurface.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
+#include <GC_MakeTrimmedCone.hxx>
+
+static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** argv)
+{
+  gp_Ax2  Cone_Ax;
+  double R1=8, R2=16, H1=20, H2=40, angle;
+  gp_Pnt P0(0,0,0), P1(0,0,20), P2(0,0,45);
+  angle = 2*M_PI;
+
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) {
+    di << "Use vinit command before " << argv[0] << "\n";
+    return 1;
+  }
+
+  Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
+  TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
+  DBRep::Set("BUC60857_BLUE",myshape);
+  Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
+  aContext->Display(ais1);
+  aContext->SetColor(ais1, Quantity_NOC_BLUE1);
+
+  Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value();
+  TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
+  DBRep::Set("BUC60857_RED",myshape2);
+  Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
+  aContext->Display(ais2);
+  aContext->SetColor(ais2, Quantity_NOC_RED);
+
+  Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value();
+  TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape();
+  DBRep::Set("BUC60857_GREEN",myshape3);
+  Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3);
+  aContext->Display(ais3);
+  aContext->SetColor(ais3, Quantity_NOC_GREEN);
+
+  return 0;
+}
+
+#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
+#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <StdSelect_BRepOwner.hxx>
+#include <SelectBasics_SensitiveEntity.hxx>
+#if ! defined(WNT)
+extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#else
+Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
+#endif
+
+static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) {
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  if ( argc < 2 || argc > 3) {
+    di << "ERROR : Usage : " << argv[0] << " highlight_mode [shape]" << "\n";
+    return 1;
+  }
+  
+  ViewerTest_DoubleMapOfInteractiveAndName aMap ;
+  if(argc != 3) {
+    aMap.Assign(GetMapOfAIS());
+  } else {
+    ViewerTest_DoubleMapOfInteractiveAndName& aMap1 = GetMapOfAIS();
+    TCollection_AsciiString aName(argv[2]);
+    Handle(AIS_InteractiveObject) AISObj;
+    if(!aMap1.IsBound2(aName)) {
+      di << "Use 'vdisplay' before" << "\n";
+      return 1;
+    } else {
+      AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap1.Find2(aName));
+      if(AISObj.IsNull()){
+        di << argv[2] << " : No interactive object" << "\n";
+        return 1;
+      }
+      aMap.Bind(AISObj,aName);
+    }
+  }
+  ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
+  while ( it.More() ) {
+    Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1());
+    AISObj->SetHilightMode(atoi(argv[1]));
+    if(AISObj->HasSelection(4)) {
+      //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
+      const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
+      if(!aSelection.IsNull()) {
+        for(aSelection->Init();aSelection->More();aSelection->Next()) {
+          Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->OwnerId());
+          aO->SetHilightMode(atoi(argv[1]));
+        }
+      }
+    }
+    it.Next();
+  }
+  
+  return 0;
+}
+
+static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
+{
+  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
+  if(aContext.IsNull()) {
+    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
+    return 1;
+  }
+  if ( argc != 1 && argc != 2) {
+    di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]" << "\n";
+    return 1;
+  }
+  aContext->SetZDetection(((argc == 1 || (argc == 2 && atoi(argv[1]) == 1)) ? Standard_True : Standard_False));
+  return 0;
+}
+
+void QABugs::Commands_9(Draw_Interpretor& theCommands) {
+  char *group = "QABugs";
+
+  theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
+  theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
+  theCommands.Add("OCC137_z","OCC137_z [ZDetection_mode]",__FILE__,OCC137_z,group);
+
+  return;
+}
diff --git a/src/QABugs/QABugs_CMPLRS.edl b/src/QABugs/QABugs_CMPLRS.edl
new file mode 100644 (file)
index 0000000..423049f
--- /dev/null
@@ -0,0 +1,29 @@
+-- Created on: 2002-04-11
+-- Created by: QA Admin
+-- Copyright (c) 2002-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+@ifnotdefined ( %QACADCAM_CMPLRS_EDL) then
+@set %QACADCAM_CMPLRS_EDL = "";
+
+@uses "CSF.edl";
+@ifdefined( %CSF_TCL_INCLUDE ) then
+@string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE %CMPLRS_CXX_Options ;
+@endif;
+
+@endif;
diff --git a/src/QABugs/QABugs_MyText.cdl b/src/QABugs/QABugs_MyText.cdl
new file mode 100644 (file)
index 0000000..fe2a392
--- /dev/null
@@ -0,0 +1,55 @@
+-- Created on: 2002-04-10
+-- Created by: QA Admin
+-- Copyright (c) 2002-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+class  MyText  from  QABugs  inherits  InteractiveObject  from  AIS 
+uses 
+    ExtendedString from TCollection, 
+    Pnt from gp, 
+    PresentationManager3d from PrsMgr, 
+    Presentation from Prs3d,
+    NameOfColor  from  Quantity,
+    Selection from SelectMgr
+is 
+    Create(aText  :ExtendedString  from  TCollection;aPosition  : Pnt  from  gp)
+    returns mutable MyText from QABugs;
+    Create(aText  :ExtendedString  from  TCollection;aPosition  : Pnt  from  gp;aFont :  CString from Standard; aColor : NameOfColor  from  Quantity; aHeight :Real  from  Standard)
+    returns mutable MyText from QABugs;
+
+    NbPossibleSelection(me)
+    returns Integer from Standard
+    is redefined virtual protected;
+    
+    Compute(me:mutable;
+            aPresentationManager: PresentationManager3d from PrsMgr;
+            aPresentation: mutable Presentation from Prs3d;
+            aMode: Integer from Standard = 0)
+    is redefined virtual protected;
+
+    ComputeSelection(me:mutable; aSelection :mutable Selection from SelectMgr;
+                                 aMode      : Integer) is redefined virtual protected;
+
+fields
+        myPosition                   : Pnt from gp;
+        myText                       : ExtendedString from TCollection;
+        myNameOfColor                : NameOfColor from Quantity;
+        myNameOfFont                 : CString from Standard;
+        myHeight                     : Real from Standard;
+end MyText;
+    
diff --git a/src/QABugs/QABugs_MyText.cxx b/src/QABugs/QABugs_MyText.cxx
new file mode 100644 (file)
index 0000000..b69452a
--- /dev/null
@@ -0,0 +1,92 @@
+// Created on: 2002-04-10
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs_MyText.ixx>
+#include <QABugs_MyText.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_TextAspect.hxx>
+#include <AIS_Drawer.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <Prs3d_Text.hxx>
+#include <Select3D_SensitiveBox.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Graphic3d_NameOfFont.hxx>
+
+/*************************************************************************
+*
+* CONSTRUCTION/DESTRUCTION
+*
+**************************************************************************/
+
+
+QABugs_MyText::QABugs_MyText(const TCollection_ExtendedString& aText, const gp_Pnt& aPosition, 
+                               const Standard_CString aFont, const Quantity_NameOfColor aColor, const Standard_Real aHeight)
+{
+  myPosition = aPosition;
+  myText = TCollection_ExtendedString(aText);
+  myNameOfFont = aFont;
+  myNameOfColor = aColor;
+  myHeight = aHeight;
+}
+
+
+/*************************************************************************
+*
+* QUERY METHODS
+*
+**************************************************************************/
+
+void QABugs_MyText::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
+                             const Handle(Prs3d_Presentation)& aPresentation,
+                             const Standard_Integer aMode ) 
+{
+  aPresentation->Clear();
+  Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
+
+  asp->SetFont(myNameOfFont);
+  asp->SetColor(myNameOfColor);
+  asp->SetHeight(myHeight); // I am changing the myHeight value
+  Prs3d_Text::Draw(aPresentation, asp, myText, myPosition);
+}
+
+void QABugs_MyText::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                      const Standard_Integer aMode)
+{
+  // This code is here to compute the selection, erase this code if you don't what selection.
+
+  Handle( SelectMgr_EntityOwner ) own = new SelectMgr_EntityOwner(this, 7);
+
+  Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox(own,
+    myPosition.X(), 
+    myPosition.Y(),
+    myPosition.Z(), 
+    myPosition.X() + 20,
+    myPosition.Y() + 20,
+    myPosition.Z() + 20);
+  aSelection->Add(box);
+}
+
+
+Standard_Integer QABugs_MyText::NbPossibleSelection() const
+{
+  return 1;
+}
+
diff --git a/src/QABugs/QABugs_PresentableObject.cdl b/src/QABugs/QABugs_PresentableObject.cdl
new file mode 100644 (file)
index 0000000..c04bb2c
--- /dev/null
@@ -0,0 +1,41 @@
+-- Created on: 2002-04-09
+-- Created by: QA Admin
+-- Copyright (c) 2002-2012 OPEN CASCADE SAS
+--
+-- The content of this file is subject to the Open CASCADE Technology Public
+-- License Version 6.5 (the "License"). You may not use the content of this file
+-- except in compliance with the License. Please obtain a copy of the License
+-- at http://www.opencascade.org and read it completely before using this file.
+--
+-- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+-- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+--
+-- The Original Code and all software distributed under the License is
+-- distributed on an "AS IS" basis, without warranty of any kind, and the
+-- Initial Developer hereby disclaims all such warranties, including without
+-- limitation, any warranties of merchantability, fitness for a particular
+-- purpose or non-infringement. Please see the License for the specific terms
+-- and conditions governing the rights and limitations under the License.
+
+
+class PresentableObject from QABugs inherits InteractiveObject from AIS
+uses
+    Selection from SelectMgr,
+    PresentationManager3d from PrsMgr,
+    Presentation from Prs3d,
+    TypeOfPresentation3d from PrsMgr
+is
+    
+    Create(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView) returns mutable PresentableObject from QABugs;
+    
+    ComputeSelection(me:mutable; aSelection :mutable Selection from SelectMgr;
+                                 aMode      : Integer) is redefined virtual protected;
+
+    Compute(me:mutable;
+           aPresentationManager: PresentationManager3d from PrsMgr;
+            aPresentation: mutable Presentation from Prs3d;
+            aMode: Integer from Standard = 0)
+    is redefined virtual protected;
+           
+end PresentableObject;
+    
diff --git a/src/QABugs/QABugs_PresentableObject.cxx b/src/QABugs/QABugs_PresentableObject.cxx
new file mode 100644 (file)
index 0000000..ece8d5d
--- /dev/null
@@ -0,0 +1,113 @@
+// Created on: 2002-04-09
+// Created by: QA Admin
+// Copyright (c) 2002-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
+
+
+#include <QABugs_PresentableObject.ixx>
+#include <QABugs_PresentableObject.hxx>
+
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_MaterialAspect.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Aspect_Array1OfEdge.hxx>
+#include <Graphic3d_VertexC.hxx>
+#include <Graphic3d_VertexNC.hxx>
+#include <Graphic3d_Array1OfVertexC.hxx>
+#include <Graphic3d_Array1OfVertexNC.hxx>
+#include <AIS_Drawer.hxx>
+
+QABugs_PresentableObject::QABugs_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
+     :AIS_InteractiveObject(aTypeOfPresentation3d)
+{
+}
+
+void QABugs_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
+                               const Handle(Prs3d_Presentation)& aPresentation,
+                               const Standard_Integer aMode )
+{
+  Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
+  Handle(Graphic3d_Group) theGroup= new  Graphic3d_Group(theStructure);
+  Handle_Prs3d_ShadingAspect theAspect = myDrawer->ShadingAspect();
+  Graphic3d_MaterialAspect mat = theAspect->Aspect()->FrontMaterial();
+  mat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
+  mat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
+  mat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
+  mat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
+  theAspect->SetMaterial(mat);
+  theGroup->SetPrimitivesAspect(theAspect->Aspect());
+  
+  Aspect_Array1OfEdge aListEdge(1, 3);
+  aListEdge.SetValue(1, Aspect_Edge(1, 2, Aspect_TOE_VISIBLE));
+  aListEdge.SetValue(2, Aspect_Edge(2, 3, Aspect_TOE_VISIBLE));
+  aListEdge.SetValue(3, Aspect_Edge(3, 1, Aspect_TOE_VISIBLE));
+  theGroup->BeginPrimitives();
+
+  switch (aMode) 
+    {
+    case 0://using VertexC
+      {
+       Graphic3d_Array1OfVertexC theArray1(1, 3);
+
+       theArray1.SetValue(1, Graphic3d_VertexC(0,0,0,Quantity_NOC_RED));
+       theArray1.SetValue(2, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
+       theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
+       theGroup->TriangleSet(theArray1, aListEdge);
+       
+       theArray1.SetValue(1, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
+       theArray1.SetValue(2, Graphic3d_VertexC(5,5,-1,Quantity_NOC_GREEN));
+       theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
+       theGroup->TriangleSet(theArray1, aListEdge);
+      }
+      break;
+    case 1://using VertexNC
+      {
+       Graphic3d_Array1OfVertexNC theArray1(1, 3);
+       
+       theArray1.SetValue(1, Graphic3d_VertexNC(5,0,0, //coord
+                                                0,0,1, //normal
+                                                Quantity_NOC_RED));
+       theArray1.SetValue(2, Graphic3d_VertexNC(5,5,1, //coord
+                                                1,1,1, //normal
+                                                Quantity_NOC_BLUE1));
+       theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
+                                                0,1,1,  //normal
+                                                Quantity_NOC_YELLOW));
+       theGroup->TriangleSet(theArray1, aListEdge);
+       
+       theArray1.SetValue(1, Graphic3d_VertexNC(5,5,1, //coord
+                                                1,1,1, //normal
+                                                Quantity_NOC_BLUE1));
+       theArray1.SetValue(2, Graphic3d_VertexNC(10,5,-1, //coord
+                                                0,0,-1,  //normal
+                                                Quantity_NOC_GREEN));
+       theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
+                                                0,1,1,  //normal
+                                                Quantity_NOC_YELLOW));
+       theGroup->TriangleSet(theArray1, aListEdge);
+      }
+      break;
+    }
+  theGroup->EndPrimitives();
+  
+}
+
+void QABugs_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                        const Standard_Integer aMode) {
+}
diff --git a/src/QACADCAM/FILES b/src/QACADCAM/FILES
deleted file mode 100755 (executable)
index ad1075a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-QACADCAM.cdl
-QACADCAM.cxx
-QACADCAM_CMPLRS.edl
diff --git a/src/QACADCAM/QACADCAM.cdl b/src/QACADCAM/QACADCAM.cdl
deleted file mode 100755 (executable)
index 62d727b..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-03-19
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QACADCAM
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QACADCAM/QACADCAM.cxx b/src/QACADCAM/QACADCAM.cxx
deleted file mode 100755 (executable)
index 594efde..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-// Created on: 2002-03-19
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QACADCAM.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <AIS_Drawer.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-
-//#include <AcisData_AcisModel.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-
-#include <tcl.h>
-
-static Standard_Integer BUC60738 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  
-  TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(gp_Pnt(-40,0,0),20).Shape();
-  Handle_AIS_Shape theAISShape = new AIS_Shape(theSphere);
-
-  //display mode = Shading
-  theAISShape->SetDisplayMode(1);
-       
-  //get the drawer
-  Handle_AIS_Drawer theDrawer = theAISShape->Attributes();
-  Handle_Prs3d_ShadingAspect theShadingAspect = theDrawer->ShadingAspect();
-  Handle_Graphic3d_AspectFillArea3d theAspectFillArea3d = theShadingAspect->Aspect();
-       
-  //allow to display the edges
-  theAspectFillArea3d->SetEdgeOn();
-  //set the style to Dash
-
-  //but the style is not set to dash : it is always solid
-  theAspectFillArea3d->SetEdgeLineType (Aspect_TOL_DASH); 
-  theAspectFillArea3d->SetEdgeColor(Quantity_Color(Quantity_NOC_GREEN)); 
-  theAspectFillArea3d->SetInteriorStyle(Aspect_IS_EMPTY);
-  theShadingAspect->SetAspect(theAspectFillArea3d);
-  theDrawer->SetShadingAspect(theShadingAspect);
-  theAISShape->SetAttributes(theDrawer);
-
-  aContext->Display(theAISShape);  
-  
-  return 0;
-}
-
-static int BUC60606(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-
-  di << "Use satread command instead of " << argv[0] << "\n";
-  return -1;
-
-  if(argc!=3) {
-    di << "Usage : " << argv[0] << "name filename" << "\n";
-    return -1;
-  }
-//   Handle_AcisData_AcisModel satModel = new AcisData_AcisModel(); 
-//   Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-
-//   Standard_Character  *filename = new Standard_Character [strlen(DD)+strlen(argv[2])+1];
-//   sprintf(filename,"%s/%s",DD,argv[2]);
-
-//   satModel->ReadSaveFile(filename);
-  
-//   Standard_Boolean success = !satModel.IsNull(); 
-//   cout << "n<-- SAT model read : " << (success?"true":"false") << endl << flush; 
-//   if ( success ) {
-//     Standard_Character *Ch=new Standard_Character [strlen(argv[1])+3];
-//     Handle_TopTools_HSequenceOfShape satShapes = satModel->GetShapes();
-//     Standard_Integer nbs=satShapes->Length();
-//     for(Standard_Integer i=1;i<=nbs;i++) {
-//       TopoDS_Shape xShape = satShapes->Value(i);
-//       if(!xShape.IsNull()) {
-//     sprintf(Ch,"%s_%i",argv[1],i);
-//     DBRep::Set(Ch,xShape);
-//       } else cout << "The shape " << argv[1] << "_" << i << " is NULL !" << endl;
-//     }
-//   }
-  
-
-  return 0;
-}
-
-static int BUC60627(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  di << "Use satread command instead of " << argv[0] << "\n";
-  return -1;
-
-  // perform the conversion
-  // as in AcisData.cdl --- that's alright
-//   if(argc!=3) {
-//     cerr << "Usage : " << argv[0] << " BREP file" << endl;
-//     return -1;
-//   }
-//   TopoDS_Shape shapeModel=DBRep::Get(argv[1]);
-//   Handle(AcisData_AcisModel) satModel = new AcisData_AcisModel();
-//   satModel->AddShape( shapeModel ); // memorizes "kegel2.brep"
-//   Standard_CString stringData;
-//   Standard_Integer nbChar; // write intermediate stringin order to compute ACIS data
-//   satModel->WriteStringData( stringData, nbChar );
-//   if ( satModel->IsDone() ) {
-//     satModel = new AcisData_AcisModel();
-//     satModel->ReadStringData( stringData );
-//     if ( satModel->IsDone() ) {
-//       // write into file
-//       satModel->WriteSaveFile( argv[2] );
-//       if ( ! satModel->IsDone() ) {
-//     cout << "The SAT madel does not wroute."   << endl;
-//       }
-//     } else cout << "The SAT model does not read from a string."   << endl;
-//     // satModel->ReadStringData( stringData );
-//   } else cout << "The SAT model does not wroute into a string."   << endl;
-//   // satModel->WriteStringData( stringData, nbChar );
-  return 1;
-}
-
-void QACADCAM::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QACADCAM";
-
-  theCommands.Add("BUC60738","BUC60738",__FILE__,BUC60738,group);
-  theCommands.Add("BUC60606","BUC60606 name",__FILE__,BUC60606,group);
-  theCommands.Add("BUC60627","BUC60627 name",__FILE__,BUC60627,group);
-  
-  return;
-}
diff --git a/src/QACADCAM/QACADCAM_CMPLRS.edl b/src/QACADCAM/QACADCAM_CMPLRS.edl
deleted file mode 100755 (executable)
index 423049f..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
--- Created on: 2002-04-11
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-@ifnotdefined ( %QACADCAM_CMPLRS_EDL) then
-@set %QACADCAM_CMPLRS_EDL = "";
-
-@uses "CSF.edl";
-@ifdefined( %CSF_TCL_INCLUDE ) then
-@string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE %CMPLRS_CXX_Options ;
-@endif;
-
-@endif;
diff --git a/src/QACEADRT/QACEADRT.cdl b/src/QACEADRT/QACEADRT.cdl
deleted file mode 100755 (executable)
index 5192cab..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2004-06-25
--- Created by: QA Admin
--- Copyright (c) 2004-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QACEADRT
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QACEADRT/QACEADRT.cxx b/src/QACEADRT/QACEADRT.cxx
deleted file mode 100755 (executable)
index 6e878e6..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// Created on: 2004-06-25
-// Created by: QA Admin (qa)
-// Copyright (c) 2004-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QACEADRT.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <Adaptor3d_HCurve.hxx>
-#include <Geom_Curve.hxx>
-#include <DrawTrSurf.hxx>
-#include <GeomAdaptor_HCurve.hxx>
-#include <TopoDS_Shape.hxx>
-#include <DBRep.hxx>
-#include <GeomAdaptor_HSurface.hxx>
-#include <BRepAdaptor_CompCurve.hxx>
-#include <TopoDS.hxx>
-#include <BRepAdaptor_HCompCurve.hxx>
-#include <IntCurveSurface_HInter.hxx>
-#include <IntCurveSurface_IntersectionPoint.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-static Standard_Integer OCC6001 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 4)
-  {
-    di<<"missing parameters"<<"\n";
-    return 1;
-  }
-  const char *name = argv[1];
-  Handle(Adaptor3d_HCurve) hcurve;
-  Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
-  if (!curve.IsNull())
-    hcurve = new GeomAdaptor_HCurve(curve);
-  else
-  {
-    TopoDS_Shape wire = DBRep::Get(argv[2]);
-    if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
-    {
-      di<<"incorrect 1st parameter, curve or wire expected"<<"\n";
-      return 1;
-    }
-    BRepAdaptor_CompCurve comp_curve(TopoDS::Wire(wire));
-    hcurve = new BRepAdaptor_HCompCurve(comp_curve);
-  }
-  Handle(Geom_Surface) surf = DrawTrSurf::GetSurface(argv[3]);
-  Handle(GeomAdaptor_HSurface) hsurf = new GeomAdaptor_HSurface(surf);
-  IntCurveSurface_HInter inter;
-  inter.Perform(hcurve, hsurf);
-  int nb = inter.NbPoints();
-  if (!inter.IsDone() || nb == 0)
-  {
-    di<<"no intersections";
-    return 0;
-  }
-  for (int i=1; i <= nb; i++)
-  {
-    const IntCurveSurface_IntersectionPoint &int_pnt = inter.Point(i);
-    double par = int_pnt.W();
-    gp_Pnt p = int_pnt.Pnt();
-    di<<"inter "<<i<<": W = "<<par<<"\n"
-      <<"\tpnt = "<<p.X()<<" "<<p.Y()<<" "<<p.Z()<<"\n";
-    char n[20], *pname=n;
-    sprintf(n,"%s_%d",name,i);
-    DrawTrSurf::Set(pname,p);
-  }
-
-  return 0;
-
-}
-
-static Standard_Integer OCC5696 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-  TopoDS_Edge edge = BRepBuilderAPI_MakeEdge(gp_Pnt(0,0,0),gp_Pnt(2,0,0));
-  TopoDS_Wire wire = BRepBuilderAPI_MakeWire(edge);
-  BRepAdaptor_CompCurve curve(wire);
-  Standard_Real first = curve.FirstParameter();
-  Standard_Real last = curve.LastParameter();
-  Standard_Real par = (first + last)/2;
-  Standard_Real par_edge;
-  TopoDS_Edge edge_found;
-  try {
-    OCC_CATCH_SIGNALS
-    curve.Edge(par,edge_found,par_edge);  // exception is here
-    di << "par_edge = " << par_edge << "\n";
-  }
-
-  catch (Standard_Failure) {di << "OCC5696 Exception \n" ;return 0;}
-
-  return 0;
-}
-
-void QACEADRT::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QACEADRT";
-
-  theCommands.Add ("OCC6001", "OCC6001 name curve/wire surface\n\t\tintersect curve by surface", 
-                   __FILE__, OCC6001, group);
-
-  theCommands.Add ("OCC5696", "OCC5696", 
-                   __FILE__, OCC5696, group);
-
-  return;
-}
index 6840f3b309ab44ff407c47fa45543ba936ac47d4..87d0aa10519494ecbb9258b528540c238089386c 100755 (executable)
 
 
 
+#include <QABugs.hxx>
 #include <QADraw.hxx>
-
-#include <QABRGM.hxx>
-#include <QACADCAM.hxx>
-#include <QAMitutoyoUK.hxx>
-#include <QAMitutoyoUS.hxx>
-#include <QAOCC.hxx>
-#include <QARina.hxx>
-#include <QARoutelous.hxx>
-#include <QASamtech.hxx>
-#include <QATelco.hxx>
-#include <QAUsinor.hxx>
-
 #include <QADNaming.hxx>
 //#if defined(WOKC40)
 //#include <QADBRepNaming.hxx>
 #include <QANewDBRepNaming.hxx>
 //#endif
 
-#include <QARicardo.hxx>
-#include <QAYasaki.hxx>
-#include <QAAlcatel.hxx>
-#include <QAInsynchro.hxx>
-#include <QANIC.hxx>
-#include <QABUC.hxx>
-#include <QAAMINO.hxx>
-#include <QAMARTEC.hxx>
-#include <QAQuickPen.hxx>
 #if defined(WOKC40)
 #include <QAViewer2dTest.hxx>
 #endif
 #include <QANCollection.hxx>
-#include <QACEADRT.hxx>
 
 void QADraw::AdditionalCommands(Draw_Interpretor& theCommands)
 {
-  QABRGM::Commands(theCommands);
-  QACADCAM::Commands(theCommands);
-  QAMitutoyoUK::Commands(theCommands);
-  QAMitutoyoUS::Commands(theCommands);
-  QAOCC::Commands(theCommands);
-  QARina::Commands(theCommands);
-  QARoutelous::Commands(theCommands);
-  QASamtech::Commands(theCommands);
-  QATelco::Commands(theCommands);
-  QAUsinor::Commands(theCommands);
+  QABugs::Commands(theCommands);
 
   QADNaming::AllCommands(theCommands);
 //#if defined(WOKC40)
@@ -74,20 +44,10 @@ void QADraw::AdditionalCommands(Draw_Interpretor& theCommands)
   QANewDBRepNaming::AllCommands(theCommands);
 //#endif
 
-  QARicardo::Commands(theCommands);
-  QAYasaki::Commands(theCommands);
-  QAAlcatel::Commands(theCommands);
-  QAInsynchro::Commands(theCommands);
-  QANIC::Commands(theCommands);
-  QABUC::Commands(theCommands);
-  QAAMINO::Commands(theCommands);
-  QAMARTEC::Commands(theCommands);
-  QAQuickPen::Commands(theCommands);
 #if defined(WOKC40)
   QAViewer2dTest::Commands(theCommands);
 #endif
   QANCollection::Commands(theCommands);
-  QACEADRT::Commands(theCommands);
 
   return;
 }
diff --git a/src/QAInsynchro/QAInsynchro.cdl b/src/QAInsynchro/QAInsynchro.cdl
deleted file mode 100755 (executable)
index 251dd4c..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-05-22
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAInsynchro
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAInsynchro/QAInsynchro.cxx b/src/QAInsynchro/QAInsynchro.cxx
deleted file mode 100755 (executable)
index 87f625f..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// Created on: 2002-05-22
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAInsynchro.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <V3d_Viewer.hxx>
-#include <V3d_View.hxx>
-#include <Graphic3d_AspectMarker3d.hxx>
-
-static Standard_Integer OCC281bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-    { 
-    cerr << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-    }
-  if(argc < 4) {
-    di << "Usage : " << argv[0] << " x y TypeOfMarker(0-12)" << "\n";
-    return 1;
-  }
-
-  Standard_Integer x,y,TypeOfMarker;
-  x = atoi(argv[1]);
-  y = atoi(argv[2]);
-  TypeOfMarker = atoi(argv[3]);
-  if( x <= 0) {
-    di << "Bad value x=" << x << "\n";
-    return 1;
-  }
-  if( y <= 0) {
-    di << "Bad value y=" << y << "\n";
-    return 1;
-  }
-  if( TypeOfMarker < 0 || TypeOfMarker > 12) {
-    di << "Bad value TypeOfMarker=" << TypeOfMarker << "\n";
-    return 1;
-  }
-  Aspect_TypeOfMarker AspectTypeOfMarker( (Aspect_TypeOfMarker) TypeOfMarker);
-  /*
-        enumeration TypeOfMarker is     TOM_POINT,
-                                        TOM_PLUS,
-                                        TOM_STAR,
-                                        TOM_O,
-                                        TOM_X,
-                                        TOM_O_POINT,
-                                        TOM_O_PLUS,
-                                        TOM_O_STAR,
-                                        TOM_O_X,
-                                        TOM_BALL,
-                                        TOM_RING1,
-                                        TOM_RING2,
-                                        TOM_RING3,
-                                        TOM_USERDEFINED 
-        end TypeOfMarker;
-        ---Purpose: Definition of types of markers
-        --
-        --          TOM_POINT   point   .
-        --          TOM_PLUS    plus    +
-        --          TOM_STAR    star    *
-        --          TOM_O       circle  O
-        --          TOM_X       cross   x
-        --          TOM_O_POINT a point in a circle
-        --          TOM_O_PLUS  a plus in a circle
-        --          TOM_O_STAR  a star in a circle
-        --          TOM_O_X     a cross in a circle
-        --          TOM_BALL    a ball with 1 color and different saturations
-        --          TOM_RING1   a large ring
-        --          TOM_RING2   a medium ring
-        --          TOM_RING3   a small ring
-        --          TOM_USERDEFINED     defined by Users
-        --
-        ---Category: Enumerations
-  */
-
-  Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
-  Handle(V3d_View) aView = ViewerTest::CurrentView();
-
-  aViewer->ActivateGrid(Aspect_GT_Rectangular, Aspect_GDM_Lines);
-  Handle(Graphic3d_AspectMarker3d) GridAsp = new Graphic3d_AspectMarker3d(AspectTypeOfMarker, Quantity_NOC_BLUE1, 10.);
-  aViewer->SetGridEcho(GridAsp);
-
-  if (aViewer->IsActive()) {
-    if (aViewer->GridEcho()) {
-      V3d_Coordinate X,Y,Z;
-      aView->ConvertToGrid(x,y,X,Y,Z);
-    } else {
-      di << "NOT aViewer->GridEcho()" << "\n";
-      return 1;
-    }
-  } else {
-    di << "NOT aViewer->IsActive()" << "\n";
-    return 1;
-  }
-  return 0;
-}
-
-void QAInsynchro::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAInsynchro";
-
-  theCommands.Add ("OCC281", "OCC281 x y TypeOfMarker(0-12)", __FILE__, OCC281bug, group);
-
-  return;
-}
diff --git a/src/QAMARTEC/QAMARTEC.cdl b/src/QAMARTEC/QAMARTEC.cdl
deleted file mode 100755 (executable)
index 59b8805..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-10-11
--- Created by: Michael KUZMITCHEV
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAMARTEC
-     uses Draw
-is
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAMARTEC/QAMARTEC.cxx b/src/QAMARTEC/QAMARTEC.cxx
deleted file mode 100755 (executable)
index 4440d79..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-// Created on: 2002-10-11
-// Created by: Michael KUZMITCHEV
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAMARTEC.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <TColgp_Array1OfPnt.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomAPI_ExtremaCurveCurve.hxx>
-
-const Standard_Integer Glob_NbPoles = 195;
-const Standard_Real Glob_Poles[Glob_NbPoles][3] = 
-{
-   { 60000, 31.937047503393231, 799.36226142892554 },
-   { 60000.000000027772, 16.712487623992825, 799.97053069028755 },
-   { 59999.999999875639, 7.3723603687660546, 799.97042131653711 },
-   { 60000.000000331296, 1.2070383839533065, 799.90534456032105 },
-   { 59999.999999361171, -2.5807810139032785, 799.77442818789041 },
-   { 60000.000000952597, -4.7405254527655112, 799.70146419719595 },
-   { 59999.999998867599, -5.3922917628932563, 799.62943054158143 },
-   { 60000.000001091154, -5.1399175234965044, 799.63364074172011 },
-   { 59999.999999142601, -3.6992503431468067, 799.67179299415568 },
-   { 60000.000000546061, -1.6910663098148713, 799.76799688166773 },
-   { 59999.999999725333, 1.1886267067330731, 799.91818018455035 },
-   { 60000.000000101914, 4.5979596894282677, 800.11782874041273 },
-   { 59999.999999977204, 8.5921385739756673, 800.36980220999453 },
-   { 60000.000000018619, 16.600658956791417, 800.90755378048414 },
-   { 59999.999999985768, 26.040687605616604, 801.59827916977554 },
-   { 60000.000000052918, 30.448324872994441, 801.9310695501531 },
-   { 59999.999999883308, 35.089921752286457, 802.29194004854389 },
-   { 60000.000000186978, 39.947755013962528, 802.68007678107051 },
-   { 59999.99999976845, 45.005892525213071, 803.09465896567826 },
-   { 60000.000000227068, 50.249778854659326, 803.53486876081706 },
-   { 59999.999999821659, 55.665932960782108, 803.9998957687626 },
-   { 60000.000000112479, 61.241734208767859, 804.48893829648762 },
-   { 59999.999999943684, 66.965272918611916, 805.00120177704798 },
-   { 60000.000000021486, 72.8252416954995, 805.53589657709654 },
-   { 59999.99999999431, 78.810843745189473, 806.09223572876306 },
-   { 60000.000000004045, 87.962119756404547, 806.95803383418911 },
-   { 59999.99999999725, 97.349976765262795, 807.869010426567 },
-   { 60000.000000017491, 100.50428991828356, 808.17759139897635 },
-   { 59999.99999994829, 103.68239055379394, 808.49099684342912 },
-   { 60000.000000105072, 106.88305649144334, 808.80912918631941 },
-   { 59999.999999835563, 110.10508187457555, 809.13189073948308 },
-   { 60000.000000207947, 113.34727572158297, 809.45918381767103 },
-   { 59999.999999784653, 116.60846040037053, 809.79091039912782 },
-   { 60000.000000180742, 119.88747020406682, 810.12697237079749 },
-   { 59999.999999880296, 123.18314981484644, 810.46727114678265 },
-   { 60000.000000059626, 126.49435287223255, 810.81170785335109 },
-   { 59999.999999979838, 129.81994045902351, 811.16018308253979 },
-   { 60000.000000015229, 134.8281992328765, 811.68880383859914 },
-   { 59999.99999998945, 139.86373510893441, 812.2260602582727 },
-   { 60000.000000059066, 141.54513692067022, 812.40609267860532 },
-   { 59999.999999845008, 143.22928798266199, 812.58705944070834 },
-   { 60000.000000278043, 144.91604799540772, 812.7689478797023 },
-   { 59999.999999621934, 146.60527693312631, 812.95174532592102 },
-   { 60000.000000407505, 148.29683501034282, 813.13543899059755 },
-   { 59999.999999644526, 149.99058265886663, 813.32001613307352 },
-   { 60000.000000252723, 151.68638048575326, 813.5054638442823 },
-   { 59999.999999853622, 153.38408925794459, 813.69176926621947 },
-   { 60000.000000068765, 155.08356985703421, 813.87891939578799 },
-   { 59999.999999973967, 156.7846832610312, 814.06690122038856 },
-   { 60000.00000002468, 159.33859412935516, 814.35010184114628 },
-   { 59999.999999977736, 161.89555354531564, 814.63511466528189 },
-   { 60000.000000145039, 162.74819471256941, 814.73031865086841 },
-   { 59999.999999608634, 163.60113987644607, 814.82572069112655 },
-   { 60000.000000709108, 164.45437167903589, 814.92131914784375 },
-   { 59999.999999031643, 165.3078727497936, 815.0171123286641 },
-   { 60000.000001042623, 166.16162573916125, 815.11309861889924 },
-   { 59999.999999097396, 167.01561326831904, 815.20927628960794 },
-   { 60000.000000630716, 167.86981798631649, 815.30564372626975 },
-   { 59999.999999648215, 168.72422251240596, 815.40219920078994 },
-   { 60000.000000151289, 169.57880948189478, 815.4989410625825 },
-   { 59999.999999954052, 170.43356151298337, 815.5958676029403 },
-   { 60000.000000034408, 171.71591108030151, 815.74153190228753 },
-   { 59999.999999976135, 172.9985538007256, 815.88760410128577 },
-   { 60000.000000129759, 173.42613177350728, 815.93633994702668 },
-   { 59999.999999664251, 173.85373796967124, 815.98512067846866 },
-   { 60000.00000060827, 174.28137021936112, 816.03394612011459 },
-   { 59999.99999914426, 174.70902633885802, 816.08281598496671 },
-   { 60000.000000969369, 175.13670416564241, 816.13173017155248 },
-   { 59999.999999107844, 175.56440150794049, 816.18068832455049 },
-   { 60000.00000066567, 175.9921162052986, 816.22969037578832 },
-   { 59999.999999602165, 176.41984606692156, 816.27873598355484 },
-   { 60000.00000018561, 176.84758892491178, 816.3278250228899 },
-   { 59999.999999935775, 177.27534259516338, 816.37695722529566 },
-   { 60000.000000054533, 177.91698605475608, 816.45071998561696 },
-   { 59999.999999955864, 178.55864403901305, 816.52457892469988 },
-   { 60000.000000281914, 178.7725313764083, 816.54920923644852 },
-   { 59999.999999214248, 178.98641977813006, 816.57385016025694 },
-   { 60000.000001492997, 179.20030898752373, 816.59850173903158 },
-   { 59999.999997853804, 179.41419870083473, 816.62316380941468 },
-   { 60000.000002424618, 179.62808869307457, 816.647836551757 },
-   { 59999.999997816361, 179.84197863289955, 816.6725196831527 },
-   { 60000.000001566797, 180.05586830671322, 816.69721343479125 },
-   { 59999.999999121159, 180.26975739282756, 816.72191756454924 },
-   { 60000.00000036486, 180.48364565146377, 816.74663219124841 },
-   { 59999.999999904954, 180.69753279192835, 816.7713572079532 },
-   { 60000.000000054562, 181.0183614269956, 816.8084603269557 },
-   { 59999.999999978463, 181.33918632988278, 816.84558675379014 },
-   { 60000.000000049782, 181.44612751539663, 816.85796481705847 },
-   { 59999.999999914071, 181.55306821881811, 816.87034546240886 },
-   { 60000.000000125139, 181.66000840292782, 816.88272868833144 },
-   { 59999.999999843392, 181.76694804030186, 816.89511449082431 },
-   { 60000.000000167289, 181.87388708628473, 816.90750286566583 },
-   { 59999.999999847467, 181.98082551962966, 816.9198938103757 },
-   { 60000.000000119864, 182.08776329350809, 816.93228732197861 },
-   { 59999.999999917491, 182.19470038386558, 816.94468339453306 },
-   { 60000.000000050633, 182.30163675019068, 816.9570820285785 },
-   { 59999.999999972366, 182.40857236133851, 816.96948321649302 },
-   { 60000.000000032509, 182.56897459276843, 816.98808882907122 },
-   { 59999.999999965934, 182.7293749693155, 817.00670017517837 },
-   { 60000.000000238462, 182.78284155215263, 817.01290459816312 },
-   { 59999.999999345615, 182.83630791626743, 817.01910964099045 },
-   { 60000.00000119608, 182.88977407140584, 817.02531535916364 },
-   { 59999.999998362182, 182.94323998619015, 817.03152164472851 },
-   { 60000.000001757064, 182.99670569682132, 817.03772865736005 },
-   { 59999.999998499035, 183.05017115047181, 817.04393620474377 },
-   { 60000.00000101691, 183.10363639052409, 817.05014447471717 },
-   { 59999.999999469313, 183.15710137432194, 817.05635331513508 },
-   { 60000.000000196254, 183.21056612270786, 817.06256282498509 },
-   { 59999.999999961823, 183.26403061846696, 817.06877295237007 },
-   { 60000.000000031148, 183.37095910597188, 817.0811944807366 },
-   { 59999.999999975873, 183.47788656385964, 817.09361853568328 },
-   { 60000.000000078871, 183.53291535756762, 817.10001332133618 },
-   { 59999.999999822408, 183.57465447580566, 817.10486251586156 },
-   { 60000.000000306398, 183.67093862701302, 817.11605868308925 },
-   { 59999.999999580868, 183.62493711493508, 817.11070057755603 },
-   { 60000.000000457883, 183.83983154073323, 817.13569840343439 },
-   { 59999.999999600586, 183.70298550843307, 817.11977179379392 },
-   { 60000.000000274122, 183.92091406059222, 817.14512405357789 },
-   { 59999.999999859414, 183.87191278066462, 817.13941945054194 },
-   { 60000.000000045809, 183.96882854112027, 817.15069318206758 },
-   { 59999.99999999682, 184.01172713386404, 817.15568252551441 },
-   { 60000.000000002117, 199.05860625274244, 818.90605990894926 },
-   { 60000.000000011685, 213.77441984052732, 820.66779572748067 },
-   { 59999.999999945896, 228.63273752574398, 822.50191665906459 },
-   { 60000.000000137385, 243.60930053773387, 824.4160390659564 },
-   { 59999.999999745312, 257.44864608947171, 826.20557537898253 },
-   { 60000.000000371336, 272.37732017567259, 828.28374145687258 },
-   { 59999.999999564294, 283.4609507719199, 829.76911975631128 },
-   { 60000.000000411754, 297.87730027160165, 831.94635758332913 },
-   { 59999.999999691667, 308.39894455125989, 833.48120705572103 },
-   { 60000.000000175751, 321.04689540263291, 835.47802201470222 },
-   { 59999.999999930937, 332.7974681685576, 837.36295119087083 },
-   { 60000.000000012922, 344.23852019267594, 839.26003269871717 },
-   { 59999.999999978521, 380.87159046869039, 845.50264944092885 },
-   { 60000.000000031927, 417.67053058140004, 852.32838657260925 },
-   { 59999.999999895757, 443.71876268540638, 857.33613824789597 },
-   { 60000.00000023668, 470.42282907220516, 863.40925211937144 },
-   { 59999.999999591026, 506.36442771103123, 868.70489233101273 },
-   { 60000.000000559063, 504.29569767668107, 873.82665736030435 },
-   { 59999.999999387175, 618.22680165126303, 889.69085497467483 },
-   { 60000.00000054048, 520.96760954336719, 878.60259543512541 },
-   { 59999.999999620944, 695.15397128954748, 909.33199431749756 },
-   { 60000.000000202854, 652.21259368585868, 902.32746593221361 },
-   { 59999.999999925931, 713.31441817738153, 914.25671409207371 },
-   { 60000.000000011525, 744.93626878652026, 920.45067498376648 },
-   { 59999.999999986139, 851.85145355849977, 941.08553924856312 },
-   { 60000.000000015752, 955.13474569084099, 960.32812261133847 },
-   { 59999.99999996031, 1019.9477908992111, 972.25457694191095 },
-   { 60000.000000078573, 1109.7424197388102, 989.27219905591903 },
-   { 59999.999999866697, 1103.4472241364576, 986.24901738812696 },
-   { 60000.000000196575, 1283.5502566789903, 1025.857653448167 },
-   { 59999.999999756859, 1241.170752696316, 1010.5034788173898 },
-   { 60000.000000241002, 1380.0598100152401, 1044.321387312001 },
-   { 59999.999999814674, 1417.3346489504095, 1047.4285724180056 },
-   { 60000.000000106025, 1498.5882349740116, 1064.7148393296281 },
-   { 59999.999999959189, 1562.4075471540843, 1076.5692870450682 },
-   { 60000.000000006847, 1632.0446827427525, 1089.9951747091934 },
-   { 59999.999999992855, 1819.187180960379, 1125.8766969823027 },
-   { 60000.000000006774, 2005.7867190244558, 1161.6893152514506 },
-   { 59999.999999993102, 2127.1610378717864, 1184.8982806691761 },
-   { 59999.999999983789, 2224.9504474907289, 1204.7794295042536 },
-   { 60000.000000076092, 2423.4034586285211, 1239.2849934128672 },
-   { 59999.999999843334, 2352.5108743508281, 1233.9178625300717 },
-   { 60000.00000021555, 2789.1958451831979, 1304.7841887599538 },
-   { 59999.999999781059, 2516.5832651666447, 1267.6317850640198 },
-   { 60000.000000168911, 2997.8479508975411, 1347.2273537129538 },
-   { 59999.999999901927, 2872.9560675152225, 1329.8998228537541 },
-   { 60000.000000040534, 3100.1634765888271, 1371.640798220885 },
-   { 59999.999999990199, 3186.6552406648925, 1389.3336814233451 },
-   { 60000.000000019143, 3570.5318534479206, 1462.8626017289478 },
-   { 59999.999999969914, 3906.3811637172125, 1522.697974792497 },
-   { 60000.000000105116, 4081.0496155485694, 1554.1195061318422 },
-   { 59999.999999764274, 4440.4680391955444, 1682.9362787226369 },
-   { 60000.000000389882, 4025.4579062184348, 1482.6543564450828 },
-   { 59999.999999500047, 5340.2058728577267, 2096.5041911809035 },
-   { 60000.000000509819, 4233.9915572764976, 1518.9299243967394 },
-   { 59999.999999583706, 5430.8345183928068, 2200.8401562891845 },
-   { 60000.000000267981, 5054.5402162751188, 1969.4793692255021 },
-   { 59999.999999871681, 5428.966058504895, 2244.2141001944756 },
-   { 60000.000000038024, 5546.4649349764723, 2352.3606428637349 },
-   { 59999.999999998952, 5706.4753141683368, 2517.0835536242184 },
-   { 59999.999999991771, 6129.2268892602051, 3030.8327236291348 },
-   { 60000.000000020089, 6420.3065439166912, 3661.6495160497966 },
-   { 59999.99999990526, 6235.8646808219391, 3444.1541944672813 },
-   { 60000.000000247288, 8126.8536394010316, 8890.661747328244 },
-   { 59999.99999954299, 2104.925285609057, -7996.1134321147983 },
-   { 60000.00000064441, 14264.475617875083, 34652.739991203249 },
-   { 59999.999999283253, -1684.3290491164355, -33238.811620330394 },
-   { 60000.000000641696, 13782.902589951687, 46532.286752882486 },
-   { 59999.999999532913, 2699.6074087223524, -19079.410940396814 },
-   { 60000.000000275439, 9084.6892111341349, 21937.827319607131 },
-   { 59999.999999871587, 6474.8937324409353, 5006.3713661893671 },
-   { 60000.000000044485, 7350.4434791870981, 10709.698171043074 },
-   { 59999.999999990541, 7306.414330937022, 10560.108503883888 },
-   { 60000, 7397.0783263606427, 11218.963217145942 }
-};
-
-const Standard_Integer Glob_NbKnots = 17;
-const Standard_Real Glob_Knots[Glob_NbKnots] = 
-{
-0,0.0087664292723375857,0.015654339342331427,0.019098294377328347,
-0.020820271894826808,0.021681260653576038,0.022111755032950653,0.022327002222637962,
-0.022434625817481617,0.022488437614903441,0.022542249412325268,0.037523693790797889,
-0.071526893170125505,0.1421299556831544,0.26514857375331263,0.51350664396810353,
-1 };
-
-const Standard_Integer Glob_Mults[Glob_NbKnots] = 
-{
-15,12,12,12,12,12,12,12,
-12,12,12,12,12,12,12,12,
-15 };
-
-//=======================================================================
-//function :  OCC862
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC862 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " curve1 curve2" << "\n";
-    return 1;
-  }
-
-  Standard_Integer i;
-  // Fill array of poles
-  TColgp_Array1OfPnt aPoles(1,Glob_NbPoles);
-  for (i = 0; i < Glob_NbPoles; i++)
-    aPoles.SetValue(i+1,gp_Pnt(Glob_Poles[i][0],Glob_Poles[i][1],Glob_Poles[i][2]));
-  // Fill array of knots
-  TColStd_Array1OfReal aKnots(1,Glob_NbKnots);
-  for (i = 0; i < Glob_NbKnots; i++)
-    aKnots.SetValue(i+1,Glob_Knots[i]);
-  // Fill array of mults
-  TColStd_Array1OfInteger aMults(1,Glob_NbKnots);
-  for (i = 0; i < Glob_NbKnots; i++)
-    aMults.SetValue(i+1,Glob_Mults[i]);
-  // Create B-Spline curve
-  const Standard_Real aDegree = 14;
-  Handle(Geom_BSplineCurve) C1 = new Geom_BSplineCurve(aPoles,aKnots,aMults,aDegree);
-
-  // Create trimmed line
-  gp_XYZ p1(60000,-7504.83,6000);
-  gp_XYZ p2(60000, 7504.83,6000);
-  Handle(Geom_Line) L = new Geom_Line(gp_Pnt(p1),gp_Dir(p2-p1));
-  Handle(Geom_TrimmedCurve) C2 = new Geom_TrimmedCurve(L,0.0,(p2-p1).Modulus());
-
-  DrawTrSurf::Set(argv[1],C1);
-  DrawTrSurf::Set(argv[2],C2);
-
-  // Try to find extrema
-  // IMPORTANT: it is not allowed to input infinite curves !
-  GeomAPI_ExtremaCurveCurve Ex(C1,C2/*,C1f,C1l,C2f,C2l*/);
-  if (Ex.Extrema().IsParallel())
-  {
-    di<<"Info: Infinite number of extrema, distance = "<<Ex.LowerDistance()<<"\n";
-  }
-  else
-  {
-    // Check if extrema were found
-    const Standard_Integer nbEx = Ex.NbExtrema();
-    if (nbEx)
-    {
-      // Get minimal distance data
-      gp_Pnt P1, P2;
-      Ex.NearestPoints(P1,P2);
-      Standard_Real U1, U2;
-      Ex.LowerDistanceParameters(U1,U2);
-      const Standard_Real D = Ex.LowerDistance();
-      // IMPORTANT: minimal distance here means accuracy reached in intersection
-      di<<"Info: Minimal distance is "<<D<<"\n";
-      di<<"Info: Minimal points are ("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<"), ("<<P2.X()<<","<<P2.Y()<<","<<P2.Z()<<")"<<"\n";
-      di<<"Info: Minimal parameters are ("<<U1<<"), ("<<U2<<")"<<"\n";
-    }
-    else
-    {
-      di<<"Error: extrema not found"<<"\n";
-    }
-  }
-  
-  return 0;
-}
-
-void QAMARTEC::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAMARTEC";
-
-  theCommands.Add("OCC862", "OCC862 curve1 curve2", __FILE__, OCC862, group);  
-  return;
-}
diff --git a/src/QAMitutoyoUK/QAMitutoyoUK.cdl b/src/QAMitutoyoUK/QAMitutoyoUK.cdl
deleted file mode 100755 (executable)
index 697d5a9..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-03-19
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAMitutoyoUK
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAMitutoyoUK/QAMitutoyoUK.cxx b/src/QAMitutoyoUK/QAMitutoyoUK.cxx
deleted file mode 100755 (executable)
index 653c5a1..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-// Created on: 2002-03-19
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAMitutoyoUK.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <TColStd_Array2OfReal.hxx>
-#include <V3d_View.hxx>
-#include <Visual3d_View.hxx>
-
-#include <BRepOffsetAPI_Sewing.hxx>
-
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-
-#include <BRepPrimAPI_MakeBox.hxx>
-
-static Standard_Integer BUC60753 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=3)
-  {
-    di << "Usage : " << argv[0] << " mode (0 <=mode<=5) ratio (0.0<=ration<=1.0)" <<"\n";
-    return -1;
-  }
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-           
-  Standard_Real Alpha = M_PI/10.;
-  Standard_Real CosAlpha = Cos (Alpha);
-  Standard_Real SinAlpha = Sin (Alpha);
-  Standard_Real MoinsCosAlpha = Cos (-Alpha);
-  Standard_Real MoinsSinAlpha = Sin (-Alpha);
-  TColStd_Array2OfReal TrsfI (0, 3, 0, 3);
-  TColStd_Array2OfReal TrsfX (0, 3, 0, 3);
-  TColStd_Array2OfReal TrsfY (0, 3, 0, 3);
-  TColStd_Array2OfReal TrsfZ (0, 3, 0, 3);
-  TColStd_Array2OfReal Trsfx (0, 3, 0, 3);
-  TColStd_Array2OfReal Trsfy (0, 3, 0, 3);
-  TColStd_Array2OfReal Trsfz (0, 3, 0, 3);
-  Standard_Integer i,j;
-  for (i=0; i<=3; i++)
-    for (j=0; j<=3; j++)
-      if (i == j) { 
-       TrsfX.SetValue (i, j, 1.0);
-       TrsfY.SetValue (i, j, 1.0);
-       TrsfZ.SetValue (i, j, 1.0);
-       Trsfx.SetValue (i, j, 1.0);
-       Trsfy.SetValue (i, j, 1.0);
-       Trsfz.SetValue (i, j, 1.0);
-       TrsfI.SetValue (i, j, 1.0);
-      } else { 
-       TrsfX.SetValue (i, j, 0.0);
-       TrsfY.SetValue (i, j, 0.0);
-       TrsfZ.SetValue (i, j, 0.0);
-       Trsfx.SetValue (i, j, 0.0);
-       Trsfy.SetValue (i, j, 0.0);
-       Trsfz.SetValue (i, j, 0.0);
-       TrsfI.SetValue (i, j, 0.0);
-      }
-       
-  // Rotation Alpha autour de l'axe X
-  TrsfX.SetValue (1, 1, CosAlpha);
-  TrsfX.SetValue (2, 2, CosAlpha);
-  TrsfX.SetValue (1, 2, -SinAlpha);
-  TrsfX.SetValue (2, 1, SinAlpha);
-  
-  // Rotation Alpha autour de l'axe Y
-  TrsfY.SetValue (0, 0, CosAlpha);
-  TrsfY.SetValue (2, 2, CosAlpha);
-  TrsfY.SetValue (0, 2, SinAlpha);
-  TrsfY.SetValue (2, 0, -SinAlpha);
-  
-  // Rotation Alpha autour de l'axe Z
-  TrsfZ.SetValue (0, 0, CosAlpha);
-  TrsfZ.SetValue (1, 1, CosAlpha);
-  TrsfZ.SetValue (0, 1, -SinAlpha);
-  TrsfZ.SetValue (1, 0, SinAlpha);
-  
-  // Rotation -Alpha autour de l'axe X
-  Trsfx.SetValue (1, 1, MoinsCosAlpha);
-  Trsfx.SetValue (2, 2, MoinsCosAlpha);
-  Trsfx.SetValue (1, 2, -MoinsSinAlpha);
-  Trsfx.SetValue (2, 1, MoinsSinAlpha);
-  
-  // Rotation -Alpha autour de l'axe Y
-  Trsfy.SetValue (0, 0, MoinsCosAlpha);
-  Trsfy.SetValue (2, 2, MoinsCosAlpha);
-  Trsfy.SetValue (0, 2, MoinsSinAlpha);
-       Trsfy.SetValue (2, 0, -MoinsSinAlpha);
-  
-  // Rotation -Alpha autour de l'axe Z
-  Trsfz.SetValue (0, 0, MoinsCosAlpha);
-  Trsfz.SetValue (1, 1, MoinsCosAlpha);
-  Trsfz.SetValue (0, 1, -MoinsSinAlpha);
-  Trsfz.SetValue (1, 0, MoinsSinAlpha);
-  
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  
-  myV3dView->SetAnimationMode(Standard_True,Standard_True);
-  myAISContext-> SetDegenerateModel((Aspect_TypeOfDegenerateModel) atoi(argv[1]),atof(argv[2]));
-  
-//               Timer.Reset ();
-//               Timer.Start ();
-  myV3dView->SetAnimationModeOn();
-  myV3dView->SetComputedMode ( Standard_False );
-  for (i=0;i<40;i++) {
-    myV3dView->View()->SetTransform (Trsfz);
-    myV3dView->View()->Update ();
-  }
-  myV3dView->SetAnimationModeOff();
-//               Timer.Stop ();
-//               Timer.Show (cout);   
-
-  return 0;
-}
-
-static Standard_Integer  OCC162 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 2 ) {
-    di << "Usage : " << argv[0] << " name" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-  if (aShape.IsNull()) return 0;
-
-  Standard_Real tolValue = 0.0001;
-  BRepOffsetAPI_Sewing sew(tolValue);
-  sew.Add(aShape);
-  sew.Perform();
-  TopoDS_Shape aSewed = sew.SewedShape();
-  
-  return 0;    
-}
-
-static Standard_Integer  OCC172 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  
-  AIS_ListOfInteractive aListOfIO;
-  aContext->DisplayedObjects(aListOfIO);
-  AIS_ListIteratorOfListOfInteractive It;
-  for (It.Initialize(aListOfIO);It.More();It.Next())
-    {
-      aContext->AddOrRemoveCurrentObject(It.Value());
-    }
-  
-  return 0;    
-}
-
-static Standard_Integer  OCC204 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 2 ) {
-    di << "Usage : " << argv[0] << " updateviewer=0/1" << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if (aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  Standard_Boolean UpdateViewer = Standard_True;
-  Standard_Integer IntegerUpdateViewer = atoi(argv[1]);
-  if (IntegerUpdateViewer == 0) {
-    UpdateViewer = Standard_False;
-  }
-
-  Standard_Integer deltaY = -500;
-  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0 + deltaY, 0),  gp_Pnt(100, 100 + deltaY, 100));
-  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120 + deltaY, 120),  gp_Pnt(300, 300 + deltaY,300));
-  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320 + deltaY, 320),  gp_Pnt(500, 500 + deltaY,500));
-
-  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
-  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
-  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
-
-  aContext->Display(ais1);
-  aContext->Display(ais2);
-  aContext->Display(ais3);
-
-  aContext->AddOrRemoveCurrentObject(ais1);
-  aContext->AddOrRemoveCurrentObject(ais2);
-  aContext->AddOrRemoveCurrentObject(ais3);
-
-  //printf("\n No of currents = %d", aContext->NbCurrents());
-
-  aContext->InitCurrent();
-  
-  //int count = 1;
-  while(aContext->MoreCurrent())
-  {
-    //printf("\n count is = %d",  count++);
-    Handle_AIS_InteractiveObject ais = aContext->Current();
-    aContext->Remove(ais, UpdateViewer);
-    aContext->InitCurrent();
-  }
-  
-  return 0;    
-}
-
-#include <gp_Lin.hxx>
-#include <BRepClass3d_Intersector3d.hxx>
-#include <TopoDS.hxx>
-static Standard_Integer OCC1651 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 8 ) {
-    di << "Usage : " << argv[0] << " Shape PntX PntY PntZ DirX DirY DirZ" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-  if (aShape.IsNull()) return 0;
-
-  gp_Pnt aP1(atof(argv[2]), atof(argv[3]), atof(argv[4]));
-  gp_Dir aD1(atof(argv[5]), atof(argv[6]), atof(argv[7]));
-  gp_Lin aL1(aP1,aD1);
-  BRepClass3d_Intersector3d aI1;
-  aI1.Perform(aL1, -250, 1e-7, TopoDS::Face(aShape));
-  if(aI1.IsDone() && aI1.HasAPoint()) {
-    gp_Pnt aR1 = aI1.Pnt();
-    di << aR1.X() << " " << aR1.Y() << " " << aR1.Z() << "\n";
-  }
-
-  return 0;
-}
-
-void QAMitutoyoUK::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAMitutoyoUK";
-
-  theCommands.Add("BUC60753", "BUC60753 mode ratio", __FILE__, BUC60753, group);
-  theCommands.Add("OCC162", "OCC162 name", __FILE__, OCC162, group);
-  theCommands.Add("OCC172", "OCC172", __FILE__, OCC172, group);
-  theCommands.Add("OCC204", "OCC204 updateviewer=0/1", __FILE__, OCC204, group);
-  theCommands.Add("OCC1651", "OCC1651 Shape PntX PntY PntZ DirX DirY DirZ", __FILE__, OCC1651, group);
-
-  return;
-}
diff --git a/src/QAMitutoyoUS/QAMitutoyoUS.cdl b/src/QAMitutoyoUS/QAMitutoyoUS.cdl
deleted file mode 100755 (executable)
index 2c7655a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-03-18
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAMitutoyoUS
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAMitutoyoUS/QAMitutoyoUS.cxx b/src/QAMitutoyoUS/QAMitutoyoUS.cxx
deleted file mode 100755 (executable)
index 0e29d39..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-// Created on: 2002-03-18
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAMitutoyoUS.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <gp_Ax2.hxx>
-#include <gp_Pnt.hxx>
-#include <Geom_RectangularTrimmedSurface.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <GC_MakeTrimmedCone.hxx>
-
-static Standard_Integer BUC60857 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** argv)
-{
-  gp_Ax2  Cone_Ax;
-  double R1=8, R2=16, H1=20, H2=40, angle;
-  gp_Pnt P0(0,0,0), P1(0,0,20), P2(0,0,45);
-  angle = 2*M_PI;
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) {
-    di << "Use vinit command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  Handle(Geom_RectangularTrimmedSurface) S = GC_MakeTrimmedCone (P1, P2, R1, R2).Value();
-  TopoDS_Shape myshape = BRepBuilderAPI_MakeFace(S, Precision::Confusion()).Shape();
-  DBRep::Set("BUC60857_BLUE",myshape);
-  Handle(AIS_Shape) ais1 = new AIS_Shape(myshape);
-  aContext->Display(ais1);
-  aContext->SetColor(ais1, Quantity_NOC_BLUE1);
-
-  Handle(Geom_RectangularTrimmedSurface) S2 = GC_MakeTrimmedCone (P1, P2, R1, 0).Value();
-  TopoDS_Shape myshape2 = BRepBuilderAPI_MakeFace(S2, Precision::Confusion()).Shape();
-  DBRep::Set("BUC60857_RED",myshape2);
-  Handle(AIS_Shape) ais2 = new AIS_Shape(myshape2);
-  aContext->Display(ais2);
-  aContext->SetColor(ais2, Quantity_NOC_RED);
-
-  Handle(Geom_RectangularTrimmedSurface) S3 = GC_MakeTrimmedCone (P1, P2, R2, R1).Value();
-  TopoDS_Shape myshape3 = BRepBuilderAPI_MakeFace(S3, Precision::Confusion()).Shape();
-  DBRep::Set("BUC60857_GREEN",myshape3);
-  Handle(AIS_Shape) ais3 = new AIS_Shape(myshape3);
-  aContext->Display(ais3);
-  aContext->SetColor(ais3, Quantity_NOC_GREEN);
-
-  return 0;
-}
-
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <StdSelect_BRepOwner.hxx>
-#include <SelectBasics_SensitiveEntity.hxx>
-#if ! defined(WNT)
-extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#else
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#endif
-
-static Standard_Integer OCC137 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) {
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-  if ( argc < 2 || argc > 3) {
-    di << "ERROR : Usage : " << argv[0] << " highlight_mode [shape]" << "\n";
-    return 1;
-  }
-  
-  ViewerTest_DoubleMapOfInteractiveAndName aMap ;
-  if(argc != 3) {
-    aMap.Assign(GetMapOfAIS());
-  } else {
-    ViewerTest_DoubleMapOfInteractiveAndName& aMap1 = GetMapOfAIS();
-    TCollection_AsciiString aName(argv[2]);
-    Handle(AIS_InteractiveObject) AISObj;
-    if(!aMap1.IsBound2(aName)) {
-      di << "Use 'vdisplay' before" << "\n";
-      return 1;
-    } else {
-      AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap1.Find2(aName));
-      if(AISObj.IsNull()){
-        di << argv[2] << " : No interactive object" << "\n";
-        return 1;
-      }
-      aMap.Bind(AISObj,aName);
-    }
-  }
-  ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
-  while ( it.More() ) {
-    Handle(AIS_InteractiveObject) AISObj = Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-    AISObj->SetHilightMode(atoi(argv[1]));
-    if(AISObj->HasSelection(4)) {
-      //Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
-      const Handle(SelectMgr_Selection)& aSelection = AISObj->Selection(4);
-      if(!aSelection.IsNull()) {
-        for(aSelection->Init();aSelection->More();aSelection->Next()) {
-          Handle(StdSelect_BRepOwner) aO = Handle(StdSelect_BRepOwner)::DownCast(aSelection->Sensitive()->OwnerId());
-          aO->SetHilightMode(atoi(argv[1]));
-        }
-      }
-    }
-    it.Next();
-  }
-  
-  return 0;
-}
-
-static Standard_Integer OCC137_z (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) {
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-  if ( argc != 1 && argc != 2) {
-    di << "ERROR : Usage : " << argv[0] << " [ZDetection_mode]" << "\n";
-    return 1;
-  }
-  aContext->SetZDetection(((argc == 1 || (argc == 2 && atoi(argv[1]) == 1)) ? Standard_True : Standard_False));
-  return 0;
-}
-
-void QAMitutoyoUS::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAMitutoyoUS";
-
-  theCommands.Add ("BUC60857", "BUC60857", __FILE__, BUC60857, group);
-  theCommands.Add("OCC137","OCC137 mode [shape]",__FILE__,OCC137,group);
-  theCommands.Add("OCC137_z","OCC137_z [ZDetection_mode]",__FILE__,OCC137_z,group);
-
-  return;
-}
diff --git a/src/QANIC/QANIC.cdl b/src/QANIC/QANIC.cdl
deleted file mode 100755 (executable)
index 1e08076..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-05-28
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QANIC
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QANIC/QANIC.cxx b/src/QANIC/QANIC.cxx
deleted file mode 100755 (executable)
index 7b86c7c..0000000
+++ /dev/null
@@ -1,1189 +0,0 @@
-// Created on: 2002-05-28
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QANIC.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <BRepBuilderAPI_MakePolygon.hxx>
-#include <TopoDS_Face.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Dir.hxx>
-#include <gp_Ax1.hxx>
-#include <BRepPrimAPI_MakeRevol.hxx>
-
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgo_Fuse.hxx>
-
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-#include <BRep_Tool.hxx>
-#include <Poly_Triangulation.hxx>
-#include <TopExp.hxx>
-#include <ChFi3d_FilletShape.hxx>
-#include <BRepFilletAPI_MakeFillet.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-static Standard_Integer OCC426 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc < 7 || argc > 8) {
-    di << "Usage : " << argv[0] << " shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 8) {
-    Standard_Integer IsB = atoi(argv[7]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  BRepBuilderAPI_MakePolygon W1;
-  W1.Add(gp_Pnt(10, 0, 0));
-  W1.Add(gp_Pnt(20, 0, 0));
-  W1.Add(gp_Pnt(20, 0, 10));
-  W1.Add(gp_Pnt(10, 0, 10));
-  W1.Add(gp_Pnt(10, 0, 0));
-
-  Standard_Boolean OnlyPlane1 = Standard_False;
-  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), OnlyPlane1);
-
-  gp_Pnt P1(0, 0, 0);
-  gp_Dir D1(0, 0, 30);
-  gp_Ax1 A1(P1,D1);
-  Standard_Real angle1 = 360 * (M_PI / 180.0);
-  TopoDS_Shape rs1 = BRepPrimAPI_MakeRevol(F1, A1, angle1);
-
-  BRepBuilderAPI_MakePolygon W2;
-  Standard_Real f1 =  7.0710678118654752440;
-  Standard_Real f2 = 14.1421356237309504880;
-  W2.Add(gp_Pnt(f1, f1, 10));
-  W2.Add(gp_Pnt(f2, f2, 10));
-  W2.Add(gp_Pnt(f2, f2, 20));
-  W2.Add(gp_Pnt(f1, f1, 20));
-  W2.Add(gp_Pnt(f1, f1, 10));
-
-  Standard_Boolean OnlyPlane2 = Standard_False;
-  TopoDS_Face F2 = BRepBuilderAPI_MakeFace(W2.Wire(), OnlyPlane2);
-
-  gp_Pnt P2(0, 0, 0);
-  gp_Dir D2(0, 0, 30);
-  gp_Ax1 A2(P2,D2);
-  Standard_Real angle2 = 270 * (M_PI / 180.0);
-  TopoDS_Shape rs2 = BRepPrimAPI_MakeRevol(F2, A2, angle2);
-
-  BRepBuilderAPI_MakePolygon W3;
-  W3.Add(gp_Pnt(10, 0, 20));
-  W3.Add(gp_Pnt(20, 0, 20));
-  W3.Add(gp_Pnt(20, 0, 30));
-  W3.Add(gp_Pnt(10, 0, 30));
-  W3.Add(gp_Pnt(10, 0, 20));
-
-  Standard_Boolean OnlyPlane3 = Standard_False;
-  TopoDS_Face F3 = BRepBuilderAPI_MakeFace(W3.Wire(), OnlyPlane3);
-
-  gp_Pnt P3(0, 0, 0);
-  gp_Dir D3(0, 0, 30);
-  gp_Ax1 A3(P3,D3);
-  Standard_Real angle3 = 360 * (M_PI / 180.0);
-  TopoDS_Shape rs3 = BRepPrimAPI_MakeRevol(F3, A3, angle3);
-
-  TopoDS_Shape fuse32, fuse321;
-  if (IsBRepAlgoAPI) {
-    di << "fuse32 = BRepAlgoAPI_Fuse(rs3, rs2)" <<"\n";
-    di << "fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1)" <<"\n";
-    fuse32 = BRepAlgoAPI_Fuse(rs3, rs2);
-    fuse321 = BRepAlgoAPI_Fuse(fuse32, rs1);
-  } else {
-    di << "fuse32 = BRepAlgo_Fuse(rs3, rs2)" <<"\n";
-    di << "fuse321 = BRepAlgo_Fuse(fuse32, rs1)" <<"\n";
-    fuse32 = BRepAlgo_Fuse(rs3, rs2);
-    fuse321 = BRepAlgo_Fuse(fuse32, rs1);
-  }
-
-  //Give the mass claculation of the shpae "fuse321"
-  GProp_GProps G;
-  BRepGProp::VolumeProperties(fuse321, G);
-  di<<" "<<"\n";
-  di<<"Mass: "<<G.Mass()<<"\n"<<"\n";
-
-  di << "Trianglating Faces ....." <<"\n";
-  TopExp_Explorer ExpFace;
-
-  for (ExpFace.Init (fuse321,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
-    {
-      TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
-      TopologicalFace.Orientation (TopAbs_FORWARD) ;
-      BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
-      TopLoc_Location loc;
-      Handle(Poly_Triangulation) facing = BRep_Tool::Triangulation(TopologicalFace, loc);
-      if (facing.IsNull())
-       {
-         di << "Triangulation FAILED for this face" << "\n";
-         continue;
-       }
-      di << "No of Triangles = " << facing->NbTriangles() << "\n";
-    }
-  di<<"Triangulation of all Faces Completed. "<< "\n" << "\n";
-
-  TopTools_IndexedDataMapOfShapeListOfShape edgemap;
-  TopExp::MapShapesAndAncestors(fuse321, TopAbs_EDGE, TopAbs_SOLID, edgemap);
-  di << "No. of Edges: " << edgemap.Extent() << "\n";
-  ChFi3d_FilletShape FShape = ChFi3d_Rational;
-  BRepFilletAPI_MakeFillet blend(fuse321,FShape);
-  di << "Adding Edges ..... " << "\n";
-  for(int i = 1; i <= edgemap.Extent(); i++)
-    {
-      // cout << "Adding Edge : " << i << endl;
-      TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
-      if(!edg.IsNull()) blend.Add(1, edg);
-    }
-  di << "All Edges added !  Now Building the Blend ... " << "\n";
-  di<<" "<<"\n";
-  blend.Build();
-
-  //DBRep::Set ( argv[1], fuse321 );
-  DBRep::Set ( argv[1], blend );
-  DBRep::Set ( argv[2], rs1 );
-  DBRep::Set ( argv[3], rs2 );
-  DBRep::Set ( argv[4], rs3 );
-  DBRep::Set ( argv[5], fuse32 );
-  DBRep::Set ( argv[6], fuse321 );
-
-  return 0;
-}
-
-#include <Geom_SurfaceOfRevolution.hxx>
-//=======================================================================
-//function : isPeriodic
-//purpose  :
-//=======================================================================
-static Standard_Integer isPeriodic(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-    {
-    OCC_CATCH_SIGNALS
-      // 1. Verify amount of arguments of the command
-      if (argc < 2) { di << "isperiodic FAULTY. Use : isperiodic surfaceOfRevolution"; return 0;}
-      // 2. Retrieve surface
-      Handle(Geom_Surface) aSurf = DrawTrSurf::GetSurface(argv[1]);
-      if(aSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface"; return 0;}
-      Handle(Geom_SurfaceOfRevolution) aRevolSurf = Handle(Geom_SurfaceOfRevolution)::DownCast(aSurf);
-      if(aRevolSurf.IsNull()) {di << "isperiodic FAULTY. argument of command is not a surface of revolution"; return 0;}
-      // 3. Verify whether entry surface is u-periodic and v-periodic
-      if(aRevolSurf->IsUPeriodic()) {di << "Surface is u-periodic \n";} else {di << "Surface is not u-periodic \n";}
-      if(aRevolSurf->IsVPeriodic()) {di << "Surface is v-periodic \n";} else {di << "Surface is not v-periodic \n";}
-    }
-  catch (Standard_Failure) {di << "isperiodic Exception \n" ;return 0;}
-
-  return 0;
-}
-
-#include <Precision.hxx>
-#include <Extrema_ExtPS.hxx>
-#include <GeomAdaptor_Surface.hxx>
-//=======================================================================
-//function : OCC486
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC486(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (argc < 2) { di << "OCC486 FAULTY. Use : OCC486 surf x y z du dv"; return 1;}
-      
-      Standard_Real du = 0;
-      Standard_Real dv = 0;
-
-      Handle(Geom_Surface) GS;
-      GS = DrawTrSurf::GetSurface(argv[1]);
-      if (GS.IsNull()) { di << "OCC486 FAULTY. Null surface /n";return 1;}
-      gp_Pnt P3D( atof(argv[2]),atof(argv[3]),atof(argv[4]) );
-
-      Standard_Real Tol = Precision::PConfusion();
-      Extrema_ExtPS myExtPS;
-      if (argc > 5) du = atof(argv[5]);
-      if (argc > 6) dv = atof(argv[6]);
-
-      Standard_Real uf, ul, vf, vl;
-      GS->Bounds(uf, ul, vf, vl);
-
-      GeomAdaptor_Surface aSurf(GS);
-      myExtPS.Initialize (aSurf, uf-du, ul+du, vf-dv, vl+dv, Tol, Tol );
-      myExtPS.Perform ( P3D );
-      Standard_Integer nPSurf = ( myExtPS.IsDone() ? myExtPS.NbExt() : 0 );
-
-      if ( nPSurf > 0 )
-       {
-
-         //Standard_Real distMin = myExtPS.Value ( 1 );
-         Standard_Real distMin = myExtPS.SquareDistance ( 1 );
-         Standard_Integer indMin=1;
-         for (Standard_Integer sol = 2; sol <= nPSurf ; sol++)
-           {
-             //Standard_Real dist = myExtPS.Value(sol);
-             Standard_Real dist = myExtPS.SquareDistance(sol);
-             if ( distMin > dist )
-               {
-                 distMin = dist;
-                 indMin = sol;
-               }
-           }
-//
-         distMin = sqrt(distMin);
-         Standard_Real S, T;
-         myExtPS.Point(indMin).Parameter ( S, T );
-         gp_Pnt aCheckPnt = aSurf.Value( S, T );
-         Standard_Real aCheckDist = P3D.Distance(aCheckPnt);
-         di << "Solution is : U = "<< S << "\t V = "<< T << "\n";
-         di << "Solution is : X = "<< aCheckPnt.X() << "\t Y = "<< aCheckPnt.Y() << "\t Z = "<< aCheckPnt.Z() << "\n";
-         di << "ExtremaDistance = " << distMin  << "\n";
-         di << "CheckDistance = " << aCheckDist << "\n";
-
-         if(fabs(distMin - aCheckDist) < Precision::Confusion()) return 0;
-         else return 1;
-       }
-      else return 1;
-    }
-  catch (Standard_Failure) {di << "OCC486 Exception \n" ;return 1;}
-  
-  return 0;
-}
-
-#include <GC_MakeArcOfCircle.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <Geom_Plane.hxx>
-#include <gp_Pln.hxx>
-#include <BRepPrimAPI_MakePrism.hxx>
-#include <BRepOffsetAPI_DraftAngle.hxx>
-//=======================================================================
-//function : OCC712
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC712 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if (argc != 3) {
-    di << "Usage : " << argv[0] << " draftAngle slabThick" << "\n";
-    return 1;
-  }
-  //NOTE: Case:1 - draftAngle = 15, slabThick = 30 --> Fails
-  //      Case:2   draftAngle = 10, slabThick = 30 --> Ok
-  //      Case:3   draftAngle = 10, slabThick = 40 --> Ok
-  //
-  //      --------------------------------------------------
-  Standard_Real draftAngle = atof(argv[1]);
-  Standard_Real slabThick = atof(argv[2]);
-
-  Standard_Real f1 = 75;
-  Standard_Real f2 = 35;
-
-  gp_Pnt p1(-f2,  f2, 0);
-  gp_Pnt p2(  0,  f1, 0);
-  gp_Pnt p3( f2,  f2, 0);
-  gp_Pnt p4( f1,   0, 0);
-  gp_Pnt p5( f2, -f2, 0);
-  gp_Pnt p6(  0, -f1, 0);
-  gp_Pnt p7(-f2, -f2, 0);
-  gp_Pnt p8(-f1,   0, 0);
-
-  GC_MakeArcOfCircle arc1(p1, p2, p3);
-  GC_MakeArcOfCircle arc2(p3, p4, p5);
-  GC_MakeArcOfCircle arc3(p5, p6, p7);
-  GC_MakeArcOfCircle arc4(p7, p8, p1);
-
-  TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
-  TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
-  TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
-  TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(arc4.Value());
-
-  BRepBuilderAPI_MakeWire MW;
-  MW.Add(e1);
-  MW.Add(e2);
-  MW.Add(e3);
-  MW.Add(e4);
-
-  if (!MW.IsDone())
-    {
-      di << "my Wire not done" << "\n";
-      return 1;
-    }
-  TopoDS_Wire W = MW.Wire();
-
-  TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
-  if ( F.IsNull())
-    {
-      di << " Error in Face creation " << "\n";
-      return 1;
-    }
-
-  Handle(Geom_Surface) surf = BRep_Tool::Surface(F);
-  Handle (Geom_Plane) P = Handle(Geom_Plane)::DownCast(surf);
-  gp_Pln slabPln = P->Pln();
-
-  try
-    {
-    OCC_CATCH_SIGNALS
-      gp_Dir slabDir(0, 0, 1);
-      gp_Vec slabVect(slabDir);
-      slabVect *= slabThick;
-
-      BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
-      if ( ! slab.IsDone() )
-        {
-         di << " Error in Slab creation " << "\n";
-         return 1;
-        }
-
-      TopoDS_Shape slabShape = slab.Shape();
-      if (fabs(draftAngle) > 0.01)
-        {
-         Standard_Real angle = draftAngle*(M_PI / 180.0);
-         BRepOffsetAPI_DraftAngle draftSlab(slabShape);
-
-         TopoDS_Shape fShape = slab.FirstShape();
-         TopoDS_Shape lShape = slab.LastShape();
-
-         TopExp_Explorer ex;
-         for(ex.Init(slabShape, TopAbs_FACE); ex.More(); ex.Next())
-            {
-             TopoDS_Face aFace = TopoDS::Face(ex.Current());
-             if(aFace.IsSame(fShape) || aFace.IsSame(lShape)) continue;
-             draftSlab.Add(aFace, slabDir, angle, slabPln);
-             if (!draftSlab.AddDone())
-                {
-                 di << " Error in Add " << "\n";
-                 return 1;
-                }
-            }
-
-         di << "All Faces added. Building... " << "\n"; //cout.flush();
-         draftSlab.Build();
-         di << "Build done..." << "\n"; //cout.flush();
-         if (!draftSlab.IsDone())  //--------------> STEP:1
-            {
-             di << " Error in Build " << "\n";
-             return 1;
-            }
-         slabShape = draftSlab.Shape();
-         DBRep::Set(argv[1], slabShape);
-        }
-    }
-  catch ( Standard_Failure ) //--------------------> STEP:2
-    {
-      di << " Error in Draft Slab " << "\n";
-      return 1;
-    }
-  return 0;
-}
-
-//=======================================================================
-//  performTriangulation
-//=======================================================================
-
-Standard_Integer performTriangulation (TopoDS_Shape aShape, Draw_Interpretor& di)
-{
-  int failed=0, total=0;
-  TopExp_Explorer ExpFace;
-  Handle(Poly_Triangulation) facing;
-
-  for (ExpFace.Init(aShape,TopAbs_FACE); ExpFace.More(); ExpFace.Next())
-    {
-      total++;
-      TopoDS_Face TopologicalFace = TopoDS::Face (ExpFace.Current());
-      TopologicalFace.Orientation (TopAbs_FORWARD) ;
-      BRepMesh_IncrementalMesh IM(TopologicalFace, 1);
-      TopLoc_Location loc;
-      facing = BRep_Tool::Triangulation(TopologicalFace, loc);
-      di << "Face " << total << " - ";
-      if (facing.IsNull())
-        {
-         failed++;
-         di << "******************** FAILED during Triangulation " << "\n";
-        }
-      else
-        {
-         di << facing->NbTriangles() << " Triangles" <<"\n";
-        }
-    }
-  di<<"Triangulation of all Faces Completed: "<<"\n"<<"\n";
-  if (failed == 0) return 1;
-  di<<"***************************************************"<<"\n";
-  di<<"*******                                    ********"<<"\n";
-  di<<"***** Triangulation FAILED for " << failed << " of " << total << " Faces ******"<<"\n";
-  di<<"*******                                    ********"<<"\n";
-  di<<"***************************************************"<<"\n";
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <BRepPrimAPI_MakeCone.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgo_Cut.hxx>
-//=======================================================================
-//function : OCC822_1
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC822_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-#if ! defined(BRepAlgo_def02)
-//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  int index = 1;
-
-  gp_Pnt P1(0, 0, 0);
-  gp_Dir D1(0, 0, 1);
-  gp_Ax2 A1(P1,D1);
-
-  BRepPrimAPI_MakeCylinder cylMakerIn(A1, 40, 110);
-  BRepPrimAPI_MakeCylinder cylMakerOut(A1, 50, 100);
-  TopoDS_Shape cylIn = cylMakerIn.Shape();
-  TopoDS_Shape cylOut = cylMakerOut.Shape();
-
-  gp_Pnt P2(0, 0, 0);
-  gp_Dir D2(0, 0, -1);
-  gp_Ax2 A2(P2,D2);
-
-  BRepPrimAPI_MakeCone conMakerIn(A2, 40, 60, 110);
-  BRepPrimAPI_MakeCone conMakerOut(A2, 50, 70, 100);
-  TopoDS_Shape conIn = conMakerIn.Shape();
-  TopoDS_Shape conOut = conMakerOut.Shape();
-
-  di << "All primitives created.....  Creating Boolean" << "\n";
-
-  TopoDS_Shape theIn, theOut, theRes;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "theIn = BRepAlgoAPI_Fuse(cylIn, conIn)" <<"\n";
-       di << "theOut = BRepAlgoAPI_Fuse(cylOut, conOut)" <<"\n";
-       di << "theRes = BRepAlgoAPI_Cut(theOut, theIn)" <<"\n";
-        theIn = BRepAlgoAPI_Fuse(cylIn, conIn);
-        theOut = BRepAlgoAPI_Fuse(cylOut, conOut);
-        theRes = BRepAlgoAPI_Cut(theOut, theIn);
-      } else {
-       di << "theIn = BRepAlgo_Fuse(cylIn, conIn)" <<"\n";
-       di << "theOut = BRepAlgo_Fuse(cylOut, conOut)" <<"\n";
-        theIn = BRepAlgo_Fuse(cylIn, conIn);
-        theOut = BRepAlgo_Fuse(cylOut, conOut);
-       di << "theRes = BRepAlgo_Cut(theOut, theIn)" <<"\n";
-        theRes = BRepAlgo_Cut(theOut, theIn);
-      }
-
-      if (index < argc) DBRep::Set(argv[index++], theIn);
-      if (index < argc) DBRep::Set(argv[index++], theOut);
-      if (index < argc) DBRep::Set(argv[index++], theRes);
-      di << "Booleans Created !    Triangulating !" <<"\n";
-
-      performTriangulation(theRes, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"***** Standard_Failure : Exception in Shoe Function *****"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"*********************************************************"<<"\n";
-      return 1;
-    }
-  return 0;
-
-}
-
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-//=======================================================================
-//  OCC822_2
-//=======================================================================
-
-static Standard_Integer OCC822_2 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  int index = 1;
-
-  gp_Dir xDir(1, 0, 0);
-  gp_Dir zDir(0, 0, 1);
-  gp_Pnt cen1(0, 0, 0);
-  gp_Ax2 cor1(cen1, zDir, xDir);
-  BRepPrimAPI_MakeBox boxMaker(cor1, 100, 100, 100);
-  TopoDS_Shape box = boxMaker.Shape();
-  if (index < argc) DBRep::Set(argv[index++], box);
-
-  BRepPrimAPI_MakeSphere sphereMaker(gp_Pnt(100.0, 50.0, 50.0), 25.0);
-  TopoDS_Shape sph = sphereMaker.Shape();
-  if (index < argc) DBRep::Set(argv[index++], sph);
-
-  di << "All primitives created.....  Creating Cut Objects" << "\n";
-
-  TopoDS_Shape fuse;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "fuse = BRepAlgoAPI_Fuse(box, sph)" <<"\n";
-       fuse = BRepAlgoAPI_Fuse(box, sph);
-      } else {
-       di << "fuse = BRepAlgo_Fuse(box, sph)" <<"\n";
-       fuse = BRepAlgo_Fuse(box, sph);
-      }
-      if (index < argc) DBRep::Set(argv[index++], fuse);
-      di << "Object Created !   Now Triangulating !" ;
-
-      performTriangulation(fuse, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"***** Standard_Failure : Exception in HSP Function ******"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"*********************************************************"<<"\n";
-      return 1;
-    }
-
-  return 0;
-}
-
-//=======================================================================
-//  OCC823
-//=======================================================================
-
-static Standard_Integer OCC823 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  int index = 1;
-  Standard_Real size = 0.001;
-
-  gp_Pnt P1(40, 50, 0);
-  gp_Dir D1(100, 0, 0);
-  gp_Ax2 A1(P1,D1);
-  BRepPrimAPI_MakeCylinder mkCyl1(A1, 20, 100);
-  TopoDS_Shape cyl1 = mkCyl1.Shape();
-  if (index < argc) DBRep::Set(argv[index++], cyl1);
-
-  gp_Pnt P2(100, 50, size);
-  gp_Dir D2(0, size, 80);
-  gp_Ax2 A2(P2,D2);
-  BRepPrimAPI_MakeCylinder mkCyl2(A2, 20, 80);
-  TopoDS_Shape cyl2 = mkCyl2.Shape();
-  if (index < argc) DBRep::Set(argv[index++], cyl2);
-
-  di << "All primitives created.....  Creating Boolean" << "\n";
-
-  TopoDS_Shape fuse;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "fuse = BRepAlgoAPI_Fuse(cyl2, cyl1)" <<"\n";
-       fuse = BRepAlgoAPI_Fuse(cyl2, cyl1);
-      } else {
-       di << "fuse = BRepAlgo_Fuse(cyl2, cyl1)" <<"\n";
-       fuse = BRepAlgo_Fuse(cyl2, cyl1);
-      }
-      if (index < argc) DBRep::Set(argv[index++], fuse);
-      di << "Fuse Created !    Triangulating !" <<"\n";
-
-      performTriangulation(fuse, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"***** Standard_Failure : Exception in TEE Function ******"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"*********************************************************"<<"\n";
-      return 1;
-    }
-  return 0;
-}
-
-//=======================================================================
-//  OCC824
-//=======================================================================
-
-static Standard_Integer OCC824 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  int index = 1;
-
-  gp_Pnt P1(100, 0, 0);
-  gp_Dir D1(-1, 0, 0);
-  gp_Ax2 A1(P1,D1);
-  BRepPrimAPI_MakeCylinder mkCyl(A1, 20, 100);
-  TopoDS_Shape cyl = mkCyl.Shape();
-  if (index < argc) DBRep::Set(argv[index++], cyl);
-
-  BRepPrimAPI_MakeSphere sphere(P1, 20.0);
-  TopoDS_Shape sph = sphere.Shape();
-  if (index < argc) DBRep::Set(argv[index++], sph);
-
-  di << "All primitives created.....  Creating Boolean" << "\n";
-
-  TopoDS_Shape fuse;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "fuse = BRepAlgoAPI_Fuse(cyl, sph)" <<"\n";
-       fuse = BRepAlgoAPI_Fuse(cyl, sph);
-      } else {
-       di << "fuse = BRepAlgo_Fuse(cyl, sph)" <<"\n";
-       fuse = BRepAlgo_Fuse(cyl, sph);
-      }
-      di << "Fuse Created !    Triangulating !" <<"\n";
-      if (index < argc) DBRep::Set(argv[index++], fuse);
-
-      performTriangulation(fuse, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"***** Standard_Failure : Exception in YOU Function ******"<<"\n";
-      di<<"*****                                              ******"<<"\n";
-      di<<"*********************************************************"<<"\n";
-      return 1;
-    }
-  return 0;
-}
-
-#include <TColgp_Array2OfPnt.hxx>
-#include <GeomConvert.hxx>
-#include <Geom_BezierSurface.hxx>
-#include <BRepPrimAPI_MakeHalfSpace.hxx>
-
-//=======================================================================
-//  OCC825
-//=======================================================================
-
-static Standard_Integer OCC825 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 6 || argc > 7) {
-    di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 7) {
-    Standard_Integer IsB = atoi(argv[6]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def02)
-//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  int index = 1;
-
-  Standard_Real size = 50;
-  TColgp_Array2OfPnt poles(1, 2, 1, 2);
-
-  poles(1, 1).SetCoord(-size, 0, -size);
-  poles(1, 2).SetCoord(-size, 0,  size);
-  poles(2, 1).SetCoord( size, 0, -size);
-  poles(2, 2).SetCoord( size, 0,  size);
-
-  Handle(Geom_BezierSurface) BezSurf = new Geom_BezierSurface(poles);
-  Handle(Geom_BSplineSurface) BSpSurf = GeomConvert::SurfaceToBSplineSurface(BezSurf);
-  BRepBuilderAPI_MakeFace faceMaker(BSpSurf, Precision::Confusion());
-  TopoDS_Face face = faceMaker.Face();
-
-  gp_Pnt pnt(0, size, 0);
-  BRepPrimAPI_MakeHalfSpace *hSpace = new BRepPrimAPI_MakeHalfSpace(face,pnt);
-  TopoDS_Shape hsp = hSpace->Solid();
-  if (index < argc) DBRep::Set(argv[index++], hsp);
-
-  BRepPrimAPI_MakeSphere sphere1(gp_Pnt(0.0, 0.0, 0.0), 25.0);
-  TopoDS_Shape sph1 = sphere1.Shape();
-  if (index < argc) DBRep::Set(argv[index++], sph1);
-
-  BRepPrimAPI_MakeSphere sphere2(gp_Pnt(0.0, 0.00001, 0.0), 25.0);
-  TopoDS_Shape sph2 = sphere2.Shape();
-  if (index < argc) DBRep::Set(argv[index++], sph2);
-
-  di << "All primitives created.....  Creating Cut Objects" << "\n";
-
-  TopoDS_Shape cut1, cut2;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "cut1 = BRepAlgoAPI_Cut(sph1, hsp)" << "\n";
-       cut1 = BRepAlgoAPI_Cut(sph1, hsp);
-      } else {
-       di << "cut1 = BRepAlgo_Cut(sph1, hsp)" << "\n";
-       cut1 = BRepAlgo_Cut(sph1, hsp);
-      }
-      if (index < argc) DBRep::Set(argv[index++], cut1);
-      di << "CUT 1 Created !   " ;
-
-      if (IsBRepAlgoAPI) {
-       di << "cut2 = BRepAlgoAPI_Cut(sph2, hsp)" << "\n";
-       cut2 = BRepAlgoAPI_Cut(sph2, hsp);
-      } else {
-       di << "cut2 = BRepAlgo_Cut(sph2, hsp)" << "\n";
-       cut2 = BRepAlgo_Cut(sph2, hsp);
-      }
-      if (index < argc) DBRep::Set(argv[index++], cut2);
-      di << "CUT 2 Created !" << "\n" << "\n";
-
-      GProp_GProps G;
-      BRepGProp::VolumeProperties(cut1, G);
-      di<<"CUT 1 Mass = "<<G.Mass()<< "\n" << "\n";
-      BRepGProp::VolumeProperties(cut2, G);
-      di<<"CUT 2 Mass = "<<G.Mass()<< "\n" << "\n";
-
-      di << "Trianglating Faces of CUT 1 ....." << "\n";
-      performTriangulation(cut1, di);
-
-      di << "Trianglating Faces of CUT 2 ....." << "\n";
-      performTriangulation(cut2, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"***** Standard_Failure : Exception in HSP Function ******"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"*********************************************************"<< "\n";
-      return 1;
-    }
-
-  di<<"*************************************************************"<< "\n";
-  di<<" CUT 1 and CUT 2 gives entirely different results during"<< "\n";
-  di<<" mass computation and face triangulation, eventhough the"<< "\n";
-  di<<" two spheres are located more or less at the same position."<< "\n";
-  di<<"*************************************************************"<< "\n";
-
-  return 0;
-}
-
-//=======================================================================
-//  OCC826
-//=======================================================================
-
-static Standard_Integer OCC826 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  int index = 1;
-
-  Standard_Real x1 = 181.82808;
-  Standard_Real x2 = 202.39390;
-  Standard_Real y1 = 31.011970;
-  Standard_Real y2 = 123.06856;
-
-  BRepBuilderAPI_MakePolygon W1;
-  W1.Add(gp_Pnt(x1, y1, 0));
-  W1.Add(gp_Pnt(x2, y1, 0));
-  W1.Add(gp_Pnt(x2, y2, 0));
-  W1.Add(gp_Pnt(x1, y2, 0));
-  W1.Add(gp_Pnt(x1, y1, 0));
-
-  Standard_Boolean myFalse = Standard_False;
-  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
-
-  gp_Pnt P1(0, 0, 0);
-  gp_Dir D1(0, 30, 0);
-  gp_Ax1 A1(P1,D1);
-  Standard_Real angle1 = 360 * (M_PI / 180.0);
-  TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
-  if (index < argc) DBRep::Set(argv[index++], rev);
-
-  BRepPrimAPI_MakeSphere sphere(gp_Pnt(166.373, 77.0402, 96.0555), 23.218586);
-  TopoDS_Shape sph = sphere.Shape();
-  if (index < argc) DBRep::Set(argv[index++], sph);
-
-  di << "All primitives created.....  Creating Boolean" << "\n";
-
-  TopoDS_Shape fuse;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "fuse = BRepAlgoAPI_Fuse(rev, sph)" << "\n";
-       fuse = BRepAlgoAPI_Fuse(rev, sph);
-      } else {
-       di << "fuse = BRepAlgo_Fuse(rev, sph)" << "\n";
-       fuse = BRepAlgo_Fuse(rev, sph);
-      }
-      if (index < argc) DBRep::Set(argv[index++], fuse);
-      di << "Fuse Created !   Triangulating !" << "\n";
-      performTriangulation(fuse, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"***** Standard_Failure : Exception in SPH Function ******"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"*********************************************************"<< "\n";
-      return 1;
-    }
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeTorus.hxx>
-//=======================================================================
-//  OCC827
-//=======================================================================
-
-static Standard_Integer OCC827 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc < 6 || argc > 7) {
-    di << "Usage : " << argv[0] << " name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 7) {
-    Standard_Integer IsB = atoi(argv[6]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  int index = 1;
-
-  BRepBuilderAPI_MakePolygon W1;
-  W1.Add(gp_Pnt(10, 0, 0));
-  W1.Add(gp_Pnt(20, 0, 0));
-  W1.Add(gp_Pnt(20, 0, 50));
-  W1.Add(gp_Pnt(10, 0, 50));
-  W1.Add(gp_Pnt(10, 0, 0));
-
-  Standard_Boolean myFalse = Standard_False;
-  TopoDS_Face F1 = BRepBuilderAPI_MakeFace(W1.Wire(), myFalse);
-
-  gp_Pnt P1(0, 0, 0);
-  gp_Dir D1(0, 0, 30);
-  gp_Ax1 A1(P1,D1);
-  Standard_Real angle1 = 360 * (M_PI / 180.0);
-  TopoDS_Shape rev = BRepPrimAPI_MakeRevol(F1, A1, angle1);
-  if (index < argc) DBRep::Set(argv[index++], rev);
-
-  gp_Pnt P2(0, 0, 50);
-  gp_Dir D2(0, 0, 30);
-  gp_Ax2 A2(P2,D2);
-  Standard_Real majRad = 15;
-  Standard_Real minRad = 5;
-  BRepPrimAPI_MakeTorus Torus1(A2, majRad, minRad);
-  TopoDS_Shape tor1 = Torus1.Shape();
-  if (index < argc) DBRep::Set(argv[index++], tor1);
-
-  gp_Pnt P3(0, 0, 10);
-  gp_Dir D3(0, 0, 30);
-  gp_Ax2 A3(P3,D3);
-  BRepPrimAPI_MakeTorus Torus2(A3, majRad, minRad);
-  TopoDS_Shape tor2 = Torus2.Shape();
-  if (index < argc) DBRep::Set(argv[index++], tor2);
-
-  di << "All primitives created.....  Creating Boolean" << "\n";
-
-  TopoDS_Shape fuse1, fuse2;
-  try
-    {
-    OCC_CATCH_SIGNALS
-      if (IsBRepAlgoAPI) {
-       di << "Fuse1 = BRepAlgoAPI_Fuse(tor1, rev)" << "\n";
-       fuse1 = BRepAlgoAPI_Fuse(tor1, rev);
-      } else {
-       di << "Fuse1 = BRepAlgo_Fuse(tor1, rev)" << "\n";
-       fuse1 = BRepAlgo_Fuse(tor1, rev);
-      }
-      if (index < argc) DBRep::Set(argv[index++], fuse1);
-      di << "Fuse1 Created !    Creating Fuse 2" << "\n";
-      if (IsBRepAlgoAPI) {
-       di << "Fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1)" << "\n";
-       fuse2 = BRepAlgoAPI_Fuse(tor2, fuse1);
-      } else {
-       di << "Fuse2 = BRepAlgo_Fuse(tor2, fuse1)" << "\n";
-       fuse2 = BRepAlgo_Fuse(tor2, fuse1);
-      }
-      if (index < argc) DBRep::Set(argv[index++], fuse2);
-      di << "Fuse2 Created !    Triangulating !" << "\n";
-
-      performTriangulation(fuse2, di);
-    }
-  catch ( Standard_Failure )
-    {
-      di<<"*********************************************************"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"***** Standard_Failure : Exception in REV Function ******"<< "\n";
-      di<<"*****                                              ******"<< "\n";
-      di<<"*********************************************************"<< "\n";
-      return 1;
-    }
-  return 0;
-}
-
-//=======================================================================
-//  performBlend
-//=======================================================================
-
-int performBlend (TopoDS_Shape aShape, Standard_Real rad, TopoDS_Shape& bShape, Draw_Interpretor& di)
-{
-  Standard_Integer status = 0;
-  TopoDS_Shape newShape;
-  TopTools_IndexedDataMapOfShapeListOfShape edgemap;
-  TopExp::MapShapesAndAncestors(aShape,TopAbs_EDGE,TopAbs_SOLID,edgemap);
-  di << "Blending All Edges: No. of Edges: " << edgemap.Extent() << "\n";
-  ChFi3d_FilletShape FShape = ChFi3d_Rational;
-  BRepFilletAPI_MakeFillet blend(aShape,FShape);
-  for(int i = 1; i <= edgemap.Extent(); i++)
-    {
-      TopoDS_Edge edg = TopoDS::Edge( edgemap.FindKey(i) );
-      if(!edg.IsNull()) blend.Add(rad, edg);
-    }
-
-  try
-    {
-    OCC_CATCH_SIGNALS
-      blend.Build();
-      if(!blend.HasResult() || blend.Shape().IsNull()) {
-        status = 1;
-      }
-    }
-  catch ( Standard_Failure )
-    {
-      status = 1;
-    }
-  if(status) {
-      di<<"*******************************************************"<< "\n";
-      di<<"******                                          *******"<< "\n";
-      di<<"****** Blending Failed (Radius = " << rad << ") *******"<< "\n";
-      di<<"******                                          *******"<< "\n";
-      di<<"*******************************************************"<< "\n";
-      return 1;
-  } else {
-    di<<"Blending successfully performed on all Edges: "<< "\n" << "\n";
-  }
-  bShape = blend.Shape();
-  return 0;
-}
-
-#include <GC_MakeSegment.hxx>
-//=======================================================================
-//  OCC828
-//=======================================================================
-
-static Standard_Integer OCC828 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv)
-{
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " shape" << "\n";
-  }
-  int index = 1;
-
-  Standard_Real slabThick = 111;
-
-  gp_Pnt p11(-27.598139, -7.0408573, 0.0);
-  gp_Pnt p12(-28.483755, -17.487625, 0.0);
-  gp_Pnt p13(-19.555504, -22.983587, 0.0);
-  GC_MakeArcOfCircle arc1(p11, p12, p13);
-
-  gp_Pnt p21(12.125083, -22.983587, 0.0);
-  gp_Pnt p22(21.1572, -17.27554, 0.0);
-  gp_Pnt p23(19.878168, -6.6677585, 0.0);
-  GC_MakeArcOfCircle arc2(p21, p22, p23);
-
-  gp_Pnt p31(3.265825, 13.724955, 0.0);
-  gp_Pnt p32(-4.7233953, 17.406338, 0.0);
-  gp_Pnt p33(-12.529893, 13.351856, 0.0);
-  GC_MakeArcOfCircle arc3(p31, p32, p33);
-
-  GC_MakeSegment ln1(p13, p21);
-  GC_MakeSegment ln2(p23, p31);
-  GC_MakeSegment ln3(p33, p11);
-
-  TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(arc1.Value());
-  TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(arc2.Value());
-  TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(arc3.Value());
-
-  TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(ln1.Value());
-  TopoDS_Edge e5 = BRepBuilderAPI_MakeEdge(ln2.Value());
-  TopoDS_Edge e6 = BRepBuilderAPI_MakeEdge(ln3.Value());
-
-  BRepBuilderAPI_MakeWire MW;
-  MW.Add(e1);
-  MW.Add(e4);
-  MW.Add(e2);
-  MW.Add(e5);
-  MW.Add(e3);
-  MW.Add(e6);
-
-  if (!MW.IsDone())
-    {
-      di << "my Wire not done" << "\n";
-      return 1;
-    }
-
-  TopoDS_Wire W = MW.Wire();
-  TopoDS_Face F = BRepBuilderAPI_MakeFace(W);
-  if ( F.IsNull())
-    {
-      di << " Error in Face creation " << "\n";
-      return 1;
-    }
-
-  try
-    {
-    OCC_CATCH_SIGNALS
-      gp_Dir slabDir(0, 0, 1);
-      gp_Vec slabVect(slabDir);
-      slabVect *= slabThick;
-
-      BRepPrimAPI_MakePrism slab(F, slabVect, Standard_True);
-      if ( ! slab.IsDone() )
-        {
-         di << " Error in Slab creation " << "\n";
-         return 1;
-        }
-      if (index < argc) DBRep::Set(argv[index++], slab.Shape());
-
-//       cout << "Slab Successfully Created !   Now Blending ..." << endl;
-//       TopoDS_Shape aShape;
-//       int ret = performBlend(slab.Shape(), radius, aShape);
-//       if (ret) return 1;
-//       if (index < argc) DBRep::Set(argv[index++], aShape);
-
-//       cout << "Blending Successfully Done !   Now Triangulating ..." << endl;
-//       performTriangulation(aShape);
-    }
-  catch ( Standard_Failure )
-    {
-      di << " Error in Draft Slab " << "\n";
-      return 1;
-    }
-  return 0;
-}
-
-void QANIC::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QANIC";
-
-  theCommands.Add ("OCC426", "OCC426 shape1 shape2 shape3 shape4 shape5 shape6 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC426, group);
-
-  theCommands.Add("isperiodic", "Use : isperiodic surfaceOfRevolution", __FILE__, isPeriodic, group);
-  theCommands.Add("OCC486", "Use : OCC486 surf x y z du dv ", __FILE__, OCC486, group);
-  theCommands.Add("OCC712", "OCC712 draftAngle slabThick", __FILE__, OCC712, group);
-  theCommands.Add("OCC822_1", "OCC822_1 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_1, group);
-  theCommands.Add("OCC822_2", "OCC822_2 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC822_2, group);
-  theCommands.Add("OCC823", "OCC823 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC823, group);
-  theCommands.Add("OCC824", "OCC824 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC824, group);
-  theCommands.Add("OCC825", "OCC825 name1 name2 name3 name4 name5 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC825, group);
-  theCommands.Add("OCC826", "OCC826 name1 name2 result [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC826, group);
-  theCommands.Add("OCC827", "OCC827 name1 name2 name3 result1 result2 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__,OCC827, group);
-  theCommands.Add("OCC828", "OCC828 redius shape result ", __FILE__,OCC828, group);
-
-  return;
-}
diff --git a/src/QAOCC/FILES b/src/QAOCC/FILES
deleted file mode 100755 (executable)
index 17a7c5c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-QAOCC.cdl
-QAOCC.cxx
-QAOCC_CMPLRS.edl
diff --git a/src/QAOCC/QAOCC.cdl b/src/QAOCC/QAOCC.cdl
deleted file mode 100755 (executable)
index 17236c6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
--- Created on: 2002-03-20
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAOCC
-     uses Draw,
-          TopoDS,
-          AIS,
-          PrsMgr,
-          Prs3d,
-          SelectMgr,
-         Quantity
-is
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAOCC/QAOCC.cxx b/src/QAOCC/QAOCC.cxx
deleted file mode 100755 (executable)
index 0a2cf77..0000000
+++ /dev/null
@@ -1,5443 +0,0 @@
-// Created on: 2002-03-20
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <stdio.h>
-
-#include <QAOCC.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <Geom_Axis2Placement.hxx>
-#include <gp.hxx>
-#include <gp_Trsf.hxx>
-#include <AIS_Trihedron.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <TopoDS_Solid.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepPrimAPI_MakeCone.hxx>
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <IGESToBRep_Reader.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <GCPnts_UniformDeflection.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <IGESToBRep.hxx>
-#include <V3d_Viewer.hxx>
-#include <BRepAdaptor_CompCurve.hxx>
-#include <GCPnts_AbscissaPoint.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Overflow.hxx>
-#include <Standard_Underflow.hxx>
-#include <Standard_DivideByZero.hxx>
-#include <OSD_SIGSEGV.hxx>
-#include <OSD_Exception_ACCESS_VIOLATION.hxx>
-#include <OSD_Exception_STACK_OVERFLOW.hxx>
-#include <OSD.hxx>
-#include <STEPCAFControl_Writer.hxx>
-#include <STEPControl_StepModelType.hxx>
-#include <Interface_Static.hxx>
-#include <IFSelect_ReturnStatus.hxx>
-#include <Standard_Failure.hxx>
-#include <TColgp_HArray1OfPnt2d.hxx>
-#include <Geom2dAPI_Interpolate.hxx>
-#include <Geom2d_BSplineCurve.hxx>
-#include <Geom2dConvert_BSplineCurveToBezierCurve.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <BRep_Tool.hxx>
-#include <GeomProjLib.hxx>
-#include <Geom2dAPI_InterCurveCurve.hxx>
-#include <IntRes2d_IntersectionSegment.hxx>
-#include <TDataStd_RealArray.hxx>
-#include <TDF_CopyLabel.hxx>
-#include <NCollection_Vector.hxx>
-#include <TColStd_Array1OfInteger.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <TColgp_Array1OfPnt.hxx>
-#include <AIS_ListOfInteractive.hxx>
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
-#include <BRepBuilderAPI_MakePolygon.hxx>
-#include <gp_GTrsf.hxx>
-#include <Poly_Triangulation.hxx>
-#include <IGESControl_Reader.hxx>
-#include <IGESData_IGESModel.hxx>
-#include <IGESData_IGESEntity.hxx>
-#include <V3d_View.hxx>
-
-#include <tcl.h>
-
-#if ! defined(WNT)
-extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#else
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#endif
-
-static Standard_Integer  OCC128 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] ;
-    return 1;
-  }
-
-  Handle(Geom_Axis2Placement) aTrihedronAxis = new Geom_Axis2Placement(gp::XOY());
-
-  gp_Trsf trsf1;
-  trsf1.SetTranslation(gp_Vec(100, 100, 0));
-  aTrihedronAxis->Transform(trsf1);
-  Handle(AIS_Trihedron) myTrihedron = new AIS_Trihedron(aTrihedronAxis);
-  myTrihedron->SetColor(Quantity_NOC_LIGHTSTEELBLUE4);
-  myTrihedron->SetSize(100);
-  myAISContext->Display(myTrihedron, Standard_True);
-
-//  TopoDS_Shape shape1 = (TopoDS_Shape) BRepPrimAPI_MakeBox(50,50,50);
-  TopoDS_Shape shape1 = BRepPrimAPI_MakeBox(50,50,50).Shape();
-  Handle(AIS_Shape) AS = new AIS_Shape(shape1);
-  AS->SetDisplayMode(1);
-  Graphic3d_MaterialAspect mat(Graphic3d_NOM_PLASTIC);
-  AS->SetMaterial(mat);
-  AS->SetColor(Quantity_NOC_RED);
-  myAISContext->Display(AS);
-
-  gp_Trsf TouchTrsf;
-  TouchTrsf.SetTranslation(gp_Vec(20, 20, 0));
-
-  myAISContext->ResetLocation(AS);
-  myAISContext->SetLocation(AS , TouchTrsf) ;
-  myAISContext->Redisplay(AS, Standard_True);
-
- return 0;
-}
-
-  // Remove as bad version of QAAddOrRemoveSelected from QADraw
-//static Standard_Integer OCC129 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-//{
-//  if( argc != 3) {
-//    di<<"Usage : " << argv[0] << " shape islocal\n";
-//    return 1;
-//  }
-//  //get AIS_Shape:
-//  Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
-//
-// //   ViewerTest_DoubleMapOfInteractiveAndName& aMap =
-// //                          ViewerTest::GetDataMapOfAIS ();
-//  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-//
-//  TCollection_AsciiString aName(argv[1]);
-//  Handle(AIS_InteractiveObject) AISObj;
-//
-//  if(aMap.IsBound2(aName)) {
-//    AISObj = aMap.Find2(aName);
-//    if(AISObj.IsNull()){
-//      di<<"No interactive object \n";
-//      return 1;
-//    }
-//
-//    Standard_Integer aNum = -1;
-//
-//    if(atoi(argv[2])) {
-//      aNum = anAISCtx->OpenLocalContext();
-//    }
-//
-//    if(anAISCtx->HasOpenedContext()){
-//      anAISCtx->InitSelected();
-//      anAISCtx->AddOrRemoveSelected(AISObj);
-//    }
-//    else {
-//      anAISCtx->InitCurrent();
-//      anAISCtx->AddOrRemoveCurrentObject(AISObj);
-//    }
-//
-//    if(aNum >= 0) {
-// //      anAISCtx->CloseLocalContext(aNum);
-//    }
-//
-//    return 0;
-//  }
-//  //select this shape:
-//  else {
-//    di<<"Use 'vdisplay' before";
-//    return 1;
-//  }
-//}
-
-static Standard_Integer OCC136 (Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
-{
-  if(argc > 1){
-    di<<"Usage: OCC136\n";
-    return 1;
-  }
-
-  //create some primitives:
-  // Two basic points:
-  Standard_Real Size=100;
-  gp_Pnt P0(0,0,0), P1(Size,Size,Size);
-  //box
-  TopoDS_Solid aBox = BRepPrimAPI_MakeBox(P0,P1);
-  //sphere
-  TopoDS_Solid aSphere = BRepPrimAPI_MakeSphere (Size*0.5);
-  //cone
-  gp_Ax2 anAx2(P1, gp_Dir(1,1,1));
-  TopoDS_Solid aCone = BRepPrimAPI_MakeCone(anAx2, Size*0.7, Size*0.3, Size);
-  //cylinder
-  anAx2.SetLocation(gp_Pnt(Size,0,0));
-  anAx2.SetDirection(gp_Dir(-1,-1,1));
-  TopoDS_Solid aCyl = BRepPrimAPI_MakeCylinder(anAx2, Size*0.5, Size);
-
-  Handle(AIS_InteractiveContext) anAISCtx = ViewerTest::GetAISContext();
-  if(anAISCtx.IsNull()){
-    di<<"Null interactive context. Use 'vinit' at first.\n";
-    return 1;
-  }
-
-  if(anAISCtx->HasOpenedContext()) anAISCtx->CloseAllContexts();
-  anAISCtx->EraseAll();
-
-  //load primitives to context
-  Handle(AIS_Shape) aSh1 = new AIS_Shape(aBox);
-  anAISCtx->Display(aSh1);
-
-  Handle(AIS_Shape) aSh2 = new AIS_Shape(aSphere);
-  anAISCtx->Display(aSh2);
-
-  Handle(AIS_Shape) aSh3 = new AIS_Shape(aCone);
-  anAISCtx->Display(aSh3);
-
-  Handle(AIS_Shape) aSh4 = new AIS_Shape(aCyl);
-  anAISCtx->Display(aSh4);
-
-  //set selected
-  anAISCtx->InitCurrent();
-  anAISCtx->AddOrRemoveCurrentObject(aSh1);
-  anAISCtx->AddOrRemoveCurrentObject(aSh2);
-  anAISCtx->AddOrRemoveCurrentObject(aSh3);
-  anAISCtx->AddOrRemoveCurrentObject(aSh4);
-
-  //remove all this objects from context
-  anAISCtx->Clear(aSh1, Standard_False);
-  anAISCtx->Clear(aSh2, Standard_False);
-  anAISCtx->Clear(aSh3, Standard_False);
-  anAISCtx->Clear(aSh4, Standard_False);
-  return 0;
-}
-
-static int BUC60610(Draw_Interpretor& di, Standard_Integer argc, const char ** argv) {
-  if(argc < 2){
-    printf("Usage: %s  iges_input [name]\n",argv[0]);
-    return(1);
-  }
-  Standard_Character *Ch;
-
-  if(argc > 2) {
-    Ch = new Standard_Character[strlen(argv[2])+3];
-  }
-  IGESToBRep_Reader IR;
-  IR.LoadFile (argv[1]);
-  IR.Clear();
-  IR.TransferRoots();
-  TopoDS_Shape aTopShape = IR.OneShape();
-  TopExp_Explorer ex(aTopShape, TopAbs_EDGE);
-  Standard_Integer i=0;
-  for( ; ex.More(); ex.Next()){
-    const TopoDS_Edge &E = TopoDS::Edge(ex.Current());
-    BRepAdaptor_Curve aCurve(E);
-    GCPnts_UniformDeflection plin(aCurve, 0.1);
-    di << "Num points = " << plin.NbPoints() << "\n";
-    if(argc > 2) {
-      i++;
-      sprintf(Ch,"%s_%i",argv[2],1);
-      DBRep::Set(Ch,E);
-    }
-  }
-  return (1);
-}
-
-static Standard_Integer BUC60661(Draw_Interpretor& di, Standard_Integer argc, const char ** a)
-{
-  if(argc!=2)
-    {
-      di << "Usage : " << a[0] << " file.igs" << "\n";
-      return -1;
-    }
-
-  Handle(AIS_InteractiveContext) myContext = ViewerTest::GetAISContext();
-
-  if(myContext.IsNull()) {
-    di << "use 'vinit' command before " << a[0] << "\n";
-    return -1;
-  }
-
-  // MKV 30.03.05
-#if ((TCL_MAJOR_VERSION > 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4))) && !defined(USE_NON_CONST)
-  const Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#else
-  Standard_Character *DD = Tcl_GetVar(di.Interp(),"Draw_DataDir",TCL_GLOBAL_ONLY);
-#endif
-
-  Standard_Character  *file1 = new Standard_Character [strlen(DD)+strlen(a[1])+2];
-  sprintf(file1,"%s/%s",DD,a[1]);
-
-  IGESToBRep_Reader reader;
-  Standard_Integer status = reader.LoadFile(file1);
-  if( !status ) {
-    IGESToBRep::Init();
-      reader.TransferRoots();
-      TopoDS_Shape shape = reader.OneShape();
-
-      Handle(AIS_Shape) importedShape = new AIS_Shape(shape);
-
-      Handle(V3d_Viewer) myPView = myContext->CurrentViewer();
-
-      if( ! myPView.IsNull() && (myPView->DefaultVisualization() == V3d_WIREFRAME) )
-       importedShape->SetDisplayMode(AIS_WireFrame);
-      else importedShape->SetDisplayMode(AIS_Shaded);
-      myContext->Display(importedShape);
-    }
-
-  printf("\n End of my  IGES to 3D-viewer *****************>\n");
-  return 0;
-}
-
-
-//====================================================
-//
-// Following code is inserted from
-// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
-// ( 75455 Apr 16 18:59)
-//
-//====================================================
-
-//OCC105
-#include <BRepTools_WireExplorer.hxx>
-#include <BRep_Tool.hxx>
-#include <GCPnts_UniformAbscissa.hxx>
-#include <TopExp.hxx>
-
-//
-// usage : OCC105 shape
-//
-// comments:
-//GCPnts_UniformAbscissa returns bad end point foe first edge. Its value is
-
-//Value Pnt = -338.556216693211 -394.465571897208 0
-//should be
-//Value Pnt = -307.47165394 -340.18073533 0
-
-static int OCC105(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2){
-    di<<"Usage : OCC105 shape\n";
-    return 1;
-  }
-//  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get("aa.brep"));
-  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
-  Standard_Real l = 0.5; //atof(argv[2]);
-  // Find the first vertex of the wire
-  BRepTools_WireExplorer wire_exp(myTopoDSWire);
-  TopoDS_Vertex vlast;
-  {
-    TopoDS_Vertex vw1, vw2;
-    TopExp::Vertices(myTopoDSWire,vw1,vw2);
-    TopoDS_Vertex ve1, ve2;
-    TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
-    TopExp::Vertices(edge,ve1,ve2);
-    if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
-      vlast = vw1;
-    else {
-//      assert(vw2.IsSame(ve1) || vw2.IsSame(ve2));
-      vlast = vw2;
-    }
-  }
-  for ( ; wire_exp.More(); wire_exp.Next())
-    {
-      di << "\n\n New Edge \n"   << "\n";
-      Standard_Real newufirst, newulast;
-      TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
-      Standard_Real ufirst, ulast;
-      Handle(Geom_Curve) acurve;
-      TopoDS_Vertex ve1, ve2;
-      TopExp::Vertices(edge,ve1,ve2);
-      if (ve1.IsSame(vlast))
-       {
-          acurve = BRep_Tool::Curve(edge, ufirst, ulast);
-          newufirst = ufirst;
-          newulast  = ulast;
-          vlast = ve2;
-       }
-      else
-       {
-//          assert(ve2.IsSame(vlast));
-//          assert ( wire_exp.Orientation( ) == TopAbs_REVERSED );
-          acurve = BRep_Tool::Curve( edge, ufirst, ulast );
-          newufirst = acurve->ReversedParameter( ufirst );
-          newulast  = acurve->ReversedParameter( ulast );
-          acurve = acurve->Reversed( );
-          vlast = ve1;
-       }
-
-      GeomAdaptor_Curve   curve;
-      GCPnts_UniformAbscissa  algo;
-      curve.Load(acurve);
-      algo.Initialize( curve, l, newufirst, newulast );
-      if (!algo.IsDone())
-        di << "Not Done!!!"   << "\n";
-      for (Standard_Integer Index = 1; Index<=algo.NbPoints();Index++) {
-        Standard_Real t = algo.Parameter(Index);
-        gp_Pnt      pt3 = curve.Value(t);
-        di << "Parameter t = " << t   << "\n";
-        di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z()  << "\n";
-      }
-    }
-  return 0;
-
-}
-
-#include <TColStd_SequenceOfTransient.hxx>
-#include <GeomFill_Pipe.hxx>
-static int pipe_OCC9 (Draw_Interpretor& di,
-                     Standard_Integer n, const char ** a)
-{
-  if (n < 6) {
-    di << "Usage: " << a[0] << " result path cur1 cur2 radius [tolerance]" << "\n";
-    return 1;
-  }
-
-  TColStd_SequenceOfTransient aCurveSeq;
-  Standard_Integer i;
-  for (i=2 ; i<=4; i++) {
-    Handle(Geom_Curve) aC = Handle(Geom_Curve)::DownCast( DrawTrSurf::Get(a[i]) );
-    if (aC.IsNull()) {
-      di << a[i] << " is not a curve" << "\n";
-      return 1;
-    }
-    aCurveSeq.Append(aC);
-  }
-
-  GeomFill_Pipe aPipe(Handle(Geom_Curve)::DownCast( aCurveSeq(1) ),
-                     Handle(Geom_Curve)::DownCast( aCurveSeq(2) ),
-                     Handle(Geom_Curve)::DownCast( aCurveSeq(3) ),
-                     atof (a[5]) );
-
-  if (n == 7) {
-    aPipe.Perform(atof (a[6]), Standard_True);
-  } else {
-    aPipe.Perform(Standard_True/*, Standard_True*/);
-  }
-
-  Handle(Geom_Surface) aSurf = aPipe.Surface();
-
-  DrawTrSurf::Set(a[1], aSurf);
-  return 0;
-}
-
-//======================================================================
-// OCC125
-// usage : OCC125 shell
-//======================================================================
-#include <ShapeFix_Shell.hxx>
-
-Standard_Integer  OCC125(Draw_Interpretor& di ,
-                        Standard_Integer n,
-                        const char ** a)
-{
-  if (n!=2) {
-    di<<" Use OCC125 shell";
-    return 1;
-  }
-
-  TopoDS_Shape S = DBRep::Get(a[1]);
-
-  if (S.IsNull()) {
-    di<<" Null shape is not allowed";
-    return 1;
-  }
-
-  TopAbs_ShapeEnum aT;
-  aT=S.ShapeType();
-  if (aT!=TopAbs_SHELL) {
-    di<<" Shape Type must be SHELL";
-    return 1;
-  }
-
-  const TopoDS_Shell& aShell = TopoDS::Shell(S);
-  //
-  Standard_Boolean isAccountMultiConex, bNonManifold, bResult;
-
-  isAccountMultiConex=Standard_True;
-  bNonManifold=Standard_False;
-
-  Handle (ShapeFix_Shell) aFix = new ShapeFix_Shell(aShell);
-  bResult=aFix->FixFaceOrientation(aShell, isAccountMultiConex, bNonManifold);
-
-  di<<"bResult="<<(Standard_Integer)bResult;
-
-  TopoDS_Shape aShape;
-  aShape=aFix->Shape();
-
-  TCollection_AsciiString aName(a[1]), aDef("_sh"), aRName;
-  aRName=aName;
-  aRName=aRName+aDef;
-  DBRep::Set (aRName.ToCString(), aShape);
-  di<<aRName.ToCString();
-  //
-  return 0;
-}
-
-#include <BRepLib_FindSurface.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-Standard_Integer  OCC157(Draw_Interpretor& di,
-                        Standard_Integer n,
-                        const char ** a)
-//static Standard_Integer findplanarsurface(Draw_Interpretor&, Standard_Integer n, const char ** a)
-{
-  if (n<3) {
-    di << "bad number of arguments" <<"\n";
-    return 1;
-  }
-
-  // try to read a shape:
-  TopoDS_Shape inputShape=DBRep::Get(a[2]);
-  if (inputShape.IsNull() || inputShape.ShapeType() != TopAbs_WIRE) {
-    di << "Invalid input shape"<< "\n";
-    return 1;
-  }
-  Standard_Real toler = atof(a[3]);
-  TopoDS_Wire aWire = TopoDS::Wire(inputShape);
-  BRepLib_FindSurface FS(aWire, toler, Standard_True);
-  if(FS.Found()) {
-    di<<"OCC157: OK; Planar surface is found"<<"\n";
-    Handle(Geom_Surface) aSurf = FS.Surface();
-    BRepBuilderAPI_MakeFace aMakeFace(aSurf,aWire,Standard_True);
-    if(aMakeFace.IsDone()) {
-      TopoDS_Face aFace = aMakeFace.Face();
-      DBRep::Set(a[1],aFace);
-    }
-  }
-  else di<<"OCC157: ERROR; Planar surface is not found with toler = "<<toler <<"\n";
-  return 0;
-
-}
-
-// #include <MyCommandsCMD.h>
-#include <ShapeFix_Shape.hxx>
-#include <BRepOffset_MakeOffset.hxx>
-#include <BRepOffsetAPI_MakeOffset.hxx>
-#include <BRepOffset_Mode.hxx>
-#include <GeomAbs_JoinType.hxx>
-#include <AIS_Shape.hxx>
-
-#include <BRepTools.hxx>
-
-Standard_Integer  OCC165(Draw_Interpretor& di ,
-                        Standard_Integer n,
-                        const char ** a)
-
-
-//=======================================================================
-
-// static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv);
-
-// void MyOffsets_Commands(Draw_Interpretor& theCommands)
-// {
-//     theCommands.Add("yoffset" , "yoffset" , __FILE__, YOffset, " Offset on Z Direction");
-// }
-
-//=======================================================================
-
-// static int YOffset (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
- {
-   if (n > 2)
-     {
-       di <<"Usage : " << a[0] << " [file]"<<"\n";
-       return 1;
-     }
-       di.Eval ("axo");
-
-#define _OFFSET_TELCO_
-#ifdef _OFFSET_TELCO_
-
-       Standard_CString file = a[1];
-
-       BRep_Builder aBuilder;
-       TopoDS_Shape theShape;
-       //BRepTools::Read(theShape, Standard_CString("/dn02/users_SUN/inv/3/OCC165/2d_tr_line.brep"), aBuilder);
-       BRepTools::Read(theShape, file, aBuilder);
-       DBRep::Set("shape", theShape);
-
-       TopoDS_Wire theWire = TopoDS::Wire(theShape);
-
-       Standard_Real anOffset = 1.5;
-
-#else
-
-       Standard_Real xA = 0.0, xB = 200.0, xC = 200.0, xD = 0.0,
-               yA = 0.0, yB = 0.0, yC = 200.0, yD = 200.0,
-               zA = 0.0, zB = 0.0, zC = 0.0, zD = 0.0;
-
-       BRepBuilderAPI_MakePolygon theSquare;
-       TopoDS_Vertex theA = BRepBuilderAPI_MakeVertex(gp_Pnt(xA, yA, zA));
-       theSquare.Add(theA);
-       TopoDS_Vertex theB = BRepBuilderAPI_MakeVertex(gp_Pnt(xB, yB, zB));
-       theSquare.Add(theB);
-       TopoDS_Vertex theC = BRepBuilderAPI_MakeVertex(gp_Pnt(xC, yC, zC));
-       theSquare.Add(theC);
-       TopoDS_Vertex theD = BRepBuilderAPI_MakeVertex(gp_Pnt(xD, yD, zD));
-       theSquare.Add(theD);
-
-       theSquare.Close();
-       TopoDS_Wire theWire = theSquare.Wire();
-
-       Standard_Real anOffset = 10;
-
-
-#endif /* _OFFSET_TELCO_ */
-
-
-       TopoDS_Face theFace = BRepBuilderAPI_MakeFace(theWire).Face();
-       DBRep::Set("face", theFace);
-
-
-       Standard_Real anAlt = 0.;
-       GeomAbs_JoinType theJoin = GeomAbs_Intersection;
-//GeomAbs_Intersection; //GeomAbs_Arc;
-       BRepOffsetAPI_MakeOffset aMakeOffset(theFace, theJoin);
-       aMakeOffset.AddWire(theWire);
-
-       aMakeOffset.Perform(anOffset, anAlt);
-
-       TopoDS_Shape theOffsetShapePos = aMakeOffset.Shape();
-       DBRep::Set("offset", theOffsetShapePos);
-       return 0;
-//     return TCL_OK;
-}
-
-#include<BRepAlgoAPI_Cut.hxx>
-#include<BRepAlgo_Cut.hxx>
-
-#include<BRepPrimAPI_MakeHalfSpace.hxx>
-#include<Handle_Geom_CartesianPoint.hxx>
-#include<Geom_CartesianPoint.hxx>
-#include<AIS_Point.hxx>
-
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-
-static Standard_Integer OCC297 (Draw_Interpretor& di,Standard_Integer /*argc*/, const char ** argv )
-
-{
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-
-    gp_Pnt pt1_(250.,250.,0.);
-    gp_Pnt pt2_(-250.,250.,0.);
-    gp_Pnt pt3_(-250.,-250.,0.);
-    gp_Pnt pt4_(250.,-250.,0.);
-    BRepBuilderAPI_MakeEdge edg1_(pt1_, pt2_);
-    BRepBuilderAPI_MakeEdge edg2_(pt2_, pt3_);
-    BRepBuilderAPI_MakeEdge edg3_(pt3_, pt4_);
-    BRepBuilderAPI_MakeEdge edg4_(pt4_, pt1_);
-
-    BRepBuilderAPI_MakeWire wire_(edg1_, edg2_, edg3_, edg4_);
-    BRepBuilderAPI_MakeFace face_(wire_);
-    TopoDS_Face sh_ = face_.Face();
-
-    int up = 1;
-
-    gp_Pnt g_pnt;
-    if(up)
-        g_pnt = gp_Pnt(0,0,-100);
-    else
-          g_pnt = gp_Pnt(0,0,100);
-
-    myAISContext->EraseAll(Standard_False);
-        Handle(Geom_CartesianPoint) GEOMPoint = new Geom_CartesianPoint(g_pnt);
-        Handle(AIS_Point) AISPoint = new AIS_Point(GEOMPoint);
-    myAISContext->Display(AISPoint);
-
-    BRepPrimAPI_MakeHalfSpace half_(sh_, g_pnt);
-    TopoDS_Solid sol1_ = half_.Solid();
-//         Handle(AIS_Shape) AISHalf = new AIS_Shape(sol1_);
-//         AISHalf->SetColor(Quantity_NOC_GREEN);
-//     myAISContext->Display(AISHalf);
-
-  DBRep::Set("Face",sol1_);
-
-    gp_Ax1 ax1_(gp_Pnt(0., 0., -100.), gp_Dir(0., 0., 1.));
-
-    Standard_Real x=0., y=0., z=-80.;
-
-    BRepPrimAPI_MakeBox box(gp_Pnt(x,y,z),gp_Pnt(x+150,y+200,z+200));
-//         Handle(AIS_Shape) AISBox = new AIS_Shape(box);
-//         AISBox->SetColor(Quantity_NOC_BLUE1);
-//     myAISContext->Display(AISBox);
-
- DBRep::Set("Box",box.Shape());
-
-//     BRepAlgoAPI_Cut cut( sol1_, box.Shape() );
-//         //BRepAlgoAPI_Cut cut(  box.Shape(), sol1_ );
-//     TopoDS_Shape sh1_ = cut.Shape();
-//         Handle(AIS_Shape) AISCut = new AIS_Shape(sh1_);
-//         AISCut->SetColor(Quantity_NOC_RED);
-//     myAISContext->Display(AISCut);
-
-//  DBRep::Set("Cut",sh1_);
-
-  return 0;
-
-}
-#include<GProp_GProps.hxx>
-#include<BRepGProp.hxx>
-
-static Standard_Integer OCC305 (Draw_Interpretor& di,Standard_Integer argc, const char ** argv )
-
-{
-  if (argc =! 2)
-  {
-    di <<"Usage : " << argv[0] << " file"<<"\n";
-    return 1;
-  }
-  Standard_CString file = argv[1];
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-TopoDS_Shape sh;
-BRep_Builder builder;
-//BRepTools::Read(sh, "/dn02/users_SUN/inv/3/OCC305/testc.brep", builder);
-BRepTools::Read(sh, file, builder);
-
-TopoDS_Wire wire;
-builder.MakeWire(wire);
-TopoDS_Edge ed;
-TopoDS_Vertex vt1, vt2;
-TopExp_Explorer wex(sh, TopAbs_EDGE);
-for(;wex.More();wex.Next())
-{
-    ed = TopoDS::Edge(wex.Current());
-    TopExp::Vertices(ed, vt1, vt2);
-    builder.UpdateVertex(vt1, 0.01);
-    builder.UpdateVertex(vt2, 0.01);
-    builder.UpdateEdge(ed, 0.01);
-    builder.Add(wire, ed);
-
-
-    GProp_GProps lprop;
-    BRepGProp::LinearProperties(ed, lprop);
-    printf("\n length = %f", lprop.Mass());
-}
- DBRep::Set("Wire",wire);
-// Handle(AIS_Shape) res = new AIS_Shape( wire );
-// aContext->SetColor( res, Quantity_NOC_RED );
-// aContext->Display( res );
-
-// BRepOffsetAPI_MakeOffset off(wire, GeomAbs_Arc);
-// off.Perform(0.5, 0);
-
-// printf("\n IsDone = %d", off.IsDone());
-// sh = off.Shape();
-// res = new AIS_Shape( sh );
-// aContext->SetColor( res, Quantity_NOC_GREEN );
-// aContext->Display( res );
-
-  return 0;
-
-}
-
-static Standard_Integer OCC166 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0];
-    return 1;
-  }
-
-  BRepPrimAPI_MakeBox aBox(gp_Pnt(0, 0, 0), 100, 100, 100);
-  Handle(AIS_Shape) anAISBox = new AIS_Shape(aBox.Shape());
-  myAISContext->Display(anAISBox, 1);
-  anAISBox->SetSelectionMode(-1);
-  Standard_Integer myLocContInd = myAISContext->OpenLocalContext();
-  myAISContext->CloseLocalContext(myLocContInd);
-  Standard_Integer aSelMode = ((Handle(AIS_InteractiveObject)) anAISBox)->SelectionMode();
-  if(aSelMode != -1)
-    return 1;
-
-  return 0;
-}
-
-#include <TDocStd_Document.hxx>
-#include <DDocStd.hxx>
-#include <PCDM_StoreStatus.hxx>
-#include <TDocStd_Application.hxx>
-
-static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  if (nb != 2) {
-    di << "Usage: " << a[0] << " Doc" << "\n";
-    return 1;
-  }
-
-  Handle(TDocStd_Document) D;
-  if (!DDocStd::GetDocument(a[1],D)) return 1;
-
-  Handle(TDocStd_Application) A;
-  if (!DDocStd::Find(A)) return 1;
-
-  TCollection_ExtendedString theStatusMessage;
-  if (!D->IsSaved()) {
-    di << "this document has never been saved" << "\n";
-    return 0;
-  }
-  PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
-  if (theStatus != PCDM_SS_OK ) {
-    switch ( theStatus ) {
-    case PCDM_SS_DriverFailure: {
-      di << " Could not store , no driver found to make it " <<"\n" ;
-      break ;
-    }
-    case PCDM_SS_WriteFailure: {
-      di << " Write access failure " << "\n" ;
-      break;
-    }
-    case PCDM_SS_Failure: {
-      di << " Write failure " << "\n" ;
-    }
-    }
-    return 1;
-  }
-  return 0;
-}
-
-static Standard_Integer OCC381_SaveAs (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  if (nb != 3) {
-    di << "Usage: " << a[0] << " Doc Path" << "\n";
-    return 1;
-  }
-
-  Handle(TDocStd_Document) D;
-  if (!DDocStd::GetDocument(a[1],D)) return 1;
-
-  TCollection_ExtendedString path (a[2]);
-  Handle(TDocStd_Application) A;
-  if (!DDocStd::Find(A)) return 1;
-
-  TCollection_ExtendedString theStatusMessage;
-  PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
-  if (theStatus != PCDM_SS_OK ) {
-    switch ( theStatus ) {
-    case PCDM_SS_DriverFailure: {
-      di << " Could not store , no driver found to make it " <<"\n" ;
-      break ;
-    }
-    case PCDM_SS_WriteFailure: {
-      di << " Write access failure " << "\n" ;
-      break;
-    }
-    case PCDM_SS_Failure: {
-      di << " Write failure " << "\n" ;
-    }
-    }
-    return 1;
-  }
-
-  return 0;
-}
-
-#include <BRepClass3d_SolidClassifier.hxx>
-
-Standard_Integer OCC299bug (Draw_Interpretor& di,
-                           Standard_Integer n,
-                           const char ** a)
-{
-  char sbf[512];
-
-  if (n < 3) {
-    di << "Usage : " << a[0] << " Solid Point [Tolerance=1.e-7]" << "\n";
-    return -1;
-  }
-
-  TopoDS_Shape aS = DBRep::Get(a[1]);
-  if (aS.IsNull()) {
-    sprintf(sbf, " Null Shape is not allowed here\n");
-    di<<sbf;
-    return 1;
-  }
-
-  if (aS.ShapeType()!=TopAbs_SOLID) {
-    sprintf(sbf, " Shape type must be SOLID\n");
-    di<<sbf;
-    return 1;
-  }
-  //
-  Standard_Real aTol=1.e-7;
-  TCollection_AsciiString sIN("IN"), sOUT("OUT of"), sON("ON"), sUNKNOWN("UNKNOWN");
-  TopAbs_State aState = TopAbs_UNKNOWN;
-  gp_Pnt aP(8., 9., 10.);
-
-  if (!DrawTrSurf::GetPoint(a[2], aP) ) {
-    sprintf(sbf, " Null Point is not allowed here\n");
-    di<<sbf;
-    return 1;
-  }
-
-  aTol=1.e-7;
-  if (n==4) {
-    aTol=atof(a[3]);
-  }
-  //
-  BRepClass3d_SolidClassifier aSC(aS);
-  aSC.Perform(aP,aTol);
-  //
-  aState = aSC.State();
-  //
-  sprintf(sbf, "The point is "); di<<sbf;
-  //
-  switch (aState) {
-  case TopAbs_IN:
-    sprintf(sbf, sIN.ToCString());
-    break;
-  case TopAbs_OUT:
-    sprintf(sbf, sOUT.ToCString());
-    break;
-  case TopAbs_ON:
-    sprintf(sbf, sON.ToCString());
-    break;
-  case TopAbs_UNKNOWN:
-    sprintf(sbf, sUNKNOWN.ToCString());
-    break;
-  default:
-    sprintf(sbf, sUNKNOWN.ToCString());
-    break;
-  }
-  di<<sbf;
-       //
-  sprintf(sbf, " shape\n");
-  di<<sbf;
-
-  return 0;
-}
-
-#include <OSD_Process.hxx>
-#include <OSD_Path.hxx>
-
-static Standard_Integer OCC309bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  if (nb != 1) {
-    di << "Usage: " << a[0] << "\n";
-    return 1;
-  }
-  OSD_Process p;
-  OSD_Path d = p.CurrentDirectory();
-  TCollection_AsciiString s;
-  d.SystemName(s);
-  di << "*" <<  s.ToCString() << "*" << "\n";
-  d.UpTrek();
-  d.SystemName(s);
-  di <<  "*" <<  s.ToCString() <<  "*" <<"\n";
-  return 0;
-}
-
-static Standard_Integer OCC310bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  if (nb != 1) {
-    di << "Usage: " << a[0] << "\n";
-    return 1;
-  }
-  OSD_Path p("/where/you/want/tmp/qwerty/tmp/");
-  di << p.Trek().ToCString() << "\n";
-  p.UpTrek();
-  di << p.Trek().ToCString() << "\n";
-  return 0;
-}
-
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgoAPI_Common.hxx>
-#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgo_Common.hxx>
-
-static Standard_Integer OCC277bug (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
-{
-  //if (nb != 1) {
-  //  cout << "Usage: " << a[0] << endl;
-  //  return 1;
-  //}
-  if(nb < 1 || nb > 2) {
-    di << "Usage : " << a[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (nb == 2) {
-    Standard_Integer IsB = atoi(a[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-    }
-  }
-
-  BRepPrimAPI_MakeBox box1( 100, 100, 100 );
-  BRepPrimAPI_MakeBox box2( gp_Pnt( 50, 50,50 ), 200, 200, 200 );
-
-  TopoDS_Shape shape1 = box1.Shape();
-  TopoDS_Shape shape2 = box2.Shape();
-
-//#if ! defined(BRepAlgoAPI_def01)
-//  TopoDS_Shape fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
-//  TopoDS_Shape comm = BRepAlgoAPI_Common( shape1, shape2 );
-//#else
-//  TopoDS_Shape fuse = BRepAlgo_Fuse( shape1, shape2 );
-//  TopoDS_Shape comm = BRepAlgo_Common( shape1, shape2 );
-//#endif
-  TopoDS_Shape fuse,comm;
-  if (IsBRepAlgoAPI) {
-    di << "fuse = BRepAlgoAPI_Fuse( shape1, shape2 )" <<"\n";
-    di << "comm = BRepAlgoAPI_Common( shape1, shape2 )" <<"\n";
-    fuse = BRepAlgoAPI_Fuse( shape1, shape2 );
-    comm = BRepAlgoAPI_Common( shape1, shape2 );
-  } else {
-    di << "fuse = BRepAlgo_Fuse( shape1, shape2 )" <<"\n";
-    fuse = BRepAlgo_Fuse( shape1, shape2 );
-    di << "comm = BRepAlgo_Common( shape1, shape2 )" <<"\n";
-    comm = BRepAlgo_Common( shape1, shape2 );
-  }
-
-  return 0;
-}
-
-#include <ShapeAnalysis_Edge.hxx>
-
-static Standard_Integer OCC333bug (Draw_Interpretor& di, Standard_Integer n, const char ** a)
-{
-  if( n < 3) {
-    di<<"-1"<<"\n";
-    di << "Usage: " << a[0] << " edge1 edge2 [toler domaindist]" << "\n";
-    return 1;
-  }
-  TopoDS_Shape Sh1 = DBRep::Get(a[1]);
-  TopoDS_Shape Sh2 = DBRep::Get(a[2]);
-  if(Sh1.IsNull() || Sh2.IsNull()) {
-    di<<"-2"<<"\n";
-    di<<"Invalid arguments"<<"\n";
-    return 1;
-  }
-  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
-  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
-  if(e1.IsNull() || e2.IsNull()) {
-    di<<"-3"<<"\n";
-    di<<"Invalid type of arguments"<<"\n";
-    return 1;
-  }
-  Standard_Real aTol = Precision::Confusion();
-  Standard_Real aDistDomain = 0.0;
-  Standard_Integer k = 3;
-  if(k < n)
-    aTol = atof(a[k++]);
-  if(k < n)
-    aDistDomain = atof(a[k++]);
-
-  ShapeAnalysis_Edge sae;
-  if(sae.CheckOverlapping(e1,e2,aTol,aDistDomain)) {
-    if(aDistDomain ==0.0) {
-      di<<"1"<<"\n";
-      di<<"Edges is overlaping comletly"<<"\n";
-    } else {
-      di<<"2"<<"\n";
-      di<<"Edges is overlaped"<<"\n";
-      di<<"with tolerance = "<<aTol<<"\n";
-      di<<"on segment length = "<<aDistDomain<<"\n";
-    }
-  } else {
-    di<<"3"<<"\n";
-    di<<"Edges is not overlaped"<<"\n";
-  }
-  return 0;
-}
-
-
-#include <DDocStd_DrawDocument.hxx>
-#include <TDataStd_Name.hxx>
-#include <Draw.hxx>
-#include <XCAFDoc_ShapeTool.hxx>
-#include <XCAFDoc_DocumentTool.hxx>
-#include <TDF_LabelSequence.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-#include <TDF_Data.hxx>
-#include <TDF_Label.hxx>
-#include <XCAFPrs_Driver.hxx>
-
-//------------------------------------------------------------------------------------------
-// name    : OCC363
-// Purpose :
-//------------------------------------------------------------------------------------------
-static Standard_Integer OCC363 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verufy amount of arguments
-    if(argc < 3) { di <<"Error OCC363 : Use : OCC363 document filename\n"; return 1; }
-
-    // 2. Retrieve DDocStd application
-    Handle(TDocStd_Application) App;
-    if (!DDocStd::Find(App)) { di << "Error OCC363 : There is no current DDocStd application\n";return 1;}
-
-    // 3. Open document
-    TCollection_ExtendedString name(argv[2]);
-    Handle(TDocStd_Document) Doc;
-    if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
-    Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
-    TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
-    Draw::Set(argv[1],DD);
-
-    // 4. Create prsentations
-    Handle(XCAFDoc_ShapeTool) shapes = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());
-    TDF_LabelSequence seq;
-    shapes->GetFreeShapes ( seq );
-    Handle(TPrsStd_AISPresentation) prs;
-    for ( Standard_Integer i=1; i <= seq.Length(); i++ )
-      if ( ! seq.Value(i).FindAttribute ( TPrsStd_AISPresentation::GetID(), prs ) )
-        prs = TPrsStd_AISPresentation::Set(seq.Value(i),XCAFPrs_Driver::GetID());
-  }
-  catch(Standard_Failure) { di << "FAULTY OCC363 : Exception during reading document.\n";return 0;}
-
-  di << "OCC363 OK\n";
-  return 0;
-}
-
-// Must use OCC299
-////======================================================================================
-//// Function : OCC372
-//// Purpose  :
-////======================================================================================
-//static Standard_Integer OCC372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-//{
-//  try
-//  {
-//    OCC_CATCH_SIGNALS
-//    // 1. Verufy amount of arguments
-//    if(argc < 2) {di << "OCC372 FAULTY. Use : OCC372 brep-file";return 0;}
-//
-//    // 2. Read solid
-//    BRep_Builder B;
-//    TopoDS_Shape Ref;
-//    BRepTools::Read(Ref, argv[1], B);
-//
-//    // 3. Calculate location of aP3d in relation to the solid
-//    gp_Pnt aP3d(6311.4862583184, -2841.3092756034, 16.461053497188);
-//    BRepClass3d_SolidClassifier SC(Ref);
-//    SC.Perform(aP3d, 1e-7);
-//
-//    // 4. Check returned state. The point must be inside the solid.
-//    TopAbs_State aState=SC.State();
-//    switch (aState)
-//    {
-//    case TopAbs_OUT:
-//      di<<"OCC372 FAULTY. aState = TopAbs_OUT";
-//      return 0;
-//    case TopAbs_ON:
-//      di<<"OCC372 FAULTY. aState = TopAbs_ON";
-//     return 0;
-//    case TopAbs_IN:
-//      di<<"OCC372 OK. aState = TopAbs_IN" ;
-//      return 0;
-//    default:
-//      di<<"OCC372 FAULTY. aState = UNKNOWN";
-//      return 0;
-//    }
-//  }
-//  catch (Standard_Failure) { di<<"OCC372 FAULTY. Exception raised"; }
-//
-//  return 0;
-//}
-
-#include <BRepTopAdaptor_FClass2d.hxx>
-
-//======================================================================================
-// Function : OCC377
-// Purpose  :
-//======================================================================================
-static Standard_Integer OCC377 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verify validity of arguments
-    if ( argc < 1 ) {di << "Error OCC377. Use  OCC377 file x y precuv \n";return 0;}
-
-    // 2. Initialize parameters
-    gp_Pnt2d p2d;
-    p2d.SetX ( atof(argv[2]) );
-    p2d.SetY ( atof(argv[3]) );
-    Standard_Real precuv = atof (argv[4] );
-
-    // 3. Read shape
-    BRep_Builder B;
-    TopoDS_Shape Shape;
-    BRepTools::Read ( Shape, argv[1], B );
-
-    // 4. Verify whether enrtry point is on wire and reversed ones (indeed results of veridying must be same)
-    TopExp_Explorer exp;
-    Standard_Integer i=1;
-    for (exp.Init(Shape.Oriented(TopAbs_FORWARD),TopAbs_WIRE); exp.More(); exp.Next(), i++)
-    {
-      // 4.1. Verify whether enrtry point is on wire
-      const TopoDS_Wire& wir = TopoDS::Wire(exp.Current());
-      TopoDS_Face newFace = TopoDS::Face(Shape.EmptyCopied());
-
-      TopAbs_Orientation orWire = wir.Orientation();
-      newFace.Orientation(TopAbs_FORWARD);
-      B.Add(newFace,wir);
-
-      BRepTopAdaptor_FClass2d FClass2d1(newFace,precuv);
-      TopAbs_State stat1 = FClass2d1.PerformInfinitePoint();
-      //di << "Wire " << i << ": Infinite point is " <<
-      //  ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
-
-      TCollection_AsciiString TmpString;
-      stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
-      di << "Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
-
-      stat1 = FClass2d1.Perform(p2d);
-      //di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
-      //  ( stat1 == TopAbs_IN ? "IN" : stat1 == TopAbs_OUT ? "OUT" : stat1 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
-
-      TmpString.Clear();
-      stat1 == TopAbs_IN ? TmpString.AssignCat("IN") : stat1 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat1 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
-      di << "Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
-
-      // 4.2. Verify whether enrtry point is on reversed wire
-      newFace = TopoDS::Face(Shape.EmptyCopied());
-      newFace.Orientation(TopAbs_FORWARD);
-      orWire = TopAbs::Reverse(orWire);
-      B.Add(newFace,wir.Oriented(orWire));
-      BRepTopAdaptor_FClass2d FClass2d2(newFace,precuv);
-      TopAbs_State stat2 = FClass2d2.PerformInfinitePoint();
-      //di << "Reversed Wire " << i << ": Infinite point is " <<
-      //  ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
-
-      TmpString.Clear();
-      stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
-      di << "Reversed Wire " << i << ": Infinite point is " << TmpString.ToCString() << "\n";
-
-      stat2 = FClass2d2.Perform(p2d);
-      //di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " <<
-      //  ( stat2 == TopAbs_IN ? "IN" : stat2 == TopAbs_OUT ? "OUT" : stat2 == TopAbs_ON ? "ON" : "UNKNOWN" ) << "\n";
-
-      TmpString.Clear();
-      stat2 == TopAbs_IN ? TmpString.AssignCat("IN") : stat2 == TopAbs_OUT ? TmpString.AssignCat("OUT") : stat2 == TopAbs_ON ? TmpString.AssignCat("ON") : TmpString.AssignCat("UNKNOWN");
-      di << "Reversed Wire " << i << ": point ( " << p2d.X() << ", " << p2d.Y() << " ) is " << TmpString.ToCString() << "\n";
-
-      // 4.3. Compare results (they must be same)
-      if(stat1 ==stat2) di << "OCC377 OK" << "\n";
-      else {di << "OCC377 FAULTY" << "\n"; return 0;}
-    }
-  }
-  catch(Standard_Failure)
-  {
-    di << "OCC377 Exception";
-  }
-
-  return 0;
-}
-
-#include <ShapeUpgrade_ShapeDivideAngle.hxx>
-#include <ShapeBuild_ReShape.hxx>
-
-//=======================================================================
-//function : OCC22
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC22 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verify arguments of the command
-    if (argc < 5) { di << "OCC22 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation"; return 0;}
-
-    Standard_Boolean aConsiderLocation;
-    if(strcmp(argv[4], "0")==0) aConsiderLocation = Standard_False;
-    else aConsiderLocation = Standard_True;
-
-    // 2. Iniitialize aShapeUpgrade
-    ShapeUpgrade_ShapeDivideAngle aShapeUpgrade(M_PI/2.);
-    // precision
-    aShapeUpgrade.SetPrecision (Precision::Confusion());
-    // tolerance
-    aShapeUpgrade.SetMaxTolerance(0.1);
-    // subshapes to be divided
-    TopoDS_Shape aSubShapesToBeDivided = DBRep::Get(argv[3]);
-    if(aSubShapesToBeDivided.IsNull()) {di << "OCC22 FAULTY. Compound of subshapes to be divided is not exist. Please, verify input values. \n";return 0;}
-    aShapeUpgrade.Init(aSubShapesToBeDivided);
-    // context
-    Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
-    aShapeUpgrade.SetContext(aReshape);
-    if(aConsiderLocation) aReshape->ModeConsiderLocation() = Standard_True;
-
-    // 3. Perform splitting
-    if (aShapeUpgrade.Perform (Standard_False))         di << "Upgrade_SplitRevolution_Done \n";
-    else if (aShapeUpgrade.Status (ShapeExtend_OK))     di << "Upgrade_SplitRevolution_OK \n";
-    else if (aShapeUpgrade.Status (ShapeExtend_FAIL)) { di << "OCC22 FAULTY. Operation failed. Angle was not divided\n";return 0;}
-
-    // 4. Perform rebuilding shape
-    // 4.1. Retrieve Shape
-    TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
-    if(anInitShape.IsNull()) { di << "OCC22 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
-    // 4.2 Rebuid retrieved shape
-    TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
-    // 4.3. Create result Draw shape
-    DBRep::Set(argv[1], aResultShape);
-  }
-  catch (Standard_Failure) {di << "OCC22 Exception \n" ;return 0;}
-
-  return 0;
-}
-
-
-#include <ShapeProcess_OperLibrary.hxx>
-#include <ShapeProcess_ShapeContext.hxx>
-#include <ShapeProcess.hxx>
-
-#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
-#include <BRepMesh_IncrementalMesh.hxx>
-
-//=======================================================================
-//function : OCC24
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC24 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verify amount of arguments of the command
-    if (argc < 6) { di << "OCC24 FAULTY. Use : OCC22 Result Shape CompoundOfSubshapes ResourceFileName SequenceName"; return 0;}
-
-    // 2. Retrieve parameters
-    // initial shape
-    TopoDS_Shape anInitShape = DBRep::Get(argv[2]);
-    if(anInitShape.IsNull()) { di << "OCC24 FAULTY. Initial shape is not exist. Please verify input values \n"; return 0;}
-    // compound of subshapes
-    TopoDS_Shape aSubShapes = DBRep::Get(argv[3]);
-    if(aSubShapes.IsNull()) {di << "OCC24 FAULTY. Compound of subshapes is not exist. Please, verify input values. \n";return 0;}
-    // name of resource file
-    const char* aResourceFile = argv[4];
-    // name of sequence from resource file to be executed
-    const char* aSequenceName = argv[5];
-
-    // 3. Initialize ShapeContext and perform sequence of operation specified with resource file
-    ShapeProcess_OperLibrary::Init();
-    Handle(ShapeProcess_ShapeContext) aShapeContext = new ShapeProcess_ShapeContext (aSubShapes, aResourceFile);
-    aShapeContext->SetDetalisation (TopAbs_EDGE);
-    ShapeProcess::Perform (aShapeContext, aSequenceName);
-
-    // 4. Rebuild initil shape in accordance with performed operation
-    Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
-    TopTools_DataMapIteratorOfDataMapOfShapeShape anIter (aShapeContext->Map());
-    for (; anIter.More(); anIter.Next())
-      aReshape->Replace(anIter.Key(), anIter.Value());
-    TopoDS_Shape aResultShape = aReshape->Apply(anInitShape);
-
-    // 5 Create resultant Draw shape
-    DBRep::Set(argv[1], aResultShape);
-
-  }
-  catch (Standard_Failure) {di << "OCC24 Exception \n" ;return 0;}
-
-  return 0;
-}
-
-//=======================================================================
-//function : OCC369
-//purpose  : Verify whether exception occurs during building mesh
-//=======================================================================
-static Standard_Integer OCC369(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    // 1. Verify amount of arguments of the command
-    if (argc < 2) { di << "OCC369 FAULTY. Use : OCC369 Shape \n"; return 0;}
-
-    // 2. Retrieve shape
-    TopoDS_Shape aShape = DBRep::Get(argv[1]);
-    if(aShape.IsNull()) {di << "OCC369 FAULTY. Entry shape is NULL \n"; return 0;}
-
-    // 3. Build mesh
-    BRepMesh_IncrementalMesh aMesh(aShape, 0.2, Standard_True, M_PI/6);
-
-  }
-  catch (Standard_Failure) {di << "OCC369 Exception \n" ;return 0;}
-
-  di << "OCC369 OK \n";
-  return 0;
-}
-
-#include <math_Vector.hxx>
-#include <math_Matrix.hxx>
-static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 9){
-    di<<"Usage : " << argv[0] << " LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix\n";
-    return 1;
-  }
-  Standard_Integer LowerVector = atoi(argv[1]);
-  Standard_Integer UpperVector = atoi(argv[2]);
-  Standard_Real InitialValueVector = atof(argv[3]);
-  Standard_Integer LowerRowMatrix = atoi(argv[4]);
-  Standard_Integer UpperRowMatrix = atoi(argv[5]);
-  Standard_Integer LowerColMatrix = atoi(argv[6]);
-  Standard_Integer UpperColMatrix = atoi(argv[7]);
-  Standard_Real InitialValueMatrix = atof(argv[8]);
-
-  math_Vector Vector1(LowerVector, UpperVector);
-  math_Vector Vector2(LowerVector, UpperVector);
-
-  math_Vector Vector(LowerVector, UpperVector, InitialValueVector);
-  math_Matrix Matrix(LowerRowMatrix, UpperRowMatrix, LowerColMatrix, UpperColMatrix, InitialValueMatrix);
-
-  //Vector.Dump(cout);
-  //cout<<endl;
-
-  //Matrix.Dump(cout);
-  //cout<<endl;
-
-  Vector1.Multiply(Vector, Matrix);
-
-  //Vector1.Dump(cout);
-  Standard_SStream aSStream1;
-  Vector1.Dump(aSStream1);
-  di << aSStream1;
-  di<<"\n";
-
-  Vector2.TMultiply(Vector, Matrix);
-
-  //Vector2.Dump(cout);
-  Standard_SStream aSStream2;
-  Vector2.Dump(aSStream2);
-  di << aSStream2;
-  di<<"\n";
-
-  return 0;
-}
-
-#include <GeomPlate_BuildPlateSurface.hxx>
-//=======================================================================
-//function : OCC525
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  try
-  {
-    OCC_CATCH_SIGNALS
-    GeomPlate_BuildPlateSurface aBuilder;
-    aBuilder.Perform();
-  }
-  catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
-  //catch (...) { di << "OCC525 Exception \n" ;return 0; }
-
-  di << "OCC525 OK \n";
-  return 0;
-}
-
-#include <Viewer2dTest.hxx>
-#include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx>
-
-#include <AIS2D_InteractiveContext.hxx>
-#include <V2d_View.hxx>
-#include <AIS2D_InteractiveObject.hxx>
-#include <TColStd_HSequenceOfInteger.hxx>
-
-#if ! defined(WNT)
-extern Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
-#else
-Standard_EXPORT Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
-#endif
-
-//=======================================================================
-//function :  OCC543
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC543 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  if(aContext.IsNull()) {
-    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  if(argc != 2){
-    di<<"Usage : " << argv[0] << " name\n";
-    return -1;
-  }
-  Handle(V2d_View) V = Viewer2dTest::CurrentView();
-
-  TCollection_AsciiString name = argv[1];
-
-  if (!GetMapOfAIS2D().IsBound2(name)) {
-//    di << "There is not an object with name " << name.ToCString() << "\n";
-//    return -1;
-  }
-
-  Handle(AIS2D_InteractiveObject) aShape = GetMapOfAIS2D().Find2(name);
-  Standard_Integer PickedIndex = aShape->PickedIndex();
-  di << "PickedIndex = " << PickedIndex << "\n";
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeWedge.hxx>
-#include <gce_MakeRotation.hxx>
-#include <gce_MakeTranslation.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
-#include <BRepPrimAPI_MakeWedge.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgo_Cut.hxx>
-//=======================================================================
-//function :  OCC578
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC578 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  //if (argc!=4) {
-  //  di<<"Usage : " << argv[0] << " shape1 shape2 shape3\n";
-  //  return 1;
-  //}
-  if(argc < 4 || argc > 5) {
-    di << "Usage : " << argv[0] << " shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 5) {
-    Standard_Integer IsB = atoi(argv[4]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
-//      return 1;
-    }
-  }
-
-  gp_Pnt P0(0,0,0.0);
-  double xperiod = 1.0;
-  double yperiod = 1.0;
-  double sub_thick = 0.5;
-
-  // mask_substrate
-  //TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick );
-  TopoDS_Shape substrate = BRepPrimAPI_MakeBox( P0, xperiod, yperiod, sub_thick ).Shape();
-
-  // --------------------------------------------------------------------
-
-  // wedge
-  //TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
-       //                                    0.1,  0.1  , 0.4, 0.4 );
-  TopoDS_Shape wedge1 = BRepPrimAPI_MakeWedge(0.5, 0.05, 0.5,
-                                             0.1,  0.1  , 0.4, 0.4 ).Shape();
-
-  gp_Trsf rotate = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
-                                    gp_Dir(1.0,0.0,0.0),
-                                    1.570795 );
-
-  gp_Trsf translate = gce_MakeTranslation(gp_Pnt( 0.0, -0.5, 0.0),
-                                         gp_Pnt( 0.25, 0.25, 0.5)
-                                         );
-
-  rotate.PreMultiply( translate );
-
-  TopoDS_Shape wedge1a = BRepBuilderAPI_Transform( wedge1, rotate );
-
-  if (wedge1a.IsNull()) {
-    di<<" Null shape1 is not allowed\n";
-    return 1;
-  }
-  DBRep::Set(argv[1], wedge1a);
-
-  // --------------------------------------------------------------------
-
-  // wedge top
-  //TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
-       //                                    0.1,  0.1  , 0.4, 0.4 );
-  TopoDS_Shape wedge2 = BRepPrimAPI_MakeWedge(0.5, 0.3, 0.5,
-                                             0.1,  0.1  , 0.4, 0.4 ).Shape();
-
-  gp_Trsf rotate2 = gce_MakeRotation ( gp_Pnt(0.0,0.0,0.0),
-                                     gp_Dir(1.0,0.0,0.0),
-                                     1.570795 * 3.0 );
-
-  gp_Trsf translate2 = gce_MakeTranslation(gp_Pnt( 0.0, 0.0, 0.0),
-                                          gp_Pnt( 0.25, 0.25, 0.5)
-                                          );
-
-  rotate2.PreMultiply( translate2 );
-
-  TopoDS_Shape wedge2a = BRepBuilderAPI_Transform( wedge2, rotate2 );
-
-  if (wedge2a.IsNull()) {
-    di<<" Null shape2 is not allowed\n";
-    return 1;
-  }
-  DBRep::Set(argv[2], wedge2a);
-
-
-  // combine wedges
-//#if ! defined(BRepAlgoAPI_def01)
-//  TopoDS_Shape wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
-//#else
-//  TopoDS_Shape wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
-//#endif
-  TopoDS_Shape wedge_common;
-  if (IsBRepAlgoAPI) {
-    di << "wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a)" <<"\n";
-    wedge_common = BRepAlgoAPI_Fuse(wedge1a , wedge2a);
-  } else {
-    di << "wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a)" <<"\n";
-    wedge_common = BRepAlgo_Fuse(wedge1a , wedge2a);
-  }
-
-  // remove wedge area from substrate
-//#if ! defined(BRepAlgoAPI_def01)
-//  TopoDS_Shape sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
-//#else
-//  TopoDS_Shape sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
-//#endif
-  TopoDS_Shape sub_etch1;
-  if (IsBRepAlgoAPI) {
-    di << "sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common)" <<"\n";
-    sub_etch1 = BRepAlgoAPI_Cut(substrate, wedge_common);
-  } else {
-    di << "sub_etch1 = BRepAlgo_Cut(substrate, wedge_common)" <<"\n";
-    sub_etch1 = BRepAlgo_Cut(substrate, wedge_common);
-  }
-
-  if (sub_etch1.IsNull()) {
-    di<<" Null shape3 is not allowed\n";
-    return 1;
-  }
-  DBRep::Set(argv[3], sub_etch1);
-
-  return 0;
-}
-
-#include <Graphic2d_DisplayList.hxx>
-#include <Graphic2d_View.hxx>
-
-//=======================================================================
-//function :  OCC627
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  if(aContext.IsNull()) {
-    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  if(argc != 1){
-    di<<"Usage : " << argv[0] << "\n";
-    return -1;
-  }
-
-  Handle(V2d_View) V = Viewer2dTest::CurrentView();
-  Handle(Graphic2d_View) View = V->View();
-  Handle(Graphic2d_DisplayList) DisplayList = View->DisplayList();
-  Standard_Integer Length = DisplayList->Length();
-  di << "Length = " << Length << "\n";
-
-  return 0;
-}
-
-#include <Standard_GUID.hxx>
-//=======================================================================
-//function :  OCC669
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC669 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 2){
-    di<<"Usage : " << argv[0] << " GUID\n";
-    return -1;
-  }
-  Standard_GUID guid(argv[1]);
-  //guid.ShallowDump(cout);
-  Standard_SStream aSStream;
-  guid.ShallowDump(aSStream);
-  di << aSStream;
-  di<<"\n";
-  return 0;
-}
-
-#include <XCAFDoc.hxx>
-//=======================================================================
-//function :  OCC738_ShapeRef
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC738_ShapeRef (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 1){
-    di<<"Usage : " << argv[0] << "\n";
-    return -1;
-  }
-  const Standard_GUID& guid = XCAFDoc::ShapeRefGUID ();
-  //guid.ShallowDump(cout);
-  Standard_SStream aSStream;
-  guid.ShallowDump(aSStream);
-  di << aSStream;
-  return 0;
-}
-
-//=======================================================================
-//function :  OCC738_Assembly
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC738_Assembly (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 1){
-    di<<"Usage : " << argv[0] << "\n";
-    return -1;
-  }
-  const Standard_GUID& guid = XCAFDoc::AssemblyGUID ();
-  //guid.ShallowDump(cout);
-  Standard_SStream aSStream;
-  guid.ShallowDump(aSStream);
-  di << aSStream;
-  return 0;
-}
-
-#if defined(DDataStd_def01)
-#include <DDataStd_DrawPresentation.hxx>
-//=======================================================================
-//function :  OCC739_DrawPresentation
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC739_DrawPresentation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 1){
-    di<<"Usage : " << argv[0] << "\n";
-    return -1;
-  }
-  const Standard_GUID& guid = DDataStd_DrawPresentation::GetID() ;
-  //guid.ShallowDump(cout);
-  Standard_SStream aSStream;
-  guid.ShallowDump(aSStream);
-  di << aSStream;
-  return 0;
-}
-#endif
-
-//=======================================================================
-//function :  OCC708
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC708 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-
-  if ( argc != 2) {
-    di << "ERROR : Usage : " << argv[0] << " shape ; Deactivate the current transformation" << "\n";
-    return 1;
-  }
-  
-  Standard_Boolean updateviewer = Standard_True, PutInCollector = Standard_True;
-
-  ViewerTest_DoubleMapOfInteractiveAndName& aMap = GetMapOfAIS();
-  
-  TCollection_AsciiString aName(argv[1]);
-  Handle(AIS_InteractiveObject) AISObj;
-
-  if(!aMap.IsBound2(aName)) {
-    di << "Use 'vdisplay' before" << "\n";
-    return 1;
-  } else {
-    AISObj = Handle(AIS_InteractiveObject)::DownCast(aMap.Find2(aName));
-    if(AISObj.IsNull()){
-      di << argv[1] << " : No interactive object" << "\n";
-      return 1;
-    } 
-    AISObj->UnsetTransformation();
-    if (!aContext->HasOpenedContext()) {
-      aContext->OpenLocalContext();
-    }
-    aContext->Erase(AISObj, updateviewer, PutInCollector);
-    aContext->UpdateCurrentViewer();
-    aContext->Display(AISObj, updateviewer);
-    aContext->UpdateCurrentViewer();
-  }
-  return 0;
-}
-
-//=======================================================================
-//function :  OCC670
-//purpose  :
-//=======================================================================
-#include <TColStd_Array2OfInteger.hxx>
-static Standard_Integer OCC670 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 1){
-    di<<"Usage : " << argv[0] << "\n";
-    return -1;
-  }
-  TColStd_Array2OfInteger Array2OfInteger(1,1,1,1);
-  Array2OfInteger.SetValue(5,5,55);
-  return 0;
-}
-
-#include <GeomAPI_ProjectPointOnSurf.hxx>
-//=======================================================================
-//function :  OCC867
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC867(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc!=7)  
-  {
-    di<<"Usage : " << argv[0] << " Point Surface Umin Usup Vmin Vsup \n";
-    return 1;   
-  }
-  
-  gp_Pnt aPoint3d;        
-  DrawTrSurf::GetPoint(argv[1],aPoint3d);
-  Handle (Geom_Surface) aSurface=DrawTrSurf::GetSurface(argv[2]);
-  Standard_Real             Umin=atof(argv[3]);
-  Standard_Real             Usup=atof(argv[4]);
-  Standard_Real             Vmin=atof(argv[5]);
-  Standard_Real             Vsup=atof(argv[6]);
-  if (aSurface.IsNull()) {
-    di << argv[2] << " Null surface \n" ;
-    return 1;
-  }
-  
-  GeomAPI_ProjectPointOnSurf PonSurf;
-  PonSurf.Init(aSurface, Umin, Usup, Vmin, Vsup);
-  PonSurf.Perform(aPoint3d);
-
-  return 0; 
-}
-
-//=======================================================================
-//function :  OCC909
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC909 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc!=3)  
-  {
-    di<<"Usage : " << argv[0] << " wire face\n";
-    return 1;   
-  }
-  
-  TopoDS_Wire awire = TopoDS::Wire(DBRep::Get(argv[1])); //read the wire
-  TopoDS_Face aface = TopoDS::Face(DBRep::Get(argv[2])); //read the face
-  if (awire.IsNull() || aface.IsNull()) {
-    di << "Null object" << "\n";
-    return 1;
-  }
-
-  Standard_Integer count = 0;
-  TopExp_Explorer TE(awire, TopAbs_VERTEX);
-  if ( TE.More()) {
-    BRepTools_WireExplorer WE;
-    for ( WE.Init(awire,aface); WE.More(); WE.Next()) {
-      TopoDS_Edge E = WE.Current();
-      count++;
-    }
-  }
-  di << "Count = " << count << "\n";
-
-  return 0; 
-}
-
-//=======================================================================
-//function :  OCC921
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC921 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc =! 2)
-  {
-    di <<"Usage : " << argv[0] << " face"<<"\n";
-    return 1;
-  }
-  Standard_Real u1, u2, v1, v2;
-  TopoDS_Face F = TopoDS::Face( DBRep::Get(argv[1]) ); //read the shape
-  if (F.IsNull())
-    return 1;
-  BRepTools::UVBounds(F, u1, u2, v1, v2);
-  di << "Bounds: " << u1 << "   " << u2 << "   " << v1 << "   " << v2 << "\n";
-  return 0;
-}
-
-#include <Expr_NamedUnknown.hxx>
-#include <Expr_GeneralExpression.hxx>
-#include <Expr_Exponential.hxx>
-//=======================================================================
-//function :  OCC902
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC902(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc =! 2)
-  {
-    di <<"Usage : " << argv[0] << " expression"<<"\n";
-    return 1;
-  }
-
- TCollection_AsciiString  myStr(argv[1]);
-
- Handle (Expr_NamedUnknown)      myNamed = new Expr_NamedUnknown(myStr);
- Handle (Expr_Exponential)       oldExpr = new Expr_Exponential(myNamed); 
- Handle (Expr_GeneralExpression) newExpr = oldExpr->Derivative(myNamed);
-
- TCollection_AsciiString  res        = newExpr->String();
- Standard_CString         resStr     = res.ToCString();
- TCollection_AsciiString  res_old    = oldExpr->String();
- Standard_CString         res_oldStr = res_old.ToCString();
-
- di << "X = " << argv[1] << "\n";
- di << "Y = " << res_oldStr << "\n";
- di << "Y' = " << resStr  << "\n";
-
- return 0;
-}
-
-#include <DDF.hxx>
-#include <TPrsStd_AISViewer.hxx>
-#include <TDF_Label.hxx>
-#include <TPrsStd_AISPresentation.hxx>
-//=======================================================================
-//function : OCC1029_AISTransparency 
-//purpose  : OCC1029_AISTransparency  (DOC,entry,[real])
-//=======================================================================
-
-static Standard_Integer OCC1029_AISTransparency (Draw_Interpretor& di,
-                                            Standard_Integer nb, 
-                                            const char ** arg) 
-{
-  if (nb >= 3 ) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetTransparency(atof(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else {
-         di << "Transparency = " << prs->Transparency() << "\n";
-      }
-      return 0;
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-//=======================================================================
-//function : OCC1030_AISColor 
-//purpose  : OCC1030_AISColor (DOC,entry,[color])
-//=======================================================================
-
-static Standard_Integer OCC1030_AISColor (Draw_Interpretor& di,
-                                     Standard_Integer nb, 
-                                     const char ** arg) 
-{
-  if (nb >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetColor((Quantity_NameOfColor)atoi(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else
-         di << "Color = " << prs->Color() << "\n";
-      return 0; 
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-//=======================================================================
-//function : OCC1031_AISMaterial
-//purpose  : OCC1031_AISMaterial (DOC,entry,[material])
-//=======================================================================
-
-static Standard_Integer OCC1031_AISMaterial (Draw_Interpretor& di,
-                                        Standard_Integer nb,
-                                        const char ** arg)
-{
-  if (nb >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetMaterial((Graphic3d_NameOfMaterial)atoi(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else {
-         di << "Material = " << prs->Material() << "\n";
-      }
-      return 0;
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-//=======================================================================
-//function : OCC1032_AISWidth
-//purpose  : OCC1032_AISWidth (DOC,entry,[width])
-//=======================================================================
-
-static Standard_Integer OCC1032_AISWidth (Draw_Interpretor& di,
-                                     Standard_Integer nb, 
-                                     const char ** arg) 
-{
-  if (nb >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetWidth(atof(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else {
-         di << "Width = " << prs->Width() << "\n";
-      }
-      return 0;
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-//=======================================================================
-//function : OCC1033_AISMode
-//purpose  : OCC1033_AISMode (DOC,entry,[mode])
-//=======================================================================
-
-static Standard_Integer OCC1033_AISMode (Draw_Interpretor& di,
-                                    Standard_Integer nb, 
-                                    const char ** arg) 
-{
-  if (nb >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetMode(atoi(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else {
-         di << "Mode = " << prs->Mode() << "\n";
-      }
-      return 0;
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-//=======================================================================
-//function : OCC1034_AISSelectionMode
-//purpose  : OCC1034_AISSelectionMode (DOC,entry,[selectionmode])
-//=======================================================================
-
-static Standard_Integer OCC1034_AISSelectionMode (Draw_Interpretor& di,
-                                             Standard_Integer nb, 
-                                             const char ** arg) 
-{
-  if (nb >= 3) {     
-    Handle(TDocStd_Document) D;
-    if (!DDocStd::GetDocument(arg[1],D)) return 1;  
-    TDF_Label L;
-    if (!DDF::FindLabel(D->GetData(),arg[2],L)) return 1;  
-
-    Handle(TPrsStd_AISViewer) viewer;
-    if( !TPrsStd_AISViewer::Find(L, viewer) ) return 1;  
-
-    Handle(TPrsStd_AISPresentation) prs;
-    if(L.FindAttribute( TPrsStd_AISPresentation::GetID(), prs) ) {   
-      if( nb == 4 ) {
-       prs->SetSelectionMode(atoi(arg[3]));
-       TPrsStd_AISViewer::Update(L);
-      }
-      else {
-         di << "SelectionMode = " << prs->SelectionMode() << "\n";
-      }
-      return 0;
-    }
-  }
-  di << arg[0] << " : Error" << "\n";
-  return 1;
-}
-
-#include<BRepAlgoAPI_Cut.hxx>
-#include<BRepAlgo_Cut.hxx>
-//=======================================================================
-//function :  OCC1487
-//purpose  :
-//=======================================================================
-static Standard_Integer OCC1487 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  //if(argc != 5) {
-  //  cerr << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape" << endl;
-  //  return -1;
-  //}
-  if(argc < 5 || argc > 6) {
-    di << "Usage : " << argv[0] << " CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 6) {
-    Standard_Integer IsB = atoi(argv[5]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
-//      return 1;
-    }
-  }
-
-  Standard_Integer CaseNumber = atoi(argv[1]);
-
-  //BRepPrimAPI_MakeCylinder o_mc1 (gp_Ax2 (gp_Pnt(0,-50,140), gp_Dir(1,0,0)), 50,1000);
-  gp_Dir myDir(1,0,0);
-  gp_Pnt myPnt(0,-50,140);
-  gp_Ax2 myAx2(myPnt, myDir);
-  BRepPrimAPI_MakeCylinder o_mc1 (myAx2, 50,1000);
-
-  TopoDS_Shape cyl1 = o_mc1.Shape();
-
-  TopoDS_Shape cyl2;
-  TopoDS_Shape o_cut_shape;
-  if (CaseNumber == 1) {
-    //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(21.65064, -50.0, 127.5),gp_Dir(-sin(M_PI/3), 0.0, 0.5)), 5, 150);
-    gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
-    gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
-    gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
-    BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
-
-    cyl2 = o_mc2.Shape();
-//#if ! defined(BRepAlgoAPI_def01)
-//    o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#else
-//    o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#endif
-    if (IsBRepAlgoAPI) {
-      di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
-      o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-    } else {
-      di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
-      o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-    }
-  } else {
-    //BRepPrimAPI_MakeCylinder o_mc2 (gp_Ax2 (gp_Pnt(978.34936, -50.0, 127.5),gp_Dir(sin(M_PI/3), 0.0, 0.5)), 5, 150);
-    gp_Dir myDir_mc2(-sin(M_PI/3), 0.0, 0.5);
-    gp_Pnt myPnt_mc2(21.65064, -50.0, 127.5);
-    gp_Ax2 myAx2_mc2(myPnt_mc2, myDir_mc2);
-    BRepPrimAPI_MakeCylinder o_mc2 (myAx2_mc2, 5, 150);
-
-    cyl2 = o_mc2.Shape();
-//#if ! defined(BRepAlgoAPI_def01)
-//    o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#else
-//    o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-//#endif
-    if (IsBRepAlgoAPI) {
-      di << "o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
-      o_cut_shape = BRepAlgoAPI_Cut (o_mc1.Solid (), o_mc2.Solid ());
-    } else {
-      di << "o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ())" <<"\n";
-      o_cut_shape = BRepAlgo_Cut (o_mc1.Solid (), o_mc2.Solid ());
-    }
-  }
-
-  DBRep::Set(argv[2],cyl1);
-  DBRep::Set(argv[3],cyl2);
-  DBRep::Set(argv[4],o_cut_shape);
-
-  return 0;
-}
-
-#include<TopTools_ListIteratorOfListOfShape.hxx>
-#include<BRepFilletAPI_MakeFillet.hxx>
-//=======================================================================
-//function :  OCC1077
-//purpose  :
-//=======================================================================
-TopoDS_Shape OCC1077_boolbl(BRepAlgoAPI_BooleanOperation& aBoolenaOperation,const Standard_Real aRadius)
-{
-  Standard_Real t3d = 1.e-4;
-  Standard_Real t2d = 1.e-5;
-  Standard_Real ta  = 1.e-2;
-  Standard_Real fl  = 1.e-3;
-  Standard_Real tapp_angle = 1.e-2;
-  GeomAbs_Shape blend_cont = GeomAbs_C1;
-
-  TopoDS_Shape ShapeCut = aBoolenaOperation.Shape();
-
-//#ifdef OCC40 
-//  Handle_TopOpeBRepBuild_HBuilder build = aBoolenaOperation.Builder();
-//#endif 
-  TopTools_ListIteratorOfListOfShape its;
-
-  TopoDS_Compound result;
-  BRep_Builder B;
-  B.MakeCompound(result);
-
-  TopExp_Explorer ex;
-  for (ex.Init(ShapeCut, TopAbs_SOLID); ex.More(); ex.Next())
-    {
-      const TopoDS_Shape& cutsol = ex.Current();
-
-      BRepFilletAPI_MakeFillet fill(cutsol);
-      fill.SetParams(ta, t3d, t2d, t3d, t2d, fl);
-      fill.SetContinuity(blend_cont, tapp_angle);
-//#ifdef OCC40
-//      its = build->Section();
-//#else //OCC40DEV
-      its = aBoolenaOperation.SectionEdges();
-//#endif
-      while (its.More())
-       {
-         TopoDS_Edge E = TopoDS::Edge(its.Value());
-         fill.Add(aRadius, E);
-         its.Next();
-       }
-
-      fill.Build();
-      if (fill.IsDone())
-       {
-         B.Add(result, fill.Shape());
-       }
-      else
-       {
-         B.Add(result, cutsol);
-       }
-    }
-  return result;
-}
-
-TopoDS_Shape OCC1077_cut_blend(const TopoDS_Shape& aShapeToCut, const TopoDS_Shape& aTool, const Standard_Real aRadius)
-{
-  //return OCC1077_boolbl(BRepAlgoAPI_Cut(aShapeToCut, aTool),aRadius);
-  BRepAlgoAPI_Cut aCut(aShapeToCut, aTool);
-  return OCC1077_boolbl(aCut,aRadius);
-}
-
-//TopoDS_Shape OCC1077_common_blend(const TopoDS_Shape& aShape1, const TopoDS_Shape& aShape2, const Standard_Real aRadius)
-//{
-//  return OCC1077_boolbl(BRepAlgoAPI_Common(aShape1, aShape2),aRadius);
-//}
-
-TopoDS_Shape OCC1077_Bug()
-{
-  TopoDS_Shape theBox = BRepPrimAPI_MakeBox(gp_Pnt(-5, - 5, - 5), 10, 10, 10).Shape();
-  TopoDS_Shape theSphere = BRepPrimAPI_MakeSphere(7).Shape();
-
-  TopoDS_Shape theCommon = BRepAlgoAPI_Common(theBox,theSphere);
-  TopoDS_Shape theCylinder1 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, 0, - 10),
-                                                             gp_Dir(0, 0, 1)), 3, 20).Shape();
-  TopoDS_Shape theCylinder2 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(-10, 0, 0),
-                                                             gp_Dir(1, 0, 0)), 3, 20).Shape();
-  TopoDS_Shape theCylinder3 = BRepPrimAPI_MakeCylinder(gp_Ax2(gp_Pnt(0, - 10, 0),
-                                                             gp_Dir(0, 1, 0)), 3, 20).Shape();
-  TopoDS_Shape theTmp1 = OCC1077_cut_blend(theCommon,theCylinder1,0.7);
-  Handle_ShapeFix_Shape fixer = new ShapeFix_Shape(theTmp1);
-  fixer->Perform();
-  theTmp1 = fixer->Shape();
-  TopoDS_Shape theTmp2 = OCC1077_cut_blend(theTmp1,theCylinder2,0.7);
-  fixer->Init(theTmp2);
-  fixer->Perform();
-  theTmp2 = fixer->Shape();
-  TopoDS_Shape theResult = OCC1077_cut_blend(theTmp2,theCylinder3,0.7);
-  fixer->Init(theResult);
-  fixer->Perform();
-  theResult = fixer->Shape();
-  return theResult;
-}
-
-static Standard_Integer OCC1077 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc < 1 || argc > 2) {
-    di << "Usage : " << argv[0] << " result" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape S = OCC1077_Bug();
-  DBRep::Set(argv[1],S);
-
-  return 0;
-}
-
-//////////////////////////////////////////////////////////////
-/*!
- * Compute uniform distribution of points using GCPnts_UniformAbscissa
- */
-//////////////////////////////////////////////////////////////
-static Standard_Integer OCC5739_UniAbs (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 4)
-  {
-    di << "Usage : " << argv[0] << " name shape step" << "\n";
-    return 1;
-  }
-  const char *name = argv[1];
-  Adaptor3d_Curve *adapCurve=NULL;
-  Handle(Geom_Curve) curve = DrawTrSurf::GetCurve(argv[2]);
-  if (!curve.IsNull())
-    adapCurve = new GeomAdaptor_Curve(curve);
-  else
-  {
-    TopoDS_Shape wire = DBRep::Get(argv[2]);
-    if (wire.IsNull() || wire.ShapeType() != TopAbs_WIRE)
-    {
-      di << argv[0] <<" Faulty : incorrect 1st parameter, curve or wire expected"<<"\n";
-      return 1;
-    }
-    adapCurve = new BRepAdaptor_CompCurve(TopoDS::Wire(wire));
-  }
-  double step = atof(argv[3]);
-  GCPnts_UniformAbscissa aUni(*adapCurve, step);
-  int res;
-  if (!aUni.IsDone())
-  {
-    di << argv[0] <<" : fail"<<"\n";
-    res = 1;
-  }
-  else
-  {
-    int i, np = aUni.NbPoints();
-    for (i=0; i < np; i++)
-    {
-      double par = aUni.Parameter(i+1);
-      gp_Pnt p = adapCurve->Value(par);
-      char n[20], *pname=n;
-      sprintf(n,"%s_%d",name,i+1);
-      DrawTrSurf::Set(pname,p);
-      di<<pname<<" ";
-    }
-    res = 0;
-  }
-  delete adapCurve;
-  return res;
-}
-
-static Standard_Integer OCC6046 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 3)
-  {
-    di << "Usage : " << argv[0] << " nb_of_vectors size" << "\n";
-    return 1;
-  }
-
-  Standard_Integer nb = atoi(argv[1]);
-  Standard_Integer sz = atoi(argv[2]);
-  Standard_Real val = 10;
-  math_Vector **pv = new math_Vector *[nb];
-
-  di<<"creating "<<nb<<" vectors "<<sz<<" elements each..."<<"\n";
-  Standard_Integer i;
-  for (i=0; i < nb; i++) {
-    pv[i] = new math_Vector (1, sz, val);
-    if ((i % (nb/10)) == 0) {
-      di<<" "<<i;
-      //cout.flush();
-      di<<"\n";
-    }
-  }
-  di<<" done"<<"\n";
-  di<<"deleting them ..."<<"\n";
-  for (i=0; i < nb; i++) {
-    delete pv[i];
-    if ((i % (nb/10)) == 0) {
-      di<<" "<<i;
-      //cout.flush();
-      di<<"\n";
-    }
-  }
-  di<<" done"<<"\n";
-
-  delete [] pv;
-
-  return 0;
-}
-
-static Standard_Integer OCC5698 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2)
-  {
-    di << "Usage : " << argv[0] << " wire" << "\n";
-    return 1;
-  }
-  TopoDS_Shape shape = DBRep::Get(argv[1],TopAbs_WIRE);
-  if (shape.IsNull())
-    return 1;
-  TopoDS_Wire wire = TopoDS::Wire(shape);
-  // create curve parameterised by curvilinear distance
-  BRepAdaptor_CompCurve curve(wire,Standard_True);
-  Standard_Real length = curve.LastParameter();
-  Standard_Real need_length = length/2;
-  gp_Pnt pnt;
-  curve.D0(need_length,pnt);
-  // create check_curve parameterised in a general way
-  BRepAdaptor_CompCurve check_curve(wire);
-  Standard_Real check_par =
-    GCPnts_AbscissaPoint(check_curve, need_length, 0).Parameter();
-  gp_Pnt check_pnt;
-  check_curve.D0(check_par,check_pnt);
-  // check that points are coinsiding
-  Standard_Real error_dist = pnt.Distance(check_pnt);
-  if (error_dist > Precision::Confusion()) {
-    //cout.precision(3);
-    di<<"error_dist = "<<error_dist<<
-      "  ( "<<error_dist/need_length*100<<" %)"<<"\n";
-    return 0;
-  }
-  di<<"OK"<<"\n";
-  return 0;
-}
-
-static char sarr[2000];
-static int si=1;
-static int StackOverflow(int i = -1)
-{
-  char arr[2000];
-  if (si == 1) {
-    si = 0;
-    memcpy(arr,sarr,2000);
-    arr[1999]=0;
-    int n = strlen(arr), s=0;
-    while (n--)
-      s += StackOverflow(i-1);
-    return i + s + StackOverflow(i-1);
-  }
-  else if (i != 0) {
-    return i + StackOverflow(i-1);
-  }
-  si = 1;
-  return i;
-}
-
-#ifdef WNT
-// this code does not work with optimize mode on Windows
-#pragma optimize( "", off )
-#endif
-static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1)
-    {
-      di << "Usage : " << argv[0] << "\n";
-      return 1;
-    }
-  Standard_Boolean Succes;
-  
-  Succes = Standard_True;
-  //OSD::SetSignal();
-
-  {//==== Test Divide ByZero (Integer) ========================================
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Integer) Divide By Zero...";
-      //cout.flush();
-      di << "\n";
-      Standard_Integer res, a =4, b = 0 ;
-      res = a / b;
-      di << " 4 / 0 = " << res << "  Does not Caught... KO"<< "\n";
-      Succes = Standard_False;
-    }
-#if defined(SOLARIS) || defined(WNT)
-    catch(Standard_DivideByZero)
-#else
-    catch(Standard_NumericError)
-#endif
-    {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-#ifndef NO_CXX_EXCEPTION
-    // this case tests if (...) supersedes (Standard_*),
-    // the normal behaviour is not
-    catch(...) {
-      di<<" unknown exception... (But) Ok"<<"\n";
-    }
-#endif
-  }
-
-  {//==== Test Divide ByZero (Real) ===========================================
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Real) Divide By Zero...";
-      //cout.flush();
-      di << "\n";
-      Standard_Real res, a= 4.0, b=0.0;
-      res = a / b;
-      di << " 4.0 / 0.0 = " << res << "  Does not Caught... KO"<< "\n";
-      Succes = Standard_False;
-    }
-#if defined(SOLARIS) || defined(WNT)
-    catch(Standard_DivideByZero)
-#else
-    catch(Standard_NumericError)
-#endif
-    {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-  {//==== Test Overflow (Integer) =============================================
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Integer) Overflow...";
-      //cout.flush();
-      di << "\n";
-      Standard_Integer res, i=IntegerLast();
-      res = i + 1;
-      //++++ cout << " -- "<<res<<"="<<i<<"+1   Does not Caught... KO"<< endl;
-      //++++ Succes = Standard_False;
-      di << " "<<res<<"="<<i<<"+1  Does not Caught... (But) Ok"<< "\n";
-    }
-    catch(Standard_Overflow) {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-  {//==== Test Overflow (Real) ================================================ 
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Real) Overflow...";
-      //cout.flush();
-      di << "\n";
-      Standard_Real res, r=RealLast();
-      res = r * r;
-      
-      sin(1.); //this function tests FPU flags and raises signal (tested on LINUX).
-
-      di << "-- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... KO"<< "\n";
-      Succes = Standard_False;
-    }
-#if defined(SOLARIS) || defined(WNT)
-    catch(Standard_Overflow)
-#else
-    catch(Standard_NumericError)
-#endif
-    {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-  {//==== Test Underflow (Real) ===============================================
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Real) Underflow";
-      //cout.flush();
-      di << "\n";
-      Standard_Real res, r=1.0e-308;
-      res = r * r;
-      //res = res + 1.;
-      //++++ cout<<"-- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... KO"<<endl;
-      //++++ Succes = Standard_False;
-      di<<" -- "<<res<<"="<<r<<"*"<<r<<"   Does not Caught... (But) Ok"<<"\n";
-    }
-#if defined(SOLARIS) || defined(WNT)
-    catch(Standard_Underflow)
-#else
-    catch(Standard_NumericError)
-#endif
-    {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-  {//==== Test Invalid Operation (Real) ===============================================
-    try{
-      OCC_CATCH_SIGNALS
-      di << "(Real) Invalid Operation...";
-      //cout.flush();
-      di << "\n";
-      Standard_Real res, r=-1;
-      res = sqrt(r);
-      di<<" "<<res<<"=sqrt("<<r<<")  Does not Caught... KO"<<"\n";
-      Succes = Standard_False;
-    }
-    catch(Standard_NumericError) {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-  {//==== Test Access Violation ===============================================
-    try {
-      OCC_CATCH_SIGNALS
-      di << "Segmentation Fault...";
-      //cout.flush();
-      di << "\n";
-      int* pint=NULL;
-      *pint = 4;
-      di << "  Does not Caught... KO"<<"\n";
-      Succes = Standard_False;
-    }
-#ifdef WNT
-    catch(OSD_Exception_ACCESS_VIOLATION)
-#else
-    catch(OSD_SIGSEGV)
-#endif
-    {
-      di << " Ok"<< "\n";
-    } catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-
-#ifdef WNT
-  {//==== Test Stack Overflow ===============================================
-    try {
-      OCC_CATCH_SIGNALS
-      di << "Stack Overflow...";
-      //cout.flush();
-      di << "\n";
-      StackOverflow();
-      di << "  Does not Caught... KO"<<"\n";
-      Succes = Standard_False;
-    }
-    catch(OSD_Exception_STACK_OVERFLOW) {
-      di << " Ok"<< "\n";
-    }
-    catch(Standard_Failure) {
-      //cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
-      di << " Caught (";
-      di << Standard_Failure::Caught()->GetMessageString();
-      di << ")... KO" << "\n";
-      Succes = Standard_False;
-    }
-  }
-#endif
-
- if(Succes) {
-   di << "TestExcept: Successfull completion" << "\n";
- } else {
-   di << "TestExcept: failure" << "\n";
- }
-
-  return 0;
-}
-#ifdef WNT
-#pragma optimize( "", on )
-#endif
-
-static TopoDS_Compound AddTestStructure(int nCount_)
-{
-  BRep_Builder B;
-  int nCount=nCount_;
-  TopoDS_Compound C;
-  B.MakeCompound(C);
-  BRepPrimAPI_MakeBox mkBox(1.0, 2.0, 3.0);
-  for (int i=0; i<nCount; i++) {
-    for (int j=0; j<nCount; j++) {
-      gp_Trsf trsf;
-      trsf.SetTranslationPart(gp_Vec(5.0*i, 05.0*j, 0.0));
-      TopLoc_Location topLoc(trsf);
-      TopoDS_Shape tempShape=mkBox.Shape().Located(topLoc);
-      B.Add(C, tempShape);
-    }
-  }
-  return C;
-}
-
-static Standard_Integer OCC7141 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  int nCount = 10;
-
-  if (argc > 2)
-    {
-      di << "Usage : " << argv[0] << " [nCount]" << "\n";
-      return 1;
-    }
-
-  if (argc > 1)
-    nCount = atoi(argv[1]);
-  STEPCAFControl_Writer writer;
-  Handle_TDocStd_Document document;
-  document = new TDocStd_Document("Pace Test-StepExporter-");
-  Handle_XCAFDoc_ShapeTool shapeTool;
-  shapeTool = XCAFDoc_DocumentTool::ShapeTool(document->Main());
-  shapeTool->AddShape(AddTestStructure(nCount), Standard_True);
-  STEPControl_StepModelType mode = STEPControl_AsIs;
-  if (!Interface_Static::SetIVal("write.step.assembly",1)) { //assembly mode
-    di << "Failed to set assembly mode for step data\n" << "\n";
-    return 0;
-  }
-  try {
-    OCC_CATCH_SIGNALS
-    if( writer.Transfer(document, mode)) {
-      IFSelect_ReturnStatus stat =
-       writer.Write("TestExportStructure.step");
-    }
-  }
-  catch(OSD_Exception_STACK_OVERFLOW) {
-    di << "Failed : STACK OVERFLOW\n" << "\n";
-  }
-  catch (Standard_Failure) {
-    di << "Failed :\n" << "\n";
-    //cout << Standard_Failure::Caught() << endl;
-    di << Standard_Failure::Caught()->GetMessageString();
-  }
-  di << argv[0] << " : Finish" << "\n";
-  
-  return 0;
-}
-
-static Standard_Integer OCC7372 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1)
-    {
-      di << "Usage : " << argv[0] << "\n";
-      return 1;
-    }
-  
-  // 1. Create an array of points
-  Handle(TColgp_HArray1OfPnt2d) ap = new TColgp_HArray1OfPnt2d(1,5);
-  ap->SetValue(1,gp_Pnt2d(100.0,0.0));
-  ap->SetValue(2,gp_Pnt2d(100.0,100.0));
-  ap->SetValue(3,gp_Pnt2d(0.0,100.0));
-  ap->SetValue(4,gp_Pnt2d(0.0,0.0));
-  ap->SetValue(5,gp_Pnt2d(50.0,-50.0));
-
-  // 2. Create a periodic bspline through these 5 points
-  Geom2dAPI_Interpolate intp(ap,Standard_True,1e-6);
-  intp.Perform();
-  Handle(Geom2d_BSplineCurve) bspline1 = intp.Curve();
-
-  // 3. Increase degree of curve from 3 to 8
-  bspline1->IncreaseDegree(8); // Increase degree to demonstrate the error
-  Standard_CString CString1 = "BSplineCurve";
-  DrawTrSurf::Set(CString1,bspline1);
-
-  // 4. Convers BSpline curve to Bezier segments
-  Geom2dConvert_BSplineCurveToBezierCurve bc(bspline1);
-
-  // 5. Test the result of conversion
-  TCollection_AsciiString aRName;
-  for(Standard_Integer i = 1; i <= bc.NbArcs(); i++) {
-    Handle(Geom2d_BezierCurve) arc = bc.Arc(i);
-    aRName="segment_";
-    aRName=aRName+TCollection_AsciiString(i);
-    Standard_CString aRNameStr = aRName.ToCString();
-    DrawTrSurf::Set(aRNameStr,arc);
-    di << aRNameStr << " ";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC8169 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 4)
-  {
-    di << "Usage : " << argv[0] << " edge1 edge2 plane" << "\n";
-    return 1;
-  }
-  TopoDS_Edge theEdge1 = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
-  if (theEdge1.IsNull()) {
-    di << "Invalid input shape " << argv[1] << "\n";
-    return 1;
-  }
-  TopoDS_Edge theEdge2 = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
-  if (theEdge2.IsNull()) {
-    di << "Invalid input shape " << argv[2] << "\n";
-    return 1;
-  }
-  TopoDS_Face theFace = TopoDS::Face(DBRep::Get(argv[3],TopAbs_FACE));
-  if (theFace.IsNull()) {
-    di << "Invalid input shape " << argv[3] << "\n";
-    return 1;
-  }
-
-  Handle(Geom_Surface) thePlane = BRep_Tool::Surface(theFace);
-
-  Standard_Real aConfusion = Precision::Confusion();
-  Standard_Real aP1first, aP1last, aP2first, aP2last;
-
-  Handle(Geom_Curve) aCurve1 = BRep_Tool::Curve(theEdge1, aP1first, aP1last);
-  Handle(Geom_Curve) aCurve2 = BRep_Tool::Curve(theEdge2, aP2first, aP2last);
-  Handle(Geom2d_Curve) aCurve2d1 = GeomProjLib::Curve2d(aCurve1, aP1first, aP1last, thePlane);
-  Handle(Geom2d_Curve) aCurve2d2 = GeomProjLib::Curve2d(aCurve2, aP2first, aP2last, thePlane);
-
-  Geom2dAPI_InterCurveCurve anInter(aCurve2d1, aCurve2d2, aConfusion);
-
-  Standard_Integer NbPoints = anInter.NbPoints();
-
-  di << "NbPoints = " << NbPoints << "\n" ;
-
-  if (NbPoints > 0) {
-    Standard_Integer i;
-    for (i=1; i<=NbPoints; i++) {
-      gp_Pnt2d aPi = anInter.Point(i);
-      di << "Point.X(" << i << ") = " << aPi.X() << "   " << "Point.Y(" << i << ") = " << aPi.Y() << "\n" ;
-    }
-  }
-
-  Standard_Integer NbSegments = anInter.NbSegments();
-
-  di << "\nNbSegments = " << NbSegments << "\n" ;
-
-  if (NbSegments > 0) {
-    IntRes2d_IntersectionSegment aSegment = anInter.Intersector().Segment(1);
-
-    gp_Pnt2d aP1 = aCurve2d1->Value(aSegment.FirstPoint().ParamOnFirst());
-    gp_Pnt2d aP2 = aCurve2d2->Value(aSegment.FirstPoint().ParamOnSecond());
-  
-    Standard_Real aDist = aP1.Distance(aP2);
-  
-    di << "aP1.X() = " << aP1.X() << "   " << "aP1.Y() = " << aP1.Y() << "\n" ;
-    di << "aP2.X() = " << aP2.X() << "   " << "aP2.Y() = " << aP2.Y() << "\n" ;
-
-    di << "Distance = " << aDist << "\n" ;
-
-    di << "Confusion = " << aConfusion << "\n" ;
-
-    if (aDist > aConfusion) {
-      di << "\n" << argv[0] << " Faulty" << "\n" ;
-    } else {
-      di << "\n" << argv[0] << " OK" << "\n" ;
-    }
-  } else {
-    di << "\n" << argv[0] << " OK" << "\n" ;
-  }
-
-  return 0;
-}
-static Standard_Integer OCC10138 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 3)
-  {
-    di << "Usage : " << argv[0] << " lower upper" << "\n";
-    return 1;
-  }
-
-  Standard_Integer LOWER = atoi(argv[1]);
-  Standard_Integer UPPER = atoi(argv[2]);
-
-  //! 0. Create an empty document with several test labels
-  Handle(TDocStd_Document) doc = new TDocStd_Document("XmlOcaf");
-  doc->SetUndoLimit(100);
-  TDF_Label main_label = doc->Main();
-  TDF_Label label1 = main_label.FindChild(1, Standard_True);
-  TDF_Label label2 = main_label.FindChild(2, Standard_True);
-  
-  //! 1. Set/Get OCAF attribute
-  doc->OpenCommand();
-  TDataStd_RealArray::Set(label1, LOWER, UPPER);
-  Handle(TDataStd_RealArray) array;
-  if (label1.FindAttribute(TDataStd_RealArray::GetID(), array) && 
-      array->Lower() == LOWER && array->Upper() == UPPER)
-    cout<<"1: OK"<<endl;
-  else
-  {
-    cout<<"1: Failed.."<<endl;
-    return 1;
-  }
-  doc->CommitCommand();
-
-  //! 2. Set/Get value
-  doc->OpenCommand();
-  Standard_Integer i;
-  for (i = LOWER; i <= UPPER; i++)
-    array->SetValue(i, i);
-  for (i = LOWER; i <= UPPER; i++)
-  {  
-    if (array->Value(i) != i)
-    {
-      cout<<"2: Failed.."<<endl;
-      return 2;
-    }
-  }
-  cout<<"2: OK"<<endl;
-  doc->CommitCommand();
-
-  //! 3. Re-init the array
-  doc->OpenCommand();
-  array->Init(LOWER + 2, UPPER + 4);
-  if (array->Lower() != LOWER + 2 && array->Upper() != UPPER + 4)
-  {
-    cout<<"3: Failed.."<<endl;
-    return 3;
-  }
-  for (i = LOWER + 2; i <= UPPER + 4; i++)
-    array->SetValue(i, i);
-  for (i = LOWER + 2; i <= UPPER + 4; i++)
-  {  
-    if (array->Value(i) != i)
-    {
-      cout<<"3: Failed.."<<endl;
-      return 3;
-    }
-  }
-  cout<<"3: OK"<<endl;
-  doc->CommitCommand();
-
-  //! 4. Change array
-  doc->OpenCommand();
-  Handle(TColStd_HArray1OfReal) arr = new TColStd_HArray1OfReal(LOWER + 5, UPPER + 5);
-  for (i = LOWER + 5; i <= UPPER + 5; i++)
-    arr->SetValue(i, i);
-  array->ChangeArray(arr);
-  for (i = LOWER + 5; i <= UPPER + 5; i++)
-  {  
-    if (array->Value(i) != i)
-    {
-      cout<<"4: Failed.."<<endl;
-      return 4;
-    }
-  }
-  cout<<"4: OK"<<endl;
-  doc->CommitCommand();
-
-  //! 5. Copy the array
-  doc->OpenCommand();
-  TDF_CopyLabel copier(label1, label2);
-  copier.Perform();
-  if (!copier.IsDone())
-  {
-    cout<<"5: Failed.."<<endl;
-    return 5;
-  }
-  Handle(TDataStd_RealArray) array2;
-  if (!label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
-  {
-    cout<<"5: Failed.."<<endl;
-    return 5;
-  }
-  for (i = LOWER + 5; i <= UPPER + 5; i++)
-  {  
-    if (array->Value(i) != i)
-    {
-      cout<<"5: Failed.."<<endl;
-      return 5;
-    }
-  }
-  cout<<"5: OK"<<endl;
-  doc->CommitCommand();
-
-  //! 6. Undo/Redo
-  //! 6.a: undoes the 5th action: the copied array should disappear
-  doc->Undo();
-  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) ||
-      label2.FindAttribute(TDataStd_RealArray::GetID(), array2))
-  {
-    cout<<"6.a: Failed.."<<endl;
-    return 6;
-  }
-  //! 6.b: undoes the 4th action: the array should be changed to (lower+2,upper+4)
-  doc->Undo();
-  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
-      array->Lower() != LOWER + 2 ||
-      array->Upper() != UPPER + 4)
-  {
-    cout<<"6.b: Failed.."<<endl;
-    return 6;
-  }
-  for (i = LOWER + 2; i <= UPPER + 4; i++)
-  {
-    if (array->Value(i) != i)
-    {
-      cout<<"6.b: Failed.."<<endl;
-      return 6;
-    }
-  }
-  //! 6.c: undoes the 3d action: the array should be changed to (lower,upper)
-  doc->Undo();
-  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
-      array->Lower() != LOWER ||
-      array->Upper() != UPPER)
-  {
-    cout<<"6.c: Failed.."<<endl;
-    return 6;
-  }
-  for (i = LOWER; i <= UPPER; i++)
-  {
-    if (array->Value(i) != i)
-    {
-      cout<<"6.c: Failed.."<<endl;
-      return 6;
-    }
-  }
-  //! 6.d: undoes and redoes the 2nd action: no change is expected.
-  doc->Undo();
-  doc->Redo();
-  if (!label1.FindAttribute(TDataStd_RealArray::GetID(), array) || 
-      array->Lower() != LOWER ||
-      array->Upper() != UPPER)
-  {
-    cout<<"6.d: Failed.."<<endl;
-    return 6;
-  }
-  for (i = LOWER; i <= UPPER; i++)
-  {
-    if (array->Value(i) != i)
-    {
-      cout<<"6.d: Failed.."<<endl;
-      return 6;
-    }
-  }
-  cout<<"6: OK"<<endl;
-
-  //! 7. Re-set the array
-  doc->OpenCommand();
-  array = TDataStd_RealArray::Set(label1, LOWER + 1, UPPER + 1);
-  if (array->Lower() != LOWER + 1 && array->Upper() != UPPER + 1)
-  {
-    cout<<"7: Failed.."<<endl;
-    return 7;
-  }
-  for (i = LOWER + 1; i <= UPPER + 1; i++)
-    array->SetValue(i, i);
-  for (i = LOWER + 1; i <= UPPER + 1; i++)
-  {  
-    if (array->Value(i) != i)
-    {
-      cout<<"7: Failed.."<<endl;
-      return 7;
-    }
-  }
-  cout<<"7: OK"<<endl;
-  doc->CommitCommand();
-
-  //! 8.Test of speed: set LOWER and UPPER equal to great integer number and 
-  //! measure the time spent by this test.
-  //! Good luck!
-
-  return 0;
-}
-
-static Standard_Integer OCC7639 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Standard_Boolean IsEvenArgc =  Standard_True;
-  if (argc % 2 == 0) {
-    IsEvenArgc =  Standard_True;
-  } else {
-    IsEvenArgc =  Standard_False;
-  }
-
-  if (argc < 3 || IsEvenArgc)
-    {
-      di << "Usage : " << argv[0] << " index1 value1 ... [indexN valueN]" << "\n";
-      return 1;
-    }
-
-  Standard_Integer i, aValue, aPosition;
-  NCollection_Vector<int> vec;
-  for (i = 0; i < argc - 1; i++) {
-    i++;
-    aValue = atoi(argv[i]);
-    aPosition = atoi(argv[i+1]);
-    vec.SetValue(aValue, aPosition);
-  }
-  NCollection_Vector<int>::Iterator it(vec);
-  Standard_Integer j;
-  for (j = 0; it.More(); it.Next(), j++) {
-    //di << it.Value() << "\n";                                               
-    di << j << " " << it.Value() << "\n";                                               
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC8797 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1) {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-  gp_Pnt point(0.0,0.0,0.0);
-
-  TColgp_Array1OfPnt poles(0,6);
-  poles(0)=point;
-
-  point.SetCoord(1.0,1.0,0.0);
-  poles(1)=point;
-
-  point.SetCoord(2.0,1.0,0.0);
-  poles(2)=point;
-
-  point.SetCoord(3.0,0.0,0.0);
-  poles(3)=point;
-
-  point.SetCoord(4.0,1.0,0.0);
-  poles(4)=point;
-
-  point.SetCoord(5.0,1.0,0.0);
-  poles(5)=point;
-
-  point.SetCoord(6.0,0.0,0.0);
-  poles(6)=point;
-
-  TColStd_Array1OfReal knots(0,2);
-  knots(0)=0.0;
-  knots(1)=0.5;
-  knots(2)=1.0;
-
-  TColStd_Array1OfInteger multi(0,2);
-  multi(0)=4;
-  multi(1)=3;
-  multi(2)=4;
-
-  Handle(Geom_BSplineCurve) spline = new Geom_BSplineCurve(poles,knots,multi,3);
-
-  //length!! 1.
-  Standard_Real l_abcissa,l_gprop;
-  GeomAdaptor_Curve adaptor_spline(spline);
-  GCPnts_AbscissaPoint temp;
-  l_abcissa=temp.Length(adaptor_spline);
-  cout<<"Length Spline(abcissa_Pnt): "<<l_abcissa<<endl;
-
-  //length!! 2.
-  TopoDS_Edge edge = BRepBuilderAPI_MakeEdge (spline);
-  GProp_GProps prop;
-  BRepGProp::LinearProperties(edge,prop);
-  l_gprop=prop.Mass();
-  cout<<"Length Spline(GProp_GProps): "<<l_gprop<<endl;
-
-  cout<<"Difference (abcissa_Pnt<->GProp_GProps): "<<l_gprop-l_abcissa<<endl;
-
-  return 0;
-}
-
-static Standard_Integer OCC7068 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
-  if(AISContext.IsNull())
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  // ObjectsInside
-  AIS_ListOfInteractive ListOfIO_1;
-  AISContext->ObjectsInside(ListOfIO_1);
-  di<< "ObjectsInside = " << ListOfIO_1.Extent() <<"\n";
-  if (!ListOfIO_1.IsEmpty() ) {
-    AIS_ListIteratorOfListOfInteractive iter;
-    for (iter.Initialize(ListOfIO_1); iter.More() ; iter.Next() ) {
-      Handle(AIS_InteractiveObject) aIO=iter.Value();
-      di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
-    }
-  }
-
-  // ObjectsInCollector
-  AIS_ListOfInteractive ListOfIO_2;
-  AISContext->ObjectsInCollector(ListOfIO_2);
-  di<< "ObjectsInCollector = " << ListOfIO_2.Extent() <<"\n";
-  if (!ListOfIO_2.IsEmpty() ) {
-    AIS_ListIteratorOfListOfInteractive iter;
-    for (iter.Initialize(ListOfIO_2); iter.More() ; iter.Next() ) {
-      Handle(AIS_InteractiveObject) aIO=iter.Value();
-      di<< GetMapOfAIS().Find1(aIO).ToCString() <<"\n";
-    }
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC11457 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ((argc < 9) || (((argc-3) % 3) != 0))
-  {
-    di << "Usage : " << argv[0] << "polygon lastedge x1 y1 z1 x2 y2 z2 ...\n";
-    return 1;
-  }
-  Standard_Integer i, j, np = (argc-3) / 3;
-  BRepBuilderAPI_MakePolygon W;
-  j = 3;
-  for (i = 1; i <= np; i ++) {
-    W.Add(gp_Pnt(atof(argv[j]),atof(argv[j+1]),atof(argv[j+2])));
-    j += 3;
-  }
-  W.Close();
-  DBRep::Set(argv[1],W.Wire());
-  DBRep::Set(argv[2],W.Edge());
-  return 0;
-}
-
-static Standard_Integer OCC13963 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 5) {
-    di << "Usage : " << argv[0] << " ratio origin_x origin_y origin_z\n";
-    return 1;
-  }
-  gp_Ax2 aPln (gp_Pnt(0.,0.,0.),
-               gp_Dir(1., -1., 0.));
-  gp_GTrsf aTrf;
-  aTrf.SetAffinity (aPln, atof(argv[4]));
-  gp_XYZ aOrigin (atof(argv[1]),atof(argv[2]),atof(argv[3]));
-  gp_XYZ aResult (aOrigin);
-  aTrf.Transforms(aResult);
-  char sbf[512];
-  sprintf(sbf, "( %8.3f %8.3f %8.3f ) => ( %8.3f %8.3f %8.3f )\n",
-          aOrigin.X(), aOrigin.Y(), aOrigin.Z(),
-          aResult.X(), aResult.Y(), aResult.Z());
-  di<<sbf;
-  return 0;
-}
-
-Standard_Integer OCC14376(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 2) {
-    di << "Usage : " << argv[0] << " shape [deflection]\n";
-    return 1;
-  }
-
-  TopoDS_Shape aShape = DBRep::Get(argv[1]);
-
-  if (aShape.IsNull()) {
-    di<<" Null shape is not allowed";
-    return 1;
-  }
-
-  Standard_Real aDeflection = 0.45110277533;
-  if (argc > 2) {
-    aDeflection = atof(argv[2]);
-  }
-  di<<"deflection="<< aDeflection << "\n";
-
-  BRepMesh_IncrementalMesh aIMesh(aShape, aDeflection, Standard_False, M_PI/9.);
-  TopLoc_Location aLocation;
-  Handle(Poly_Triangulation) aTriang = BRep_Tool::Triangulation(TopoDS::Face(aShape), aLocation);
-
-  if(aTriang.IsNull()) {
-    di << argv[0] << " : Faulty\n" ;
-  } else {
-    di << argv[0] << " : OK\n" ;
-    di<<"NbNodes="<< aTriang->NbNodes()<< "\n";
-    di<<"NbTriangles="<< aTriang->NbTriangles()<< "\n";
-  }
-  return 0;
-}
-
-static Standard_Integer OCC15489 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 4) {
-    di << "Usage : " << argv[0] << " A B C\n";
-    return 1;
-  }
-  try
-    {
-      gp_Lin2d aLin2d (atof(argv[1]),atof(argv[2]),atof(argv[3]));
-      gp_Pnt2d anOrigin = aLin2d.Location();
-      di << "X_0 = " << anOrigin.X() << "   Y_0 = " << anOrigin.Y() << "\n" ;
-    }
-  catch(Standard_ConstructionError)
-    {
-      di << argv[0] << " Exception: Sqrt(A*A + B*B) <= Resolution from gp\n";
-    }
-  return 0;
-}
-
-static Standard_Integer OCC15755 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 3) {
-    di << "Usage : " << argv[0] << " file shape\n";
-    return 1;
-  }
-
-  IGESControl_Reader aReader;
-  aReader.ReadFile(argv[1]);
-  aReader.SetReadVisible(Standard_True);
-  aReader.TransferRoots();
-
-  Handle(IGESData_IGESModel) model = aReader.IGESModel();
-  if (model.IsNull()) {
-    di << "model.IsNull()\n";
-    return 1;
-  }
-  Standard_Integer nb = model->NbEntities();
-  for (Standard_Integer i = 1; i <= nb; i ++) {
-    Handle(IGESData_IGESEntity) ent = model->Entity(i);
-    Handle(TCollection_HAsciiString) name;
-    name = ent->NameValue();
-    Standard_CString aStr = name->ToCString();
-    di << "NameValue = " << aStr << "\n";
-  }
-
-  TopoDS_Shape shape = aReader.OneShape();
-  DBRep::Set(argv[2],shape);
-  return 0;
-}
-
-// For OCC16782 testing
-#include <AppStd_Application.hxx>
-#include <TDF_Tool.hxx>
-#include <TColStd_HArray1OfInteger.hxx>
-// Iterators
-#include <TColStd_ListIteratorOfListOfInteger.hxx>
-#include <TColStd_ListIteratorOfListOfReal.hxx>
-#include <TDataStd_ListIteratorOfListOfExtendedString.hxx>
-#include <TDataStd_ListIteratorOfListOfByte.hxx>
-#include <TDF_ListIteratorOfLabelList.hxx>
-// Attributes
-#include <TDataStd_Tick.hxx>
-#include <TDataStd_IntegerList.hxx>
-#include <TDataStd_RealList.hxx>
-#include <TDataStd_ExtStringList.hxx>
-#include <TDataStd_BooleanList.hxx>
-#include <TDataStd_ReferenceList.hxx>
-#include <TDataStd_BooleanArray.hxx>
-#include <TDataStd_ReferenceArray.hxx>
-#include <TDataStd_ByteArray.hxx>
-#include <TDataStd_NamedData.hxx>
-#include <TDF_Reference.hxx>
-//
-Handle(AppStd_Application) app;
-int TestSetGet(const Handle(TDocStd_Document)& doc)
-{
-  // TDataStd_Tick:
-  // Set
-  TDataStd_Tick::Set(doc->Main());
-  // Get
-  Handle(TDataStd_Tick) tick;
-  if (!doc->Main().FindAttribute(TDataStd_Tick::GetID(), tick))
-    return 1;
-  // Forget
-  doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
-  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 2;
-  doc->Main().ResumeAttribute(tick);
-  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 3;
-  // Forget
-  doc->Main().ForgetAttribute(TDataStd_Tick::GetID());
-  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 2;
-
-  // TDataStd_IntegerList:
-  // Set
-  Handle(TDataStd_IntegerList) setintlist = TDataStd_IntegerList::Set(doc->Main());
-  setintlist->Append(2);
-  setintlist->Prepend(1);
-  setintlist->InsertAfter(3, 2);
-  setintlist->InsertBefore(0, 1);
-  setintlist->Append(200);
-  setintlist->Remove(0);
-  setintlist->Remove(200);
-  // Get
-  Handle(TDataStd_IntegerList) getintlist;
-  if (!doc->Main().FindAttribute(TDataStd_IntegerList::GetID(), getintlist))
-    return 1;
-  if (getintlist->First() != 1)
-    return 2;
-  if (getintlist->Last() != 3)
-    return 3;
-  const TColStd_ListOfInteger& intlist = getintlist->List();
-  TColStd_ListIteratorOfListOfInteger itr_intlist(intlist);
-  for (; itr_intlist.More(); itr_intlist.Next())
-  {
-    if (itr_intlist.Value() != 1 &&
-       itr_intlist.Value() != 2 &&
-       itr_intlist.Value() != 3)
-    {
-      return 4;
-    }
-  }
-  getintlist->Clear();
-
-  // TDataStd_RealList:
-  // Set
-  Handle(TDataStd_RealList) setdbllist = TDataStd_RealList::Set(doc->Main());
-  setdbllist->Append(2.5);
-  setdbllist->Prepend(1.5);
-  setdbllist->InsertAfter(3.5, 2.5);
-  setdbllist->InsertBefore(0.5, 1.5);
-  setdbllist->Append(200.5);
-  setdbllist->Remove(0.5);
-  setdbllist->Remove(200.5);
-  // Get
-  Handle(TDataStd_RealList) getdbllist;
-  if (!doc->Main().FindAttribute(TDataStd_RealList::GetID(), getdbllist))
-    return 1;
-  if (getdbllist->First() != 1.5)
-    return 2;
-  if (getdbllist->Last() != 3.5)
-    return 3;
-  const TColStd_ListOfReal& dbllist = getdbllist->List();
-  TColStd_ListIteratorOfListOfReal itr_dbllist(dbllist);
-  for (; itr_dbllist.More(); itr_dbllist.Next())
-  {
-    if (itr_dbllist.Value() != 1.5 &&
-       itr_dbllist.Value() != 2.5 &&
-       itr_dbllist.Value() != 3.5)
-    {
-      return 4;
-    }
-  }
-  getdbllist->Clear();
-
-  // TDataStd_ExtStringList:
-  // Set
-  Handle(TDataStd_ExtStringList) setstrlist = TDataStd_ExtStringList::Set(doc->Main());
-  setstrlist->Append("Hello");
-  setstrlist->Prepend("Guten Tag");
-  setstrlist->InsertAfter("Bonjour", "Guten Tag");
-  setstrlist->InsertBefore("Bonsoir", "Hello");
-  setstrlist->Append("Good bye");
-  setstrlist->Remove("Bonsoir");
-  setstrlist->Remove("Good bye");
-  // Get
-  Handle(TDataStd_ExtStringList) getstrlist;
-  if (!doc->Main().FindAttribute(TDataStd_ExtStringList::GetID(), getstrlist))
-    return 1;
-  if (getstrlist->First() != "Guten Tag")
-    return 2;
-  if (getstrlist->Last() != "Hello")
-    return 3;
-  const TDataStd_ListOfExtendedString& strlist = getstrlist->List();
-  TDataStd_ListIteratorOfListOfExtendedString itr_strlist(strlist);
-  for (; itr_strlist.More(); itr_strlist.Next())
-  {
-    if (itr_strlist.Value() != "Guten Tag" &&
-       itr_strlist.Value() != "Bonjour" &&
-       itr_strlist.Value() != "Hello")
-    {
-      return 4;
-    }
-  }
-  getstrlist->Clear();
-
-  // TDataStd_BooleanList:
-  // Set
-  Handle(TDataStd_BooleanList) setboollist = TDataStd_BooleanList::Set(doc->Main());
-  setboollist->Append(Standard_True);
-  setboollist->Prepend(Standard_False);
-  // Get
-  Handle(TDataStd_BooleanList) getboollist;
-  if (!doc->Main().FindAttribute(TDataStd_BooleanList::GetID(), getboollist))
-    return 1;
-  if (getboollist->First() != Standard_False)
-    return 2;
-  if (getboollist->Last() != Standard_True)
-    return 3;
-  const TDataStd_ListOfByte& boollist = getboollist->List();
-  TDataStd_ListIteratorOfListOfByte itr_boollist(boollist);
-  for (; itr_boollist.More(); itr_boollist.Next())
-  {
-    if (itr_boollist.Value() != Standard_True &&
-       itr_boollist.Value() != Standard_False)
-    {
-      return 4;
-    }
-  }
-  getboollist->Clear();
-
-  // TDataStd_ReferenceList:
-  TDF_Label L1 = doc->Main().FindChild(100);
-  TDF_Label L2 = doc->Main().FindChild(101);
-  TDF_Label L3 = doc->Main().FindChild(102);
-  TDF_Label L4 = doc->Main().FindChild(103);
-  TDF_Label L5 = doc->Main().FindChild(104);
-  // Set
-  Handle(TDataStd_ReferenceList) setreflist = TDataStd_ReferenceList::Set(doc->Main());
-  setreflist->Append(L1);
-  setreflist->Prepend(L2);
-  setreflist->InsertAfter(L3, L2);
-  setreflist->InsertBefore(L4, L1);
-  setreflist->Append(L5);
-  setreflist->Remove(L4);
-  setreflist->Remove(L5);
-  // Get
-  Handle(TDataStd_ReferenceList) getreflist;
-  if (!doc->Main().FindAttribute(TDataStd_ReferenceList::GetID(), getreflist))
-    return 1;
-  if (getreflist->First() != L2)
-    return 2;
-  if (getreflist->Last() != L1)
-    return 3;
-  const TDF_LabelList& reflist = getreflist->List();
-  TDF_ListIteratorOfLabelList itr_reflist(reflist);
-  for (; itr_reflist.More(); itr_reflist.Next())
-  {
-    if (itr_reflist.Value() != L1 &&
-       itr_reflist.Value() != L2 &&
-       itr_reflist.Value() != L3)
-    {
-      return 4;
-    }
-  }
-  getreflist->Clear();
-
-  // TDataStd_BooleanArray:
-  // Set
-  Handle(TDataStd_BooleanArray) setboolarr = TDataStd_BooleanArray::Set(doc->Main(), 12, 16);
-  setboolarr->SetValue(12, Standard_True);
-  setboolarr->SetValue(13, Standard_False);
-  setboolarr->SetValue(14, Standard_False);
-  setboolarr->SetValue(15, Standard_False);
-  setboolarr->SetValue(16, Standard_True);
-  setboolarr->SetValue(14, Standard_True);
-  // Get
-  Handle(TDataStd_BooleanArray) getboolarr;
-  if (!doc->Main().FindAttribute(TDataStd_BooleanArray::GetID(), getboolarr))
-    return 1;
-  if (getboolarr->Value(12) != Standard_True)
-    return 2;
-  if (getboolarr->Value(13) != Standard_False)
-    return 2;
-  if (getboolarr->Value(14) != Standard_True)
-    return 2;
-  if (getboolarr->Value(15) != Standard_False)
-    return 2;
-  if (getboolarr->Value(16) != Standard_True)
-    return 2;
-
-  // TDataStd_ReferenceArray:
-  // Set
-  Handle(TDataStd_ReferenceArray) setrefarr = TDataStd_ReferenceArray::Set(doc->Main(), 0, 4);
-  setrefarr->SetValue(0, L1);
-  setrefarr->SetValue(1, L2);
-  setrefarr->SetValue(2, L3);
-  setrefarr->SetValue(3, L4);
-  setrefarr->SetValue(4, L5);
-  // Get
-  Handle(TDataStd_ReferenceArray) getrefarr;
-  if (!doc->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), getrefarr))
-    return 1;
-  if (getrefarr->Value(0) != L1)
-    return 2;
-  if (getrefarr->Value(1) != L2)
-    return 2;
-  if (getrefarr->Value(2) != L3)
-    return 2;
-  if (getrefarr->Value(3) != L4)
-    return 2;
-  if (getrefarr->Value(4) != L5)
-    return 2;
-
-  // TDataStd_ByteArray:
-  // Set
-  Handle(TDataStd_ByteArray) setbytearr = TDataStd_ByteArray::Set(doc->Main(), 12, 16);
-  setbytearr->SetValue(12, 0);
-  setbytearr->SetValue(13, 1);
-  setbytearr->SetValue(14, 2);
-  setbytearr->SetValue(15, 3);
-  setbytearr->SetValue(16, 255);
-  // Get
-  Handle(TDataStd_ByteArray) getbytearr;
-  if (!doc->Main().FindAttribute(TDataStd_ByteArray::GetID(), getbytearr))
-    return 1;
-  if (getbytearr->Value(12) != 0)
-    return 2;
-  if (getbytearr->Value(13) != 1)
-    return 2;
-  if (getbytearr->Value(14) != 2)
-    return 2;
-  if (getbytearr->Value(15) != 3)
-    return 2;
-  if (getbytearr->Value(16) != 255)
-    return 2;
-  
-  // TDataStd_NamedData:
-  // Set:
-  Handle(TDataStd_NamedData) setnd = TDataStd_NamedData::Set(doc->Main());
-  setnd->SetInteger("Integer1", 1);
-  setnd->SetInteger("Integer2", 2);
-  setnd->SetInteger("Integer3", 8);
-  setnd->SetInteger("Integer3", 3);
-  // Get:
-  Handle(TDataStd_NamedData) getnd;
-  if (!doc->Main().FindAttribute(TDataStd_NamedData::GetID(), getnd))
-    return 1;
-  if (!getnd->HasIntegers())
-    return 2;
-  if (!getnd->HasInteger("Integer1"))
-    return 3;
-  if (getnd->GetInteger("Integer2") != 2)
-    return 4;
-  if (getnd->GetInteger("Integer3") != 3)
-    return 4;
-
-  return 0;
-}
-
-int TestUndoRedo(const Handle(TDocStd_Document)& doc)
-{
-  // TDataStd_Tick:
-  doc->OpenCommand();
-  Handle(TDataStd_Tick) tick = TDataStd_Tick::Set(doc->Main());
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 1;
-  doc->Undo();
-  if (doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 2;
-  doc->Redo();
-  if (!doc->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 3;
-
-  // TDataStd_IntegerList:
-  doc->OpenCommand();
-  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc->Main());
-  intlist->Append(2);
-  intlist->Prepend(1);
-  intlist->InsertBefore(0, 1);
-  intlist->InsertAfter(3, 2);
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_IntegerList::GetID()))
-    return 1;
-  doc->Undo();
-  if (!intlist->IsEmpty())
-    return 2;
-  doc->Redo();
-  if (!intlist->Extent())
-    return 3;
-  if (intlist->First() != 0)
-    return 4;
-  if (intlist->Last() != 3)
-    return 5;
-  intlist->Clear();
-
-  // TDataStd_RealList:
-  doc->OpenCommand();
-  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc->Main());
-  dbllist->Append(2.5);
-  dbllist->Prepend(1.5);
-  dbllist->InsertBefore(0.5, 1.5);
-  dbllist->InsertAfter(3.5, 2.5);
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_RealList::GetID()))
-    return 1;
-  doc->Undo();
-  if (!dbllist->IsEmpty())
-    return 2;
-  doc->Redo();
-  if (!dbllist->Extent())
-    return 3;
-  if (dbllist->First() != 0.5)
-    return 4;
-  if (dbllist->Last() != 3.5)
-    return 5;
-  dbllist->Clear();
-
-  // TDataStd_ExtStringList:
-  doc->OpenCommand();
-  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc->Main());
-  strlist->Append("Hello");
-  strlist->Prepend("Guten Tag");
-  strlist->InsertAfter("Bonjour", "Guten Tag");
-  strlist->InsertBefore("Bonsoir", "Hello");
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_ExtStringList::GetID()))
-    return 1;
-  doc->Undo();
-  if (!strlist->IsEmpty())
-    return 2;
-  doc->Redo();
-  if (!strlist->Extent())
-    return 3;
-  if (strlist->First() != "Guten Tag")
-    return 4;
-  if (strlist->Last() != "Hello")
-    return 5;
-  strlist->Clear();
-
-  // TDataStd_BooleanList:
-  doc->OpenCommand();
-  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc->Main());
-  boollist->Append(Standard_True);
-  boollist->Prepend(Standard_False);
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_BooleanList::GetID()))
-    return 1;
-  doc->Undo();
-  if (!boollist->IsEmpty())
-    return 2;
-  doc->Redo();
-  if (!boollist->Extent())
-    return 3;
-  if (boollist->First() != Standard_False)
-    return 4;
-  if (boollist->Last() != Standard_True)
-    return 5;
-  boollist->Clear();
-
-  // TDataStd_ReferenceList:
-  TDF_Label L1 = doc->Main().FindChild(100);
-  TDF_Label L2 = doc->Main().FindChild(101);
-  TDF_Label L3 = doc->Main().FindChild(102);
-  TDF_Label L4 = doc->Main().FindChild(103);
-  doc->OpenCommand();
-  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc->Main());
-  reflist->Append(L1);
-  reflist->Prepend(L2);
-  reflist->InsertBefore(L3, L1);
-  reflist->InsertAfter(L4, L2);
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_ReferenceList::GetID()))
-    return 1;
-  doc->Undo();
-  if (!reflist->IsEmpty())
-    return 2;
-  doc->Redo();
-  if (!reflist->Extent())
-    return 3;
-  if (reflist->First() != L2)
-    return 4;
-  if (reflist->Last() != L1)
-    return 5;
-  reflist->Clear();
-
-  // TDataStd_BooleanArray:
-  doc->OpenCommand();
-  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc->Main(), 23, 25);
-  boolarr->SetValue(23, Standard_True);
-  boolarr->SetValue(25, Standard_True);
-  doc->CommitCommand();
-  doc->OpenCommand();
-  boolarr = TDataStd_BooleanArray::Set(doc->Main(), 230, 250);
-  boolarr->SetValue(230, Standard_True);
-  boolarr->SetValue(250, Standard_True);  
-  doc->CommitCommand();
-  doc->Undo();
-  if (boolarr->Value(23) != Standard_True)
-    return 2;
-  if (boolarr->Value(24) != Standard_False)
-    return 2;
-  if (boolarr->Value(25) != Standard_True)
-    return 2;
-  doc->Redo();
-  if (boolarr->Value(230) != Standard_True)
-    return 3;
-  if (boolarr->Value(240) != Standard_False)
-    return 3;
-  if (boolarr->Value(250) != Standard_True)
-    return 3;
-
-  // TDataStd_ReferenceArray:
-  doc->OpenCommand();
-  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc->Main(), 5, 8);
-  refarr->SetValue(5, L1);
-  refarr->SetValue(6, L2);
-  refarr->SetValue(7, L3);
-  refarr->SetValue(8, L4);
-  doc->CommitCommand();
-  if (!doc->Main().IsAttribute(TDataStd_ReferenceArray::GetID()))
-    return 1;
-  doc->Undo();
-  doc->Redo();
-  if (refarr->Value(5) != L1)
-    return 4;
-  if (refarr->Value(6) != L2)
-    return 4;
-  if (refarr->Value(7) != L3)
-    return 4;
-  if (refarr->Value(8) != L4)
-    return 4;
-
-  // TDataStd_ByteArray:
-  doc->OpenCommand();
-  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc->Main(), 23, 25);
-  bytearr->SetValue(23, 23);
-  bytearr->SetValue(25, 25);
-  doc->CommitCommand();
-  doc->OpenCommand();
-  bytearr = TDataStd_ByteArray::Set(doc->Main(), 230, 250);
-  bytearr->SetValue(230, 230);
-  bytearr->SetValue(250, 250);  
-  doc->CommitCommand();
-  doc->Undo();
-  if (bytearr->Value(23) != 23)
-    return 2;
-  if (bytearr->Value(25) != 25)
-    return 2;
-  doc->Redo();
-  if (bytearr->Value(230) != 230)
-    return 3;
-  if (bytearr->Value(250) != 250)
-    return 3;
-
-  // TDataStd_NamedData:
-  doc->OpenCommand();
-  Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(doc->Main());
-  nd->SetByte("b14", 12);
-  nd->SetByte("b17", 18);
-  nd->SetByte("b14", 14);
-  nd->SetByte("b17", 17);
-  doc->CommitCommand();
-  doc->OpenCommand();
-  nd = TDataStd_NamedData::Set(doc->Main());
-  nd->SetReal("r14", 14);
-  nd->SetReal("r17", 17);
-  nd->SetReal("r14", 14.4);
-  nd->SetReal("r17", 17.7);
-  doc->CommitCommand();
-  doc->Undo();
-  if (nd->HasStrings())
-    return 1;
-  if (nd->HasReals())
-    return 1;
-  if (nd->HasReal("r17"))
-    return 2;
-  if (!nd->HasBytes())
-    return 3;
-  if (nd->GetByte("b14") != 14)
-    return 4;
-  if (nd->GetByte("b17") != 17)
-    return 4;
-  if (nd->HasByte("b18"))
-    return 5;
-  doc->Redo();
-  if (!nd->HasBytes())
-    return 1;
-  if (!nd->HasReals())
-    return 1;
-  if (nd->GetByte("b14") != 14)
-    return 2;
-  if (nd->GetReal("r14") != 14.4)
-    return 2;
-  if (nd->GetReal("r17") != 17.7)
-    return 2;
-
-  return 0;
-}
-
-int TestCopyPaste(const Handle(TDocStd_Document)& doc)
-{
-  TDF_Label L1 = doc->Main().FindChild(1);
-  TDF_Label L2 = doc->Main().FindChild(2);
-  TDF_CopyLabel copier(L1, L2);
-
-  // TDataStd_Tick:
-  TDataStd_Tick::Set(L1);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  if (!L2.IsAttribute(TDataStd_Tick::GetID()))
-    return 2;
-
-  // TDataStd_IntegerList:
-  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(L1);
-  intlist->Append(1);
-  intlist->InsertAfter(2, 1);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  intlist->Clear();
-  intlist.Nullify();
-  if (!L2.FindAttribute(TDataStd_IntegerList::GetID(), intlist))
-    return 2;
-  if (intlist->First() != 1)
-    return 3;
-  if (intlist->Last() != 2)
-    return 4;
-  intlist->Clear();
-
-  // TDataStd_RealList:
-  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(L1);
-  dbllist->Append(1.5);
-  dbllist->InsertAfter(2.5, 1.5);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  dbllist->Clear();
-  dbllist.Nullify();
-  if (!L2.FindAttribute(TDataStd_RealList::GetID(), dbllist))
-    return 2;
-  if (dbllist->First() != 1.5)
-    return 3;
-  if (dbllist->Last() != 2.5)
-    return 4;
-  dbllist->Clear();
-
-  // TDataStd_ExtStringList:
-  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(L1);
-  strlist->Append("Open CASCADE");
-  strlist->InsertAfter(" - is the best set of libraries!", "Open CASCADE");
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  strlist->Clear();
-  strlist.Nullify();
-  if (!L2.FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
-    return 2;
-  if (strlist->First() != "Open CASCADE")
-    return 3;
-  if (strlist->Last() != " - is the best set of libraries!")
-    return 4;
-  strlist->Clear();
-
-  // TDataStd_BooleanList:
-  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(L1);
-  boollist->Append(Standard_True);
-  boollist->Prepend(Standard_False);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  boollist->Clear();
-  boollist.Nullify();
-  if (!L2.FindAttribute(TDataStd_BooleanList::GetID(), boollist))
-    return 2;
-  if (boollist->First() != Standard_False)
-    return 3;
-  if (boollist->Last() != Standard_True)
-    return 4;
-  boollist->Clear();
-
-  // TDataStd_ReferenceList:
-  TDF_Label L100 = doc->Main().FindChild(100);
-  TDF_Label L101 = doc->Main().FindChild(101);
-  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(L1);
-  reflist->Append(L100);
-  reflist->InsertAfter(L101, L100);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  reflist->Clear();
-  reflist.Nullify();
-  if (!L2.FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
-    return 2;
-  if (reflist->First() != L100)
-    return 3;
-  if (reflist->Last() != L101)
-    return 4;
-  reflist->Clear();
-
-  // TDataStd_BooleanArray:
-  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(L1, 4, 6);
-  boolarr->SetValue(4, Standard_True);
-  boolarr->SetValue(6, Standard_True);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  boolarr.Nullify();
-  if (!L2.FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
-    return 2;
-  if (boolarr->Value(4) != Standard_True)
-    return 3;
-  if (boolarr->Value(5) != Standard_False)
-    return 3;
-  if (boolarr->Value(6) != Standard_True)
-    return 3;
-
-  // TDataStd_ReferenceArray:
-  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(L1, 3, 4);
-  refarr->SetValue(3, L100);
-  refarr->SetValue(4, L101);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  refarr.Nullify();
-  if (!L2.FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
-    return 2;
-  if (refarr->Value(3) != L100)
-    return 3;
-  if (refarr->Value(4) != L101)
-    return 3;
-
-  // TDataStd_ByteArray:
-  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(L1, 4, 6);
-  bytearr->SetValue(4, 40);
-  bytearr->SetValue(6, 60);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  bytearr.Nullify();
-  if (!L2.FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
-    return 2;
-  if (bytearr->Value(4) != 40)
-    return 3;
-  if (bytearr->Value(6) != 60)
-    return 3;
-
-  // TDataStd_NamedData:
-  Handle(TDataStd_NamedData) nd = TDataStd_NamedData::Set(L1);
-  nd->SetInteger("Integer1", 11);
-  nd->SetReal("Real1", 11.1);
-  nd->SetString("String1", "11.11111111");
-  nd->SetByte("Byte1", 111);
-  Handle(TColStd_HArray1OfInteger) ints_arr = new TColStd_HArray1OfInteger(4, 5);
-  ints_arr->SetValue(4, 4);
-  ints_arr->SetValue(5, 5);
-  nd->SetArrayOfIntegers("Integers1", ints_arr);
-  copier.Perform();
-  if (!copier.IsDone())
-    return 1;
-  nd.Nullify();
-  if (!L2.FindAttribute(TDataStd_NamedData::GetID(), nd))
-    return 2;
-  if (!nd->HasIntegers())
-    return 3;
-  if (!nd->HasReals())
-    return 3;
-  if (!nd->HasStrings())
-    return 3;
-  if (!nd->HasBytes())
-    return 3;
-  if (!nd->HasArraysOfIntegers())
-    return 3;
-  if (nd->HasArraysOfReals())
-    return 3;
-  if (!nd->HasInteger("Integer1"))
-    return 4;
-  if (nd->GetInteger("Integer1") != 11)
-    return 4;
-  if (!nd->HasReal("Real1"))
-    return 4;
-  if (nd->GetReal("Real1") != 11.1)
-    return 4;
-  if (!nd->HasString("String1"))
-    return 4;
-  if (nd->GetString("String1") != "11.11111111")
-    return 4;
-  if (!nd->HasByte("Byte1"))
-    return 4;
-  if (nd->GetByte("Byte1") != 111)
-    return 4;
-  if (!nd->HasArrayOfIntegers("Integers1"))
-    return 4;
-  const Handle(TColStd_HArray1OfInteger)& ints_arr_out = nd->GetArrayOfIntegers("Integers1");
-  if (ints_arr_out.IsNull())
-    return 4;
-  if (ints_arr_out->Value(5) != 5)
-    return 4;
-
-  return 0;
-}
-
-int TestOpenSave(TCollection_ExtendedString aFile1,
-                TCollection_ExtendedString aFile2,
-                TCollection_ExtendedString aFile3)
-{
-  // Std
-  Handle(TDocStd_Document) doc_std, doc_std_open;
-  app->NewDocument("MDTV-Standard", doc_std);
-  // TDataStd_Tick:
-  TDataStd_Tick::Set(doc_std->Main());
-  // TDataStd_IntegerList:
-  Handle(TDataStd_IntegerList) intlist = TDataStd_IntegerList::Set(doc_std->Main());
-  intlist->Append(1);
-  intlist->Append(5);
-  // TDataStd_RealList:
-  Handle(TDataStd_RealList) dbllist = TDataStd_RealList::Set(doc_std->Main());
-  dbllist->Append(1.5);
-  dbllist->Append(5.5);
-  // TDataStd_ExtStringList:
-  Handle(TDataStd_ExtStringList) strlist = TDataStd_ExtStringList::Set(doc_std->Main());
-  strlist->Append("Auf");
-  strlist->Append("Wiedersehen");
-  // TDataStd_BooleanList:
-  Handle(TDataStd_BooleanList) boollist = TDataStd_BooleanList::Set(doc_std->Main());
-  boollist->Append(Standard_False);
-  boollist->Append(Standard_True);
-  // TDataStd_ReferenceList:
-  TCollection_AsciiString entry1, entry2, entry_first, entry_last;
-  TDF_Label Lstd1 = doc_std->Main().FindChild(100);
-  TDF_Tool::Entry(Lstd1, entry1);
-  TDF_Label Lstd2 = doc_std->Main().FindChild(101);
-  TDF_Tool::Entry(Lstd2, entry2);
-  Handle(TDataStd_ReferenceList) reflist = TDataStd_ReferenceList::Set(doc_std->Main());
-  reflist->Append(Lstd1);
-  reflist->Append(Lstd2);
-  // TDataStd_BooleanArray:
-  Handle(TDataStd_BooleanArray) boolarr = TDataStd_BooleanArray::Set(doc_std->Main(), 15, 18);
-  boolarr->SetValue(15, Standard_False);
-  boolarr->SetValue(16, Standard_True);
-  boolarr->SetValue(17, Standard_True);
-  boolarr->SetValue(18, Standard_True);
-  // TDataStd_ReferenceArray:
-  Handle(TDataStd_ReferenceArray) refarr = TDataStd_ReferenceArray::Set(doc_std->Main(), 45, 46);
-  refarr->SetValue(45, Lstd1);
-  refarr->SetValue(46, Lstd2);
-  // TDataStd_ByteArray:
-  Handle(TDataStd_ByteArray) bytearr = TDataStd_ByteArray::Set(doc_std->Main(), 15, 18);
-  bytearr->SetValue(15, 150);
-  bytearr->SetValue(16, 160);
-  bytearr->SetValue(17, 170);
-  bytearr->SetValue(18, 180);
-  // TDataStd_NamedData:
-  Handle(TDataStd_NamedData) nameddata = TDataStd_NamedData::Set(doc_std->Main());
-  // TDF_Reference:
-  TDF_Label Lstd3 = doc_std->Main().FindChild(103);
-  Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
-  // 
-  // Save
-  //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
-  if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
-    return 1;
-  intlist.Nullify();
-  dbllist.Nullify();
-  strlist.Nullify();
-  boollist.Nullify();
-  reflist.Nullify();
-  boolarr.Nullify();
-  ref.Nullify();
-  app->Close(doc_std);
-  doc_std.Nullify();
-  //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
-  if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
-    return 2;
-  if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 3;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
-    return 4;
-  if (intlist->First() != 1)
-    return 5;
-  if (intlist->Last() != 5)
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
-    return 4;
-  if (dbllist->First() != 1.5)
-    return 5;
-  if (dbllist->Last() != 5.5)
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
-    return 4;
-  if (strlist->First() != "Auf")
-    return 5;
-  if (strlist->Last() != "Wiedersehen")
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
-    return 4;
-  if (boollist->First() != Standard_False)
-    return 5;
-  if (boollist->Last() != Standard_True)
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
-    return 4;
-  TDF_Tool::Entry(reflist->First(), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(reflist->Last(), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
-    return 4;
-  if (boolarr->Value(15) != Standard_False)
-    return 5;
-  if (boolarr->Value(16) != Standard_True)
-    return 5;
-  if (boolarr->Value(17) != Standard_True)
-    return 5;
-  if (boolarr->Value(18) != Standard_True)
-    return 5;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
-    return 4;
-  TDF_Tool::Entry(refarr->Value(45), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(refarr->Value(46), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_std_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
-    return 4;
-  if (bytearr->Value(15) != 150)
-    return 5;
-  if (bytearr->Value(16) != 160)
-    return 5;
-  if (bytearr->Value(17) != 170)
-    return 5;
-  if (bytearr->Value(18) != 180)
-    return 5;
-  if (!doc_std_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
-    return 4;
-  if (ref->Get().IsNull())
-    return 5;
-  if (ref->Get().Tag() != 103)
-      return 5;
-
-  // Xml
-  Handle(TDocStd_Document) doc_xml, doc_xml_open;
-  app->NewDocument("XmlOcaf", doc_xml);
-  // TDataStd_Tick:
-  TDataStd_Tick::Set(doc_xml->Main());
-  // TDataStd_IntegerList:
-  intlist = TDataStd_IntegerList::Set(doc_xml->Main());
-  intlist->Append(1);
-  intlist->Append(5);
-  // TDataStd_RealList:
-  dbllist = TDataStd_RealList::Set(doc_xml->Main());
-  dbllist->Append(1.5);
-  dbllist->Append(5.5);
-  // TDataStd_ExtStringList:
-  strlist = TDataStd_ExtStringList::Set(doc_xml->Main());
-  strlist->Append("Guten ");
-  strlist->Append("Tag");
-  // TDataStd_BooleanList:
-  boollist = TDataStd_BooleanList::Set(doc_xml->Main());
-  boollist->Append(Standard_False);
-  boollist->Append(Standard_True);
-  // TDataStd_ReferenceList:
-  TDF_Label Lxml1 = doc_xml->Main().FindChild(100);
-  TDF_Tool::Entry(Lxml1, entry1);
-  TDF_Label Lxml2 = doc_xml->Main().FindChild(101);
-  TDF_Tool::Entry(Lxml2, entry2);
-  reflist = TDataStd_ReferenceList::Set(doc_xml->Main());
-  reflist->Append(Lxml1);
-  reflist->Append(Lxml2);
-  // TDataStd_BooleanArray:
-  boolarr = TDataStd_BooleanArray::Set(doc_xml->Main(), 15, 24);
-  boolarr->SetValue(15, Standard_False);
-  boolarr->SetValue(16, Standard_True);
-  boolarr->SetValue(17, Standard_True);
-  boolarr->SetValue(18, Standard_True);
-  boolarr->SetValue(19, Standard_True);
-  boolarr->SetValue(20, Standard_True);
-  boolarr->SetValue(21, Standard_False);
-  boolarr->SetValue(22, Standard_True);
-  boolarr->SetValue(23, Standard_True);
-  boolarr->SetValue(24, Standard_True);
-  // TDataStd_ReferenceArray:
-  refarr = TDataStd_ReferenceArray::Set(doc_xml->Main(), 444, 445);
-  refarr->SetValue(444, Lxml1);
-  refarr->SetValue(445, Lxml2);
-  // TDataStd_ByteArray:
-  bytearr = TDataStd_ByteArray::Set(doc_xml->Main(), 15, 24);
-  bytearr->SetValue(15, 0);
-  bytearr->SetValue(16, 10);
-  bytearr->SetValue(17, 100);
-  bytearr->SetValue(18, 200);
-  bytearr->SetValue(19, 250);
-  bytearr->SetValue(20, 251);
-  bytearr->SetValue(21, 252);
-  bytearr->SetValue(22, 253);
-  bytearr->SetValue(23, 254);
-  bytearr->SetValue(24, 255);
-  // TDF_Reference:
-  Lstd3 = doc_xml->Main().FindChild(103);
-  ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
-  // 
-  // Save
-  //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
-  if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
-    return 1;
-  intlist.Nullify();
-  ref.Nullify();
-  app->Close(doc_xml);
-  doc_xml.Nullify();
-  //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
-  if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
-    return 2;
-  if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 3;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
-    return 4;
-  if (intlist->First() != 1)
-    return 5;
-  if (intlist->Last() != 5)
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
-    return 4;
-  if (dbllist->First() != 1.5)
-    return 5;
-  if (dbllist->Last() != 5.5)
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
-    return 4;
-  if (strlist->First() != "Guten ")
-    return 5;
-  if (strlist->Last() != "Tag")
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
-    return 4;
-  if (boollist->First() != Standard_False)
-    return 5;
-  if (boollist->Last() != Standard_True)
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
-    return 4;
-  TDF_Tool::Entry(reflist->First(), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(reflist->Last(), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
-    return 4;
-  if (boolarr->Value(15) != Standard_False)
-    return 5;
-  if (boolarr->Value(16) != Standard_True)
-    return 5;
-  if (boolarr->Value(17) != Standard_True)
-    return 5;
-  if (boolarr->Value(18) != Standard_True)
-    return 5;
-  if (boolarr->Value(19) != Standard_True)
-    return 5;
-  if (boolarr->Value(20) != Standard_True)
-    return 5;
-  if (boolarr->Value(21) != Standard_False)
-    return 5;
-  if (boolarr->Value(22) != Standard_True)
-    return 5;
-  if (boolarr->Value(23) != Standard_True)
-    return 5;
-  if (boolarr->Value(24) != Standard_True)
-    return 5;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
-    return 4;
-  TDF_Tool::Entry(refarr->Value(444), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(refarr->Value(445), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_xml_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
-    return 4;
-  if (bytearr->Value(15) != 0)
-    return 5;
-  if (bytearr->Value(16) != 10)
-    return 5;
-  if (bytearr->Value(17) != 100)
-    return 5;
-  if (bytearr->Value(18) != 200)
-    return 5;
-  if (bytearr->Value(19) != 250)
-    return 5;
-  if (bytearr->Value(20) != 251)
-    return 5;
-  if (bytearr->Value(21) != 252)
-    return 5;
-  if (bytearr->Value(22) != 253)
-    return 5;
-  if (bytearr->Value(23) != 254)
-    return 5;
-  if (bytearr->Value(24) != 255)
-    return 5;
-  if (!doc_xml_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
-    return 4;
-  if (ref->Get().IsNull())
-    return 5;
-  if (ref->Get().Tag() != 103)
-      return 5;
-
-  // Bin
-  Handle(TDocStd_Document) doc_bin, doc_bin_open;
-  app->NewDocument("BinOcaf", doc_bin);
-  // TDataStd_Tick:
-  TDataStd_Tick::Set(doc_bin->Main());
-  // TDataStd_IntegerList:
-  intlist = TDataStd_IntegerList::Set(doc_bin->Main());
-  intlist->Append(1);
-  intlist->Append(5);
-  // TDataStd_RealList:
-  dbllist = TDataStd_RealList::Set(doc_bin->Main());
-  dbllist->Append(1.5);
-  dbllist->Append(5.5);
-  // TDataStd_ExtStringList:
-  strlist = TDataStd_ExtStringList::Set(doc_bin->Main());
-  strlist->Append("Bonjour");
-  strlist->Append("Bonsoir");
-  // TDataStd_BooleanList:
-  boollist = TDataStd_BooleanList::Set(doc_bin->Main());
-  boollist->Append(Standard_False);
-  boollist->Append(Standard_True);
-  // TDataStd_ReferenceList:
-  TDF_Label Lbin1 = doc_bin->Main().FindChild(100);
-  TDF_Tool::Entry(Lbin1, entry1);
-  TDF_Label Lbin2 = doc_bin->Main().FindChild(101);
-  TDF_Tool::Entry(Lbin2, entry2);
-  reflist = TDataStd_ReferenceList::Set(doc_bin->Main());
-  reflist->Append(Lbin1);
-  reflist->Append(Lbin2);
-  // TDataStd_BooleanArray:
-  boolarr = TDataStd_BooleanArray::Set(doc_bin->Main(), 15, 24);
-  boolarr->SetValue(15, Standard_False);
-  boolarr->SetValue(16, Standard_True);
-  boolarr->SetValue(17, Standard_True);
-  boolarr->SetValue(18, Standard_True);
-  boolarr->SetValue(19, Standard_True);
-  boolarr->SetValue(20, Standard_True);
-  boolarr->SetValue(21, Standard_False);
-  boolarr->SetValue(22, Standard_True);
-  boolarr->SetValue(23, Standard_True);
-  boolarr->SetValue(24, Standard_True);
-  // TDataStd_ReferenceArray:
-  refarr = TDataStd_ReferenceArray::Set(doc_bin->Main(), 0, 1);
-  refarr->SetValue(0, Lbin1);
-  refarr->SetValue(1, Lbin2);
-  // TDataStd_ByteArray:
-  bytearr = TDataStd_ByteArray::Set(doc_bin->Main(), 15, 16);
-  bytearr->SetValue(15, 0);
-  bytearr->SetValue(16, 255);
-  // TDataStd_NamedData:
-  nameddata = TDataStd_NamedData::Set(doc_bin->Main());
-  nameddata->SetByte("A", 12);
-  nameddata->SetByte("B", 234);
-  // TDF_Reference:
-  Lstd3 = doc_bin->Main().FindChild(103);
-  ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
-  // 
-  // Save
-  //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
-  if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
-    return 1;
-  intlist.Nullify();
-  ref.Nullify();
-  app->Close(doc_bin);
-  doc_bin.Nullify();
-  //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
-  if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
-    return 2;
-  if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
-    return 3;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_IntegerList::GetID(), intlist))
-    return 4;
-  if (intlist->First() != 1)
-    return 5;
-  if (intlist->Last() != 5)
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_RealList::GetID(), dbllist))
-    return 4;
-  if (dbllist->First() != 1.5)
-    return 5;
-  if (dbllist->Last() != 5.5)
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_ExtStringList::GetID(), strlist))
-    return 4;
-  if (strlist->First() != "Bonjour")
-    return 5;
-  if (strlist->Last() != "Bonsoir")
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanList::GetID(), boollist))
-    return 4;
-  if (boollist->First() != Standard_False)
-    return 5;
-  if (boollist->Last() != Standard_True)
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceList::GetID(), reflist))
-    return 4;
-  TDF_Tool::Entry(reflist->First(), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(reflist->Last(), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_BooleanArray::GetID(), boolarr))
-    return 4;
-  if (boolarr->Value(15) != Standard_False)
-    return 5;
-  if (boolarr->Value(16) != Standard_True)
-    return 5;
-  if (boolarr->Value(17) != Standard_True)
-    return 5;
-  if (boolarr->Value(18) != Standard_True)
-    return 5;
-  if (boolarr->Value(19) != Standard_True)
-    return 5;
-  if (boolarr->Value(20) != Standard_True)
-    return 5;
-  if (boolarr->Value(21) != Standard_False)
-    return 5;
-  if (boolarr->Value(22) != Standard_True)
-    return 5;
-  if (boolarr->Value(23) != Standard_True)
-    return 5;
-  if (boolarr->Value(24) != Standard_True)
-    return 5;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_ReferenceArray::GetID(), refarr))
-    return 4;
-  TDF_Tool::Entry(refarr->Value(0), entry_first);
-  if (entry1 != entry_first)
-    return 5;
-  TDF_Tool::Entry(refarr->Value(1), entry_last);
-  if (entry2 != entry_last)
-    return 6;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_ByteArray::GetID(), bytearr))
-    return 4;
-  if (bytearr->Value(15) != 0)
-    return 5;
-  if (bytearr->Value(16) != 255)
-    return 5;
-  if (!doc_bin_open->Main().FindAttribute(TDataStd_NamedData::GetID(), nameddata))
-    return 4;
-  if (nameddata->GetByte("A") != 12)
-    return 5;
-  if (nameddata->GetByte("B") != 234)
-    return 5;
-  if (!doc_bin_open->Main().FindAttribute(TDF_Reference::GetID(), ref))
-    return 4;
-  if (ref->Get().IsNull())
-    return 5;
-  if (ref->Get().Tag() != 103)
-      return 5;
-
-  return 0;
-}
-// For OCC16782 testing
-
-static Standard_Integer OCC16782 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 4)
-  {
-    di << "Usage : " << argv[0] << " file.std file.xml file.cbf\n";
-    return 1;
-  }
-  TCollection_ExtendedString aFile1(argv[1]);
-  TCollection_ExtendedString aFile2(argv[2]);
-  TCollection_ExtendedString aFile3(argv[3]);
-
-  if (app.IsNull())
-    app = new AppStd_Application();
-
-  int good = 0;
-  
-  Handle(TDocStd_Document) doc;
-  app->NewDocument("MDTV-Standard", doc);
-  doc->SetUndoLimit(10);
-
-  di <<"\nTestSetGet start\n";
-  good += TestSetGet(doc);
-  di <<"TestSetGet finish\n";
-  di <<"Status = " << good << "\n";
-
-  di <<"\nTestUndoRedo start\n";
-  good += TestUndoRedo(doc);
-  di <<"TestUndoRedo finish\n";
-  di <<"Status = " << good << "\n";
-
-  di <<"\nTestCopyPaste start\n";
-  good += TestCopyPaste(doc);
-  di <<"TestCopyPaste finish\n";
-  di <<"Status = " << good << "\n";
-
-  di <<"\nTestOpenSave start\n";
-  good += TestOpenSave(aFile1, aFile2, aFile3);
-  di <<"TestOpenSave finish\n";
-  di <<"Status = " << good << "\n";
-
-  if (!good)
-    di <<"\nThe " << argv[0] << " test is passed well, OK\n";
-  else
-    di <<"\nThe " << argv[0] << " test failed, Faulty\n";
-
-  return 0;
-}
-
-static Standard_Integer OCC12584 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << " ERROR : use 'vinit' command before " << "\n";
-    return -1;
-  }
-
-  if (argc > 2)
-  {
-    di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
-    return 1;
-  }
-  Standard_Integer mode = 0;
-  if (argc == 2)
-  {
-    mode = atoi(argv[1]);
-  }
-  if (mode > 2 || mode < 0)
-  {
-    di << "Usage : " << argv[0] << " [mode = 0/1/2]\n";
-    return 1;
-  }
-  Handle(V3d_View) V = ViewerTest::CurrentView();
-  if ( !V.IsNull() ) {
-    if (mode == 0) {
-      V->ColorScaleDisplay();
-    }
-    if (mode == 1) {
-      V->ColorScaleErase();
-      V->UpdateLights();
-      V->Update();
-    }
-    if (mode == 2) {
-      Standard_Boolean IsDisplayed = V->ColorScaleIsDisplayed();
-      if (IsDisplayed)
-       di <<"ColorScaleIsDisplayed = " << "1" << "\n";
-      else
-       di <<"ColorScaleIsDisplayed = " << "0" << "\n";
-    }
-  }
-  return 0;
-}
-
-#include <Interface_Macros.hxx>
-#include <IGESControl_Controller.hxx>
-#include <XSDRAW.hxx>
-#include <Draw_ProgressIndicator.hxx>
-#include <XSControl_WorkSession.hxx>
-#include <Transfer_TransientProcess.hxx>
-#include <XSDRAW_Commands.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <Message_ProgressSentry.hxx>
-#include <XSControl_TransferReader.hxx>
-
-static Standard_Integer OCC18612igesbrep (Draw_Interpretor& di, Standard_Integer argc, const char ** argv) 
-{
-  DeclareAndCast(IGESControl_Controller,ctl,XSDRAW::Controller());
-  if (ctl.IsNull()) XSDRAW::SetNorm("IGES");
-
-  // Progress indicator
-  Handle(Draw_ProgressIndicator) progress = new Draw_ProgressIndicator ( di, 1 );
-  progress->SetScale ( 0, 100, 1 );
-  progress->Show();
-  IGESControl_Reader Reader (XSDRAW::Session(),Standard_False);
-  if (ctl.IsNull())
-    ctl=Handle(IGESControl_Controller)::DownCast(XSDRAW::Controller());
-
-  TCollection_AsciiString fnom,rnom;
-
-  Standard_Boolean modfic = XSDRAW::FileAndVar
-    (argv[1],argv[2],"IGESBREP",fnom,rnom);
-  if (modfic) di<<" File IGES to read : "<<fnom.ToCString()<<"\n";
-  else        di<<" Model taken from the session : "<<fnom.ToCString()<<"\n";
-  di<<" -- Names of variables BREP-DRAW prefixed by : "<<rnom.ToCString()<<"\n";
-  IFSelect_ReturnStatus readstat = IFSelect_RetVoid;
-
-#ifdef CHRONOMESURE
-  OSD_Timer Chr; Chr.Reset();
-  IDT_SetLevel(3);
-#endif
-
-
-// Reading the file
-  progress->NewScope ( 20, "Loading" ); // On average loading takes 20% 
-  progress->Show();
-
-  // *New* 
-  //In order to decrease number of produced edges during translation it is possible to set following parameter
-  Interface_Static::SetIVal("read.iges.bspline.continuity",0);
-  // *New* 
-
-  if (modfic) readstat = Reader.ReadFile (fnom.ToCString());
-  else  if (XSDRAW::Session()->NbStartingEntities() > 0) readstat = IFSelect_RetDone;
-
-  progress->EndScope();
-  progress->Show();
-
-  if (readstat != IFSelect_RetDone) {
-    if (modfic) di<<"Could not read file "<<fnom.ToCString()<<" , abandon"<<"\n";
-    else di<<"No model loaded"<<"\n";
-    return 1;
-  }
-// Choice of treatment
-  Standard_Boolean fromtcl = (argc > 3);
-  Standard_Integer modepri = 1, nent, nbs;
-  if (fromtcl) modepri = 4;
-
-  while (modepri) {
-    //Roots for transfer are defined before setting mode ALL or OnlyVisible - gka 
-    //mode OnlyVisible does not work.
-    // nent = Reader.NbRootsForTransfer();
-    if (!fromtcl) {
-      cout<<"Mode (0 End, 1 Visible Roots, 2 All Roots, 3 Only One Entity, 4 Selection) :"<<flush;
-      modepri = -1;
-      
-// amv 26.09.2003 : this is used to avoid error of enter's simbol        
-      char str[80];                                                             
-      cin>>str;                                                                 
-      modepri = atoi(str);   
-    }
-
-    if (modepri == 0) {  //fin
-      di << "Bye and good luck! " << "\n";
-      break;
-    } 
-
-    else if (modepri <= 2) {  // 1 : Visible Roots, 2 : All Roots
-      di << "All Geometry Transfer"<<"\n";
-      di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
-      di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
-      Handle(XSControl_WorkSession) thesession = Reader.WS();
-      thesession->ClearContext();
-      XSDRAW::SetTransferProcess (thesession->MapReader());
-      progress->NewScope ( 80, "Translation" );
-      progress->Show();
-      thesession->MapReader()->SetProgress ( progress );
-      
-      if (modepri == 1) Reader.SetReadVisible (Standard_True);
-      Reader.TransferRoots();
-      
-      thesession->MapReader()->SetProgress ( 0 );
-      progress->EndScope();
-      progress->Show();
-      // result in only one shape for all the roots
-      //        or in one shape for one root.
-      di<<"Count of shapes produced : "<<Reader.NbShapes()<<"\n";
-      Standard_Integer answer = 1;
-      if (Reader.NbShapes() > 1) {
-       cout << " pass(0)  one shape for all (1)\n or one shape per root (2)\n + WriteBRep (one for all : 3) (one per root : 4) : " << flush;
-        answer = -1;
-        //amv 26.09.2003                                                        
-        char str_a[80];                                                         
-        cin >> str_a;                                                           
-        answer = atoi(str_a);    
-      }
-      if ( answer == 0) continue;
-      if ( answer == 1 || answer == 3) {
-       TopoDS_Shape shape = Reader.OneShape();
-       // save the shape
-       if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
-       char fname[110];
-       sprintf(fname, "%s", rnom.ToCString());
-       di << "Saving shape in variable Draw : " << fname << "\n";
-       if (answer == 3) IGESToBRep::WriteShape (shape,1);
-       try {
-         OCC_CATCH_SIGNALS
-         DBRep::Set(fname,shape);
-       }
-       catch(Standard_Failure) {
-         di << "** Exception : ";
-         di << Standard_Failure::Caught()->GetMessageString();
-         di<<" ** Skip"<<"\n";
-         di << "Saving shape in variable Draw : " << fname << "\n";
-         IGESToBRep::WriteShape (shape,1);
-       }
-      }
-       
-      else if (answer == 2 || answer == 4) {
-       Standard_Integer numshape = Reader.NbShapes();
-       for (Standard_Integer inum = 1; inum <= numshape; inum++) {
-         // save all the shapes
-         TopoDS_Shape shape = Reader.Shape(inum);
-         if (shape.IsNull()) { di<<"No Shape produced"<<"\n"; continue; }
-         char fname[110];
-         sprintf(fname, "%s_%d", rnom.ToCString(),inum);
-         di << "Saving shape in variable Draw : " << fname << "\n";
-         if (answer == 4) IGESToBRep::WriteShape (shape,inum);
-         try {
-           OCC_CATCH_SIGNALS
-           DBRep::Set(fname,shape);
-         }
-         catch(Standard_Failure) {
-           di << "** Exception : ";
-           di << Standard_Failure::Caught()->GetMessageString();
-           di<<" ** Skip"<<"\n";
-         }
-       }
-      }
-      else return 0;
-    }
-
-    else if (modepri == 3) {  // One Entity
-      cout << "Only One Entity"<<endl;
-      cout<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<endl;
-      cout<<"  To modify : command  param read.iges.bspline.continuity"<<endl;
-      cout << " give the number of the Entity : " << flush;
-      nent = XSDRAW::GetEntityNumber();
-
-      if (!Reader.TransferOne (nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
-      else {
-       nbs = Reader.NbShapes();
-       char shname[30];  sprintf (shname,"%s_%d",rnom.ToCString(),nent);
-       di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-       di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
-       TopoDS_Shape sh = Reader.Shape(nbs);
-       DBRep::Set (shname,sh);
-      }
-    }
-
-    else if (modepri == 4) {   // Selection
-      Standard_Integer answer = 1;
-      Handle(TColStd_HSequenceOfTransient)  list;
-
-//  Selection, nommee ou via tcl. tcl : raccourcis admis
-//   * donne iges-visible + xst-transferrable-roots
-//   *r donne xst-model-roots (TOUTES racines)
-
-      if( fromtcl && argv[3][0]=='*' && argv[3][1]=='\0' ) {         
-        di << "All Geometry Transfer"<<"\n";
-        di<<"spline_continuity (read) : "<<Interface_Static::IVal("read.iges.bspline.continuity")<<" (0 : no modif, 1 : C1, 2 : C2)"<<"\n";
-        di<<"  To modify : command  param read.iges.bspline.continuity"<<"\n";
-        Handle(XSControl_WorkSession) thesession = Reader.WS();
-        thesession->ClearContext();
-        XSDRAW::SetTransferProcess (thesession->MapReader());
-        progress->NewScope ( 80, "Translation" );
-        progress->Show();
-        thesession->MapReader()->SetProgress ( progress );
-      
-        Reader.SetReadVisible (Standard_True);
-        Reader.TransferRoots();
-      
-        thesession->MapReader()->SetProgress ( 0 );
-        progress->EndScope();
-        progress->Show();
-        
-        // result in only one shape for all the roots
-        TopoDS_Shape shape = Reader.OneShape();
-        // save the shape
-        char fname[110];
-        sprintf(fname, "%s", rnom.ToCString());
-        di << "Saving shape in variable Draw : " << fname << "\n";
-        try {
-          OCC_CATCH_SIGNALS
-          DBRep::Set(fname,shape);
-        }
-        catch(Standard_Failure) {
-          di << "** Exception : ";
-         di << Standard_Failure::Caught()->GetMessageString();
-         di<<" ** Skip"<<"\n";
-          di << "Saving shape in variable Draw : " << fname << "\n";
-          IGESToBRep::WriteShape (shape,1);
-        }                                                                             
-        return 0;
-      }
-   
-      if(fromtcl) {
-       modepri = 0;    // d office, une seule passe
-       if (argv[3][0] == '*' && argv[3][1] == 'r' && argv[3][2] == '\0') {
-         di<<"All Roots : ";
-         list = XSDRAW::GetList ("xst-model-roots");
-       }
-        else {
-         TCollection_AsciiString compart = XSDRAW_CommandPart (argc,argv,3);
-         di<<"List given by "<<compart.ToCString()<<" : ";
-         list = XSDRAW::GetList (compart.ToCString());
-       }
-       if (list.IsNull()) {
-          di<<"No list defined. Give a selection name or * for all visible transferrable roots"<<"\n";
-          continue;
-        }
-      }
-      else {
-       cout<<"Name of Selection :"<<flush;
-       list = XSDRAW::GetList();
-       if (list.IsNull()) { cout<<"No list defined"<<endl; continue; }
-      }
-
-      Standard_Integer nbl = list->Length();
-      di<<"Nb entities selected : "<<nbl<<"\n";
-      if (nbl == 0) continue;
-      while (answer) {
-       if (!fromtcl) {
-         cout<<"Choice: 0 abandon  1 transfer all  2 with confirmation  3 list n0s ents :"<<flush;
-          answer = -1;
-          // anv 26.09.2003                                                     
-          char str_answer[80];                                                  
-          cin>>str_answer;                                                      
-          answer = atoi(str_answer);    
-       }
-       if (answer <= 0 || answer > 3) continue;
-       if (answer == 3) {
-         for (Standard_Integer ill = 1; ill <= nbl; ill ++) {
-           Handle(Standard_Transient) ent = list->Value(ill);
-           di<<"  ";// model->Print(ent,di);
-         }
-         di<<"\n";
-       }
-       if (answer == 1 || answer == 2) {
-         Standard_Integer nbt = 0;
-         Handle(XSControl_WorkSession) thesession = Reader.WS();
-       
-         XSDRAW::SetTransferProcess (thesession->MapReader());
-          progress->NewScope ( 80, "Translation" );
-          progress->Show();
-          thesession->MapReader()->SetProgress ( progress );
-
-          Message_ProgressSentry PSentry ( progress, "Root", 0, nbl, 1 );
-         for (Standard_Integer ill = 1; ill <= nbl && PSentry.More(); ill ++, PSentry.Next()) {
-         
-           nent = Reader.Model()->Number(list->Value(ill));
-           if (nent == 0) continue;
-           if (!Reader.TransferOne(nent)) di<<"Transfer entity n0 "<<nent<<" : no result"<<"\n";
-           else {
-             nbs = Reader.NbShapes();
-             char shname[30];  sprintf (shname,"%s_%d",rnom.ToCString(),nbs);
-             di<<"Transfer entity n0 "<<nent<<" OK  -> DRAW Shape: "<<shname<<"\n";
-             di<<"Now, "<<nbs<<" Shapes produced"<<"\n";
-             TopoDS_Shape sh = Reader.Shape(nbs);
-             DBRep::Set (shname,sh);
-              nbt++;
-           }
-         }
-         thesession->MapReader()->SetProgress ( 0 );
-          progress->EndScope();
-          progress->Show();
-         di<<"Nb Shapes successfully produced : "<<nbt<<"\n";
-         answer = 0;  // on ne reboucle pas
-       }
-      }
-    }
-    else di<<"Unknown mode n0 "<<modepri<<"\n";
-  }
-
-  // *New* 
-  //In order to clear memory after IGES reading you could add the following code
-  Handle(XSControl_TransferReader) TR = Reader.WS()->TransferReader();
-  Handle(Transfer_TransientProcess) TP = TR->TransientProcess();
-  TP->Clear();
-  TR->Clear(2);
-  Reader.WS()->Model()->Clear();
-  Standard_Integer i =1;
-  for( ; i <= 7; i++)
-    Reader.WS()->ClearData(i);
-  // *New* 
-
-  return 0;
-}
-
-#include <Geom_Plane.hxx>
-static Standard_Integer OCC20766 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 6)
-  {
-    di << "Usage : " << argv[0] << " plane a b c d\n";
-    return 1;
-  }
-
-  Standard_Real A = atof(argv[2]);
-  Standard_Real B = atof(argv[3]);
-  Standard_Real C = atof(argv[4]);
-  Standard_Real D = atof(argv[5]);
-
-  Handle(Geom_Geometry) result;
-
-  Handle(Geom_Plane) aPlane = new Geom_Plane(A, B, C, D);
-  result = aPlane;
-
-  DrawTrSurf::Set(argv[1],result);
-  return 0;
-}
-
-static Standard_Integer OCC20627 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=2)
-    {
-      di << "Usage : " << argv[0] << " MaxNbr" << "\n";
-      return -1;
-    }
-  Standard_Integer aMaxNbr = atoi(argv[1]);
-
-  for (Standard_Integer i=0;i<aMaxNbr;i++)
-    {
-      BRepBuilderAPI_MakePolygon w(gp_Pnt(0,0,0),gp_Pnt(0,100,0),gp_Pnt(20,100,0),gp_Pnt(20,0,0));
-      w.Close();
-      TopoDS_Wire wireShape( w.Wire());
-      BRepBuilderAPI_MakeFace faceBuilder(wireShape);
-      TopoDS_Face f( faceBuilder.Face());
-      BRepMesh_IncrementalMesh im(f,1);
-      BRepTools::Clean(f);
-    }
-  return 0;
-}
-
-#include <Graphic3d_Vector.hxx>
-Standard_Integer OCC22762 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-    if (argc!=7)
-       {
-           di << "Wrong number of arguments" << "\n";
-           return -1;
-       }
-    Standard_Real X1_Pnt = atof(argv[1]);
-    Standard_Real Y1_Pnt = atof(argv[2]);
-    Standard_Real Z1_Pnt = atof(argv[3]);
-    Standard_Real X2_Pnt = atof(argv[4]);
-    Standard_Real Y2_Pnt = atof(argv[5]);
-    Standard_Real Z2_Pnt = atof(argv[6]);
-    
-    Graphic3d_Vector AV1(X1_Pnt, Y1_Pnt, Z1_Pnt);
-    Graphic3d_Vector AV2(X2_Pnt, Y2_Pnt, Z2_Pnt);
-     
-    di << "Result is: " << (Graphic3d_Vector::IsParallel(AV1, AV2) ? "true" : "false") << "\n" ;
-    return 0;
-}
-    
-    
-
-
-#include <IntCurvesFace_ShapeIntersector.hxx>
-#include <gp_Lin.hxx>
-Standard_Integer OCC17424 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=9)
-    {
-      di << "Usage : " << argv[0] << " shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf" << "\n";
-      return -1;
-    }
-
-  TopoDS_Shape shape = DBRep::Get(argv[1]);
-
-  if (shape.IsNull()) {
-    di<<" Null shape is not allowed";
-    return 1;
-  }
-
-  Standard_Real X_Pnt = atof(argv[2]);
-  Standard_Real Y_Pnt = atof(argv[3]);
-  Standard_Real Z_Pnt = atof(argv[4]);
-
-  Standard_Real X_Dir = atof(argv[5]);
-  Standard_Real Y_Dir = atof(argv[6]);
-  Standard_Real Z_Dir = atof(argv[7]);
-
-  Standard_Real PInf  = atof(argv[8]);
-
-  IntCurvesFace_ShapeIntersector intersector;
-  intersector.Load(shape, Precision::Intersection());
-
-  gp_Pnt origin(X_Pnt, Y_Pnt, Z_Pnt);
-  gp_Dir dir(X_Dir, Y_Dir, Z_Dir);
-  gp_Lin ray(origin, dir);
-
-  Standard_Real PSup = RealLast();
-  intersector.PerformNearest(ray, PInf, PSup);
-  if (intersector.NbPnt() != 0)
-    {
-      di << argv[0] << " status = 0 \n";
-      Standard_Real w = intersector.WParameter(1);
-      di << "w = " << w << "\n";
-    } else {
-      di << argv[0] << " status = -1 \n";
-    }
-  return 0;
-}
-
-Standard_Integer OCC22301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 1) {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-  // Create mask 1111: extent == 4
-  TColStd_PackedMapOfInteger aFullMask;
-  for (Standard_Integer i = 0; i < 4; i++)
-    aFullMask.Add(i);
-  
-  // Create mask 1100: extent == 2
-  TColStd_PackedMapOfInteger aPartMask;
-  for (Standard_Integer i = 0; i < 2; i++)
-    aPartMask.Add(i);
-  
-  di << "aFullMask = 1111" << "\n";
-  di << "aPartMask = 1100" << "\n";
-  
-  Standard_Boolean isAffected;
-  
-  isAffected = aFullMask.Intersect(aPartMask); // true; extent == 2 (OK)
-  di << "First time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
-  isAffected = aFullMask.Intersect(aPartMask); // true; extent == 0 (?)
-  di << "Second time: aFullMask.Intersect(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
-  isAffected = aFullMask.Subtract(aPartMask); // false (?)
-  di << "After two intersections: aFullMask.Subtract(aPartMask), isAffected = " << (Standard_Integer)isAffected << "\n";
-
-  return 0;
-}
-#include <ShapeFix_FixSmallFace.hxx>
-Standard_Integer OCC22586 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-       
-  if (argc != 3) {
-    di << "Usage : " << argv[0] << " shape resshape\n";
-    return 1;
-  }
-  
-  // try to read a shape:
-  TopoDS_Shape aShape=DBRep::Get(argv[1]);
-  ShapeFix_FixSmallFace aFixSmallFaces;
-  aFixSmallFaces.Init (aShape);
-  aFixSmallFaces.Perform();
-  TopoDS_Shape aResShape = aFixSmallFaces.Shape();
-  DBRep::Set(argv[2],aResShape);
-  
-  return 0;
-
-}
-
-#include <NCollection_DataMap.hxx>
-Standard_Integer OCC22744 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-       
-  if (argc != 1) {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-  
-  TCollection_ExtendedString anExtString;
-  
-  Standard_ExtCharacter aNonAsciiChar = 0xff00;
-  anExtString.Insert(1, aNonAsciiChar);
-
-  di << "Is ASCII: " << ( anExtString.IsAscii() ? "true" : "false" ) << "\n";
-  NCollection_DataMap<TCollection_ExtendedString, Standard_Integer> aMap;
-  aMap.Bind(anExtString, 0);
-  
-  return 0;
-
-}
-
-Standard_Integer OCC22558 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-    if (argc != 10) {
-       di << "Wrong number of arguments" << argv[0] << "\n";
-       return 1;
-    }
-    
-    Standard_Real X_vec = atof(argv[1]);
-    Standard_Real Y_vec = atof(argv[2]);
-    Standard_Real Z_vec = atof(argv[3]);
-    
-    Standard_Real X_dir = atof(argv[4]);
-    Standard_Real Y_dir = atof(argv[5]);
-    Standard_Real Z_dir = atof(argv[6]);
-    
-    Standard_Real X_pnt = atof(argv[7]);
-    Standard_Real Y_pnt = atof(argv[8]);
-    Standard_Real Z_pnt = atof(argv[9]);
-    
-    gp_Dir toSym(X_vec, Y_vec, Z_vec);
-    gp_Dir dir(X_dir, Y_dir, Z_dir);
-    gp_Pnt loc(X_pnt, Y_pnt, Z_pnt);
-    gp_Ax2 symObj(loc,dir);
-    toSym.Mirror(symObj);
-    
-    di << "The result " << toSym.X() << " " << toSym.Y() << " " << toSym.Z() << "\n"; 
-    return 0;
-}
-    
-
-Standard_Integer OCC22736 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-       
-  if (argc != 9) {
-    di << "Usage : " << argv[0] << " X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2\n";
-    return 1;
-  }
-
-  Standard_Real X_mirrorFirstPoint = atof(argv[1]);
-  Standard_Real Y_mirrorFirstPoint = atof(argv[2]);
-  Standard_Real X_mirrorSecondPoint = atof(argv[3]);
-  Standard_Real Y_mirrorSecondPoint = atof(argv[4]);
-  Standard_Real X_p1 = atof(argv[5]);
-  Standard_Real Y_p1 = atof(argv[6]);
-  Standard_Real X_p2 = atof(argv[7]);
-  Standard_Real Y_p2 = atof(argv[8]);
-  
-  gp_Trsf2d identityTransformation;
-
-  gp_Pnt2d mirrorFirstPoint(X_mirrorFirstPoint,Y_mirrorFirstPoint);
-  gp_Pnt2d mirrorSecondPoint(X_mirrorSecondPoint,Y_mirrorSecondPoint);
-  gp_Ax2d  mirrorAxis(mirrorFirstPoint,gp_Vec2d(mirrorFirstPoint,mirrorSecondPoint));
-
-  gp_Pnt2d p1(X_p1,Y_p1);
-  gp_Pnt2d p2(X_p2,Y_p2);
-
-  gp_Trsf2d M1;
-  M1.SetMirror(mirrorAxis);
-  gp_Trsf2d M2;
-  M2.SetMirror(mirrorAxis);
-  gp_Trsf2d Tcomp;
-  Tcomp = M2.Multiplied(M1);
-
-  Standard_Real aTol = Precision::Confusion();
-  Standard_Integer aStatus = 0;
-
-  //After applying two times the same mirror the point is located on the same location OK
-  gp_Pnt2d p1MirrorM1   = p1.Transformed(M1);
-  if ( Abs(p2.X() - p1MirrorM1.X()) > aTol )
-    aStatus = 2;
-  if ( Abs(p2.Y() - p1MirrorM1.Y()) > aTol )
-    aStatus = 3;
-
-  gp_Pnt2d p1MirrorM1M2 = p1MirrorM1.Transformed(M2);
-  if ( Abs(p1.X() - p1MirrorM1M2.X()) > aTol )
-    aStatus = 4;
-  if ( Abs(p1.Y() - p1MirrorM1M2.Y()) > aTol )
-    aStatus = 5;
-
-  //If we apply the composed transformation of the same two mirrors to a point the result is //not located on the initial position.-->>ERROR
-  gp_Pnt2d p1MirrorComp = p1.Transformed(Tcomp);
-  if ( Abs(p1.X() - p1MirrorComp.X()) > aTol )
-    aStatus = 6;
-  if ( Abs(p1.Y() - p1MirrorComp.Y()) > aTol )
-    aStatus = 7;
-
-  di << "Status = " << aStatus << "\n";
-  return 0;
-}
-
-#include <BOPTColStd_CArray1OfInteger.hxx>
-//=======================================================================
-//function : DumpArray
-//purpose  : 
-//=======================================================================
-void DumpArray(const BOPTColStd_CArray1OfInteger& aC,
-              Draw_Interpretor& aDI)
-{
-  Standard_Integer iLength, iFactLength, iBlockLength;
-  //
-  iLength=aC.Length();
-  iFactLength=aC.FactLength();
-  iBlockLength=aC.BlockLength();
-  //
-  aDI<< "Length: " <<iLength << "\n";
-  aDI<< "FactLength: " <<iFactLength << "\n";
-  aDI<< "BlockLength: " <<iBlockLength << "\n";
-}
-//=======================================================================
-//function : bcarray
-//purpose  : 
-//=======================================================================
-Standard_Integer bcarray (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-       
-  if (argc != 1) {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-  Standard_Integer i, aNb, aBL;
-  BOPTColStd_CArray1OfInteger aC;
-  //
-  aBL=100000;
-  aC.SetBlockLength(aBL);
-  //
-  for (i=1; i<=10; ++i) {
-    aC.Append(-i*10);
-  }
-  di<< "\nstate before release the unused memory\n";
-  DumpArray(aC, di);
-  //
-  aC.Purge();
-  //
-  di<< "\nstate after release the unused memory\n";
-  DumpArray(aC, di);
-  //
-  return 0;
-}
-
-void QAOCC::Commands(Draw_Interpretor& theCommands) {
-  const char *group = "QAOCC";
-
-  theCommands.Add("OCC128", "OCC128", __FILE__, OCC128, group);
-
-  // Remove as bad version of QAAddOrRemoveSelected from QADraw
-  //theCommands.Add("OCC129", "OCC129 shape islocal", __FILE__, OCC129, group);
-
-  theCommands.Add("OCC136", "OCC136", __FILE__, OCC136, group);
-  theCommands.Add("BUC60610","BUC60610 iges_input [name]",__FILE__,BUC60610,group);
-  theCommands.Add("BUC60661","BUC60661 file.igs",__FILE__,BUC60661,  group);
-
-//====================================================
-//
-// Following commands are inserted from 
-// /dn03/KAS/dev/QAopt/src/QADraw/QADraw_TOPOLOGY.cxx
-// ( 75455 Apr 16 18:59)
-//
-//====================================================
-
-  theCommands.Add("OCC105","OCC105 shape",__FILE__,OCC105,group); 
-  theCommands.Add("OCC9"," result path cur1 cur2 radius [tolerance]:\t test GeomFill_Pipe", __FILE__, pipe_OCC9,group);
-
-  theCommands.Add("OCC125","OCC125 shell", __FILE__, OCC125,group);
-
-  theCommands.Add("OCC157","findplanarsurface Result wire Tol",__FILE__,OCC157,group);
-  //theCommands.Add("OCC165","OCC165",__FILE__,OCC165,group);
-  theCommands.Add("OCC165","OCC165 file",__FILE__,OCC165,group);
-  theCommands.Add("OCC297","OCC297",__FILE__,OCC297,group);
-  //theCommands.Add("OCC305","OCC305",__FILE__,OCC305,group);
-  theCommands.Add("OCC305","OCC305 file",__FILE__,OCC305,group);
-
-  // New commands:
-  theCommands.Add("OCC166", "OCC166", __FILE__, OCC166, group);
-  theCommands.Add("OCC381_Save", "OCC381_Save Doc", __FILE__, OCC381_Save, group);
-  theCommands.Add("OCC381_SaveAs", "OCC381_SaveAs Doc Path", __FILE__, OCC381_SaveAs, group);
-
-  theCommands.Add("OCC299","OCC299 Solid Point [Tolerance=1.e-7]", __FILE__, OCC299bug, group);
-  theCommands.Add("OCC309","OCC309", __FILE__, OCC309bug, group);
-  theCommands.Add("OCC310","OCC310", __FILE__, OCC310bug, group);
-
-  //theCommands.Add("OCC277","OCC277", __FILE__, OCC277bug, group);
-  theCommands.Add("OCC277","OCC277 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC277bug, group);
-
-  theCommands.Add("OCC333","OCC333 edge1 edge2 [toler domaindist]; Check overlapping edges", __FILE__, OCC333bug, group);
-
-  theCommands.Add("OCC363", "OCC363 document filename ", __FILE__, OCC363, group);
-  // Must use OCC299
-  //theCommands.Add("OCC372", "OCC372", __FILE__, OCC372, group);
-  theCommands.Add("OCC377", "OCC377", __FILE__, OCC377, group);
-  theCommands.Add("OCC22", "OCC22 Result Shape CompoundOfSubshapesToBeDivided ConsiderLocation", __FILE__, OCC22, group);
-  theCommands.Add("OCC24", "OCC24 Result Shape CompoundOfSubshapes ResourceFileName", __FILE__, OCC24, group);
-  theCommands.Add("OCC369", "OCC369 Shape", __FILE__, OCC369, group);
-  theCommands.Add("OCC524", "OCC524 LowerVector UpperVector InitialValueVector LowerRowMatrix UpperRowMatrix LowerColMatrix UpperColMatrix InitialValueMatrix", __FILE__, OCC524, group);
-  theCommands.Add("OCC525", "OCC525", __FILE__, OCC525, group);
-  theCommands.Add("OCC543", "OCC543 name", __FILE__, OCC543, group);
-  //theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3", __FILE__, OCC578, group);
-  theCommands.Add("OCC578", "OCC578 shape1 shape2 shape3 [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC578, group);
-  theCommands.Add("OCC627", "OCC627", __FILE__, OCC627, group);
-  theCommands.Add("OCC669", "OCC669 GUID", __FILE__, OCC669, group);
-  theCommands.Add("OCC738_ShapeRef", "OCC738_ShapeRef", __FILE__, OCC738_ShapeRef, group);
-  theCommands.Add("OCC738_Assembly", "OCC738_Assembly", __FILE__, OCC738_Assembly, group);
-  theCommands.Add("OCC708", "OCC708 shape ; Deactivate the current transformation", __FILE__, OCC708, group);
-  theCommands.Add("OCC670", "OCC670", __FILE__, OCC670, group);
-  theCommands.Add("OCC867", "OCC867 Point Surface Umin Usup Vmin Vsup", __FILE__, OCC867, group);
-  theCommands.Add("OCC909", "OCC909 wire face", __FILE__, OCC909, group);
-  theCommands.Add("OCC921", "OCC921 face", __FILE__, OCC921, group);
-  theCommands.Add("OCC902", "OCC902 expression", __FILE__, OCC902, group);
-
-  theCommands.Add ("OCC1029_AISTransparency","OCC1029_AISTransparency (DOC, entry, [real])",__FILE__, OCC1029_AISTransparency, group);
-  theCommands.Add ("OCC1030_AISColor", "OCC1030_AISColor (DOC, entry, [color])", __FILE__, OCC1030_AISColor, group);
-  theCommands.Add ("OCC1031_AISMaterial", "OCC1031_AISMaterial (DOC, entry, [material])", __FILE__, OCC1031_AISMaterial, group); 
-  theCommands.Add ("OCC1032_AISWidth", "OCC1032_AISWidth (DOC, entry, [width])", __FILE__, OCC1032_AISWidth, group); 
-  theCommands.Add ("OCC1033_AISMode", "OCC1033_AISMode (DOC, entry, [mode])", __FILE__, OCC1033_AISMode, group); 
-  theCommands.Add ("OCC1034_AISSelectionMode", "OCC1034_AISSelectionMode (DOC, entry, [selectionmode])", __FILE__, OCC1034_AISSelectionMode, group); 
-
-  //theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape", __FILE__, OCC1487, group);
-  theCommands.Add("OCC1487", "OCC1487 CylinderVariant(=1/2) cylinder1 cylinder2 cutshape [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC1487, group);
-
-  theCommands.Add("OCC1077", "OCC1077 result", __FILE__, OCC1077, group);
-  theCommands.Add("OCC5739", "OCC5739 name shape step", __FILE__, OCC5739_UniAbs, group);
-  theCommands.Add("OCC6046", "OCC6046 nb_of_vectors size", __FILE__, OCC6046, group);
-  theCommands.Add("OCC5698", "OCC5698 wire", __FILE__, OCC5698, group);
-  theCommands.Add("OCC6143", "OCC6143", __FILE__, OCC6143, group);
-  theCommands.Add("OCC7141", "OCC7141 [nCount]", __FILE__, OCC7141, group);
-  theCommands.Add("OCC7372", "OCC7372", __FILE__, OCC7372, group);
-  theCommands.Add("OCC8169", "OCC8169 edge1 edge2 plane", __FILE__, OCC8169, group);
-  theCommands.Add("OCC10138", "OCC10138 lower upper", __FILE__, OCC10138, group);
-  theCommands.Add("OCC7639", "OCC7639 index1 value1 ... [indexN valueN]", __FILE__, OCC7639, group);
-  theCommands.Add("OCC8797", "OCC8797", __FILE__, OCC8797, group);
-  theCommands.Add("OCC7068", "OCC7068", __FILE__, OCC7068, group);
-  theCommands.Add("OCC11457", "OCC11457 polygon lastedge x1 y1 z1 x2 y2 z2 ...", __FILE__, OCC11457, group);
-  theCommands.Add("OCC13963", "OCC13963 ratio origin_x origin_y origin_z", __FILE__, OCC13963, group);
-  theCommands.Add("OCC14376", "OCC14376 shape [deflection]", __FILE__, OCC14376, group);
-  theCommands.Add("OCC15489", "OCC15489 A B C", __FILE__, OCC15489, group);
-  theCommands.Add("OCC15755", "OCC15755 file shape", __FILE__, OCC15755, group);
-  theCommands.Add("OCC16782", "OCC16782 file.std file.xml file.cbf", __FILE__, OCC16782, group);
-  theCommands.Add("OCC12584", "OCC12584 [mode = 0/1/2]", __FILE__, OCC12584, group);
-  theCommands.Add("OCC18612", "OCC18612 [file else already loaded model] [name DRAW]", __FILE__, OCC18612igesbrep, group);
-  theCommands.Add("OCC20766", "OCC20766 plane a b c d", __FILE__, OCC20766, group);
-  theCommands.Add("OCC20627", "OCC20627", __FILE__, OCC20627, group);
-  theCommands.Add("OCC17424", "OCC17424  shape X_Pnt Y_Pnt Z_Pnt X_Dir Y_Dir Z_Dir PInf", __FILE__, OCC17424, group);
-  theCommands.Add("OCC22301", "OCC22301", __FILE__, OCC22301, group);
-  theCommands.Add("OCC22586", "OCC22586 shape resshape", __FILE__, OCC22586, group);
-  theCommands.Add("OCC22736", "OCC22736 X_mirrorFirstPoint Y_mirrorFirstPoint X_mirrorSecondPoint Y_mirrorSecondPoint X_p1 Y_p1 X_p2 Y_p2", __FILE__, OCC22736, group);
-  theCommands.Add("OCC22744", "OCC22744", __FILE__, OCC22744, group);
-  theCommands.Add("bcarray", "bcarray", __FILE__, bcarray, group);
-  theCommands.Add("OCC22762", "OCC22762 x1 y1 z1 x2 y2 z3", __FILE__, OCC22762, group);
-  theCommands.Add("OCC22558", "OCC22558 x_vec y_vec z_vec x_dir y_dir z_dit x_pnt y_pnt z_pnt", __FILE__, OCC22558, group);
-  return;
-}
diff --git a/src/QAOCC/QAOCC_CMPLRS.edl b/src/QAOCC/QAOCC_CMPLRS.edl
deleted file mode 100755 (executable)
index fbc3972..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
--- Created on: 2002-04-25
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-@ifnotdefined ( %QAOCC_CMPLRS_EDL) then
-@set %QAOCC_CMPLRS_EDL = "";
-
-@uses "CSF.edl";
-@ifdefined( %CSF_TCL_INCLUDE ) then
-@string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE %CMPLRS_CXX_Options ;
-@endif;
-
-@endif;
diff --git a/src/QAQuickPen/QAQuickPen.cdl b/src/QAQuickPen/QAQuickPen.cdl
deleted file mode 100755 (executable)
index 4800308..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-10-24
--- Created by: Michael KUZMITCHEV
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAQuickPen
-     uses Draw
-is
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAQuickPen/QAQuickPen.cxx b/src/QAQuickPen/QAQuickPen.cxx
deleted file mode 100755 (executable)
index 72c96bf..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// Created on: 2002-10-24
-// Created by: Michael KUZMITCHEV
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAQuickPen.ixx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <gp_Pnt.hxx>
-#include <gp_Ax2.hxx>
-#include <gp.hxx>
-#include <gp_Ax1.hxx>
-#include <gce_MakeCirc.hxx>
-#include <gp_Circ.hxx>
-#include <GC_MakeArcOfCircle.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <TopoDS_Wire.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <BRepOffsetAPI_ThruSections.hxx>
-//=======================================================================
-//  OCC895
-//=======================================================================
-static Standard_Integer OCC895 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 2 || argc > 5)
-  {
-    di << "Usage : " << argv[0] << " result [angle [reverse [order]]]" << "\n";
-    return 1;
-  }
-
-  const Standard_Real rad = 1.0;
-  const Standard_Real angle = (argc > 2)? atof(argv[2]) : 0.0;
-  const Standard_Integer reverse = (argc > 3)? atoi(argv[3]) : 0;
-  const Standard_Integer order = (argc > 4)? atoi(argv[4]) : 0;
-
-  // Make a wire from the first arc for ThruSections.
-  //
-  // This arc is rotated 5 degrees about the Z axis.
-  // I don't know why, but if we don't rotate it,
-  // the final shell is not twisted.
-  gp_Pnt center1(0,10,0);
-  gp_Ax2 axis1 = reverse?
-    gp_Ax2(center1, gp::DY(), gp::DZ()) : gp_Ax2(center1, -gp::DY(), gp::DX());
-  if (Abs(angle) > gp::Resolution())
-    axis1.Rotate(gp_Ax1(center1, gp::DZ()), angle*M_PI/180.0);
-
-  gce_MakeCirc makeCirc1(axis1, rad);
-  if(!makeCirc1.IsDone()) return 1;
-  gp_Circ circ1 = makeCirc1.Value();
-  GC_MakeArcOfCircle makeArc1(circ1, 0, M_PI/2, Standard_True);
-  if(!makeArc1.IsDone()) return 1;
-  Handle_Geom_TrimmedCurve arc1 = makeArc1.Value();
-
-  // Create wire 1
-  BRepBuilderAPI_MakeEdge makeEdge1(arc1, arc1->StartPoint(), arc1->EndPoint());
-  if(!makeEdge1.IsDone()) return 1;
-  TopoDS_Edge edge1 = makeEdge1.Edge();
-  BRepBuilderAPI_MakeWire makeWire1;
-  makeWire1.Add(edge1);
-  if(!makeWire1.IsDone()) return 1;
-  TopoDS_Wire wire1 = makeWire1.Wire();
-
-  // Make a wire from the second arc for ThruSections.
-  gp_Pnt center2(10,0,0);
-  gp_Ax2 axis2(center2, -gp::DX(), gp::DZ());
-
-  gce_MakeCirc makeCirc2(axis2, rad);
-  if(!makeCirc2.IsDone()) return 1;
-  gp_Circ circ2 = makeCirc2.Value();
-  GC_MakeArcOfCircle makeArc2(circ2, 0, M_PI/2, Standard_True);
-  if(!makeArc2.IsDone()) return 1;
-  Handle_Geom_TrimmedCurve arc2 = makeArc2.Value();
-
-  // Create wire 2
-  BRepBuilderAPI_MakeEdge makeEdge2(arc2, arc2->StartPoint(), arc2->EndPoint());
-  if(!makeEdge2.IsDone()) return 1;
-  TopoDS_Edge edge2 = makeEdge2.Edge();
-  BRepBuilderAPI_MakeWire makeWire2;
-  makeWire2.Add(edge2);
-  if(!makeWire2.IsDone()) return 1;
-  TopoDS_Wire wire2 = makeWire2.Wire();
-
-  BRepOffsetAPI_ThruSections thruSect(Standard_False,Standard_True);
-  if (order)
-  {
-    thruSect.AddWire(wire1);
-    thruSect.AddWire(wire2);
-  }
-  else
-  {
-    thruSect.AddWire(wire2);
-    thruSect.AddWire(wire1);
-  }
-  thruSect.Build();
-  if(!thruSect.IsDone()) return 1;
-  TopoDS_Shape myShape = thruSect.Shape();
-
-  DBRep::Set(argv[1],myShape);
-
-  return 0;
-}
-
-void QAQuickPen::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAQuickPen";
-
-  theCommands.Add ("OCC895", "OCC895 result [angle [reverse [order]]]", __FILE__, OCC895, group);
-
-  return;
-}
diff --git a/src/QARicardo/FILES b/src/QARicardo/FILES
deleted file mode 100755 (executable)
index 4c86da4..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-QARicardo.cdl
-QARicardo.cxx
-QARicardo_CMPLRS.edl
diff --git a/src/QARicardo/QARicardo.cdl b/src/QARicardo/QARicardo.cdl
deleted file mode 100755 (executable)
index 7afbbb1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-05-16
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-
-package QARicardo
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QARicardo/QARicardo.cxx b/src/QARicardo/QARicardo.cxx
deleted file mode 100755 (executable)
index ec3aeb5..0000000
+++ /dev/null
@@ -1,1073 +0,0 @@
-// Created on: 2002-05-16
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QARicardo.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <tcl.h>
-
-#include <gp_Ax2.hxx>
-#include <gp_Circ.hxx>
-#include <gp_Pln.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepCheck_Analyzer.hxx>
-#include <BRepGProp.hxx>
-#include <BRepOffsetAPI_MakePipeShell.hxx>
-#include <GC_MakeArcOfCircle.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Plane.hxx>
-#include <Law_Linear.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopoDS_Face.hxx>
-#include <TopoDS_Solid.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS_Wire.hxx>
-#include <TopExp_Explorer.hxx>
-#include <GProp_GProps.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-//=======================================================================
-//function :  OCC332
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC332bug (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  // Used to Display Geometry or Topolgy
-  char name[255];
-  char *pname = name;
-  Standard_Boolean check = Standard_True;
-
-  // Set default arguments
-  double wall_thickness = 10.0;
-  double dia1 = 80.0;
-  double dia2 = 100.0;
-  double length = 400.0;
-  double major_radius = 280.0;
-
-  // Convert arguments
-  if (argc>1) wall_thickness = atof(argv[1]);
-  if (argc>2) dia1 = atof(argv[2]);
-  if (argc>3) dia2 = atof(argv[3]);
-  if (argc>4) major_radius = atof(argv[4]);
-  if (argc>5) length = atof(argv[5]);
-  double bend_angle = length/major_radius;
-
-  //if ((bend_angle >= M_PI)) {
-  if ((bend_angle >= M_PI)) {
-    di << "The arguments are invalid." << "\n";
-    return(TCL_ERROR);
-  }
-  di << "creating the shape for a bent tube" << "\n";
-
-  double radius_l = dia1/2.0;
-  double radius_r = dia2/2.0;
-
-  // SUPPORT:
-  // 1. There is no need to normalize the direction - it's done automatically
-  //gp_Ax2 origin(gp_Pnt(5000.0,-300.0, 1000.0),
-               //gp_Dir(0.0, -1.0/sqrt(2.0), -1.0/sqrt(2.0)));
-  gp_Ax2 origin(gp_Pnt(5000.0,-300.0,1000.0),gp_Dir(0.0,-1.0,-1.0));
-
-  TopoDS_Face myFace;
-  TopoDS_Shape myShape, gasSolid;
-  TopoDS_Solid wallSolid;
-
-  // Construct a circle for the first face, on the xy-plane at the origin
-  gp_Pln circ1Plane(origin.Location(), origin.Direction());
-  gp_Circ faceCircle(origin, radius_l);
-  gp_Circ outFaceCircle(origin, radius_l+wall_thickness);
-
-  // Construct center for a circle to be the spine of
-  // revolution, on the xz-plane at x=major_radius
-  gp_Pnt circ_center = origin.Location().Translated(major_radius*origin.XDirection());
-
-  // This point will be the center of the second face.
-  // SUPPORT:
-  // - There is no need in this point - we'll use angle instead.
-  //gp_Pnt endPoint = origin.Location();
-  //endPoint.Translate(major_radius*(1.0-cos(bend_angle))*origin.XDirection()) ;
-  //endPoint.Translate((-major_radius*sin(bend_angle))*origin.Direction());
-
-  // Construct the plane for the second face to sit on.
-  // SUPPORT:
-  // - It is better to use rotation instead of explicit calculations
-  //gp_Pln circ2Plane = gce_MakePln(circ_center, endPoint,
-  //                             endPoint.Translated(major_radius*origin.YDirection())
-  //                             ).Value();
-  gp_Ax1 circ_axis(circ_center,origin.YDirection());
-  gp_Pln circ2Plane = circ1Plane.Rotated(circ_axis,bend_angle);
-
-  // The circle used for the spine.
-  // SUPPORT:
-  // - Use direction (-X) instead of (X) to obtain correct right-handed system.
-  //   It is very important to maintain correct orientation between spine
-  //   and circles axes.
-  //gp_Ax2 spineAxis(circ_center, origin.YDirection(), origin.XDirection());
-  gp_Ax2 spineAxis(circ_center, origin.YDirection(), -origin.XDirection());
-  gp_Circ circle(spineAxis, major_radius);
-
-  // SUPPORT:
-  // - There is no need to create 2nd circles - they will be created by MakePipeShell.
-  //gp_Ax2 circ2axis(endPoint, circ2Plane.Axis().Direction(), origin.YDirection());
-  //gp_Circ faceCircle2(circ2axis,radius_r);
-  //gp_Circ outFaceCircle2(circ2axis,radius_r+wall_thickness);
-
-  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(faceCircle);
-  TopoDS_Wire Wire1_ = BRepBuilderAPI_MakeWire(E1).Wire();
-  
-  // Create the face at the near end for the wall solid, an annular ring.
-  TopoDS_Edge Eout1 = BRepBuilderAPI_MakeEdge(outFaceCircle);
-  TopoDS_Wire outerWire1_ = BRepBuilderAPI_MakeWire(Eout1).Wire();
-
-  // SUPPORT:
-  // - There is no need to create 2nd circles -
-  //   they will be created by MakePipeShell
-  //TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(faceCircle2);
-  //TopoDS_Wire Wire2_ = BRepBuilderAPI_MakeWire(E2).Wire();
-  
-  // Create the face at the far end for the wall solid, an annular ring.
-  // SUPPORT:
-  // - There is no need to create 2nd circles -
-  //   they will be created by MakePipeShell
-  //TopoDS_Edge Eout2 = BRepBuilderAPI_MakeEdge(outFaceCircle2);
-  //TopoDS_Wire outerWire2_ = BRepBuilderAPI_MakeWire(Eout2).Wire();
-
-  // SUPPORT:
-  // - It is better to use bend angle calculated above
-  //Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
-  //                                                endPoint,
-  //                                                origin.Location(),
-  //                                                Standard_True).Value();
-  Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
-                                                     0.0,
-                                                     bend_angle,
-                                                    Standard_True).Value();
-
-  // SUPPORT:
-  // - Use correct formula for scaling laws
-  Handle(Law_Linear) myLaw1 = new Law_Linear();
-  Handle(Law_Linear) myLaw2 = new Law_Linear();
-  //if ((radius_r - radius_l) < Precision::Confusion())
-  //{
-    //myLaw1->Set(SpineCurve->FirstParameter(), 1.0,
-               //SpineCurve->LastParameter(), 1.0);
-    //myLaw2->Set(SpineCurve->FirstParameter(), 1.0,
-               //SpineCurve->LastParameter(), 1.0);
-  //}
-  //else
-  //{
-    //myLaw1->Set(SpineCurve->FirstParameter(), radius_r/(radius_r-radius_l),
-               //SpineCurve->LastParameter(), 1.0);
-    //myLaw2->Set(SpineCurve->FirstParameter(), (radius_r+wall_thickness)/(radius_r-radius_l),
-               //SpineCurve->LastParameter(), 1.0);
-  //}
-  myLaw1->Set(SpineCurve->FirstParameter(),1.0,
-              SpineCurve->LastParameter(),radius_r/radius_l);
-  myLaw2->Set(SpineCurve->FirstParameter(),1.0,
-              SpineCurve->LastParameter(),(radius_r+wall_thickness)/(radius_l+wall_thickness));
-
-  BRepBuilderAPI_MakeFace mkFace;
-
-  BRepBuilderAPI_MakeEdge mkEdge;
-
-  mkEdge.Init(SpineCurve);
-  if (!mkEdge.IsDone()) return 0;
-  TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire();
-
-  sprintf (name,"SpineWire");
-  DBRep::Set(name,SpineWire);
-
-  sprintf (name,"Wire1_");
-  DBRep::Set(name,Wire1_);
-
-  sprintf (name,"outerWire1_");
-  DBRep::Set(name,outerWire1_);
-
-  // SUPPORT:
-  // - There is no need to create 2nd circles
-  //sprintf (name,"Wire2_");
-  //DBRep::Set(name,Wire2_);
-  //sprintf (name,"outerWire2_");
-  //DBRep::Set(name,outerWire2_);
-
-  di.Eval("fit");
-
-  // SUPPORT:
-  // - There is no need in these vertices
-  //TopoDS_Vertex Location1, Location2;
-  //TopExp::Vertices(SpineWire, Location1, Location2);
-
-  // Make inner pipe shell
-  BRepOffsetAPI_MakePipeShell mkPipe1(SpineWire);
-  mkPipe1.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
-  //mkPipe1.SetTransitionMode(BRepBuilderAPI_Transformed); // Default mode !!
-  mkPipe1.SetLaw(Wire1_, myLaw1/*, Location2*/, Standard_False, Standard_False);
-  mkPipe1.Build();
-  if (!mkPipe1.IsDone()) return 0;
-
-  // Make outer pipe shell
-  BRepOffsetAPI_MakePipeShell mkPipe2(SpineWire);
-  mkPipe2.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
-  //mkPipe2.SetTransitionMode(BRepBuilderAPI_Transformed); // Default mode !!
-  mkPipe2.SetLaw(outerWire1_, myLaw2/*, Location2*/, Standard_False, Standard_False);
-  mkPipe2.Build();
-  if (!mkPipe2.IsDone()) return 0;
-
-  // Make face for first opening
-  Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
-  mkFace.Init(Plane1,Standard_False,Precision::Confusion());
-  // SUPPORT:
-  // - Use wires created by MakePipeShell
-  //mkFace.Add(TopoDS::Wire(outerWire1_));
-  //mkFace.Add(TopoDS::Wire(Wire1_.Reversed()));
-  mkFace.Add(TopoDS::Wire(mkPipe2.FirstShape()));
-  mkFace.Add(TopoDS::Wire(mkPipe1.FirstShape().Reversed()));
-  if (!mkFace.IsDone()) return 0;
-  TopoDS_Face Face1 = mkFace.Face();
-
-  // Make face for second opening
-  Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
-  mkFace.Init(Plane2,Standard_False,Precision::Confusion());
-  // SUPPORT:
-  // - Use wires created by MakePipeShell
-  //mkFace.Add(TopoDS::Wire(outerWire2_));
-  //mkFace.Add(TopoDS::Wire(Wire2_.Reversed()));
-  mkFace.Add(TopoDS::Wire(mkPipe2.LastShape()));
-  mkFace.Add(TopoDS::Wire(mkPipe1.LastShape().Reversed()));
-  if (!mkFace.IsDone()) return 0;
-  TopoDS_Face Face2 = mkFace.Face();
-
-  // Make tube
-  TopoDS_Shell TubeShell;
-  BRep_Builder B;
-  B.MakeShell(TubeShell);
-  TopExp_Explorer getFaces;
-  TopoDS_Face test_face;
-  getFaces.Init(mkPipe1.Shape(), TopAbs_FACE);
-  // SUPPORT:
-  // - In our case there should be only 1 pipe face
-  //while (getFaces.More())
-  //  {
-  //    test_face = TopoDS::Face(getFaces.Current());
-  //    Handle(Geom_Surface) S = BRep_Tool::Surface(test_face); 
-  //    GeomLib_IsPlanarSurface IsPl(S);
-  //    if (!IsPl.IsPlanar()) {
-  //   B.Add(TubeShell,getFaces.Current().Reversed());
-  //    }
-  //    getFaces.Next();
-  //  }
-  if (getFaces.More())
-    B.Add(TubeShell,getFaces.Current().Reversed());
-
-  // Grab the gas solid now that we've extracted the faces.
-  mkPipe1.MakeSolid();
-  gasSolid = mkPipe1.Shape();
-
-  sprintf (name,"gasSolid_");
-  DBRep::Set(name,gasSolid);
-
-  //getFaces.Clear();
-  getFaces.Init(mkPipe2.Shape(), TopAbs_FACE);
-  // SUPPORT:
-  // - In our case there should be only 1 pipe face
-  //while (getFaces.More())
-  //  {
-  //    B.Add(TubeShell,getFaces.Current());
-  //    getFaces.Next();
-  //  }
-  if (getFaces.More())
-    B.Add(TubeShell,getFaces.Current());
-
-  B.Add(TubeShell,Face1.Reversed());
-  B.Add(TubeShell,Face2);
-
-  B.MakeSolid(wallSolid);
-  B.Add(wallSolid,TubeShell);
-
-  sprintf (name,"wallSolid_");
-  DBRep::Set(name,wallSolid);
-
-  // Now calculated the volume of the outside tube.
-  GProp_GProps gprops;
-  BRepGProp::VolumeProperties(wallSolid, gprops);
-  di << "The wallSolid's volume is: " << gprops.Mass() << "\n";
-
-  if (check) {
-    if (!(BRepCheck_Analyzer(wallSolid).IsValid()))
-      di << "The TopoDS_Solid was checked, and it was invalid!" << "\n";
-    else
-      di << "The TopoDS_Solid was checked, and it was valid." << "\n";
-    if (!wallSolid.Closed())
-      di << "The TopoDS_Solid is not closed!" << "\n";
-    else
-      di << "The TopoDS_Solid is closed." << "\n";
-    if (!wallSolid.Checked())
-      di << "The TopoDS_Solid is not checked!" << "\n";
-    else
-      di << "The TopoDS_Solid has been checked." << "\n";
-    if (wallSolid.Infinite())
-      di << "The TopoDS_Solid is infinite!" << "\n";
-    else
-      di << "The TopoDS_Solid is finite." << "\n";
-  }
-
-  di << "The result is a ";
-  // Check to see if we have a solid
-  switch (wallSolid.ShapeType()) {
-  case (TopAbs_COMPOUND):
-    di << "TopAbs_COMPOUND" << "\n";
-    break;
-  case (TopAbs_COMPSOLID):
-    di << "TopAbs_COMPSOLID" << "\n";
-    break;
-  case (TopAbs_SOLID):
-    di << "TopAbs_SOLID" << "\n";
-    break;
-  case (TopAbs_SHELL):
-    di << "TopAbs_SHELL" << "\n";
-    break;
-  case (TopAbs_FACE):
-    di << "TopAbs_FACE" << "\n";
-    break;
-  case (TopAbs_WIRE):
-    di << "TopAbs_WIRE" << "\n";
-    break;
-  case (TopAbs_EDGE):
-    di << "TopAbs_EDGE" << "\n";
-    break;
-  case (TopAbs_VERTEX):
-    di << "TopAbs_VERTEX" << "\n";
-    break;
-  case (TopAbs_SHAPE):
-    di << "TopAbs_SHAPE" << "\n";
-  }
-  di << "Can we turn it into a solid? ";
-  try {
-    OCC_CATCH_SIGNALS
-    di << " yes" << "\n";
-  }
-  catch (Standard_TypeMismatch) {
-    di << " no" << "\n";
-  }
-
-  getFaces.Clear();
-  getFaces.Init(wallSolid, TopAbs_FACE);
-  int i =0;
-  while (getFaces.More())
-    {
-      i++;
-      sprintf(name,"Face%d",i);
-      di << "Face named " << name << "\n";
-      DBRep::Set(name,getFaces.Current());
-      getFaces.Next();
-    }
-
-  return 0;
-}
-
-#include <gce_MakePln.hxx>
-#include <TopExp.hxx>
-#include <BRepOffsetAPI_Sewing.hxx>
-#include <BRepAlgoAPI_Fuse.hxx>
-///////#else
-///////#include <BRepAlgo_Fuse.hxx>
-///////#include <BRepAlgoAPI_Fuse.hxx>
-#include <BRepAlgo_Fuse.hxx>
-
-//=======================================================================
-//function :  OCC544
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC544 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  if(argc > 7) {
-    di << "Usage : " << argv[0] << " [[[[[wT [[[[d1 [[[d2 [[R [length [BRepAlgoAPI/BRepAlgo = 1/0]]]]]]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 7) {
-    Standard_Integer IsB = atoi(argv[6]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def01)
-//      di << "Error: There is not BRepAlgo_Fuse class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-
-  // Used to Display Geometry or Topolgy
-  char name[255];
-  char *pname = name;
-  //bool check = true;
-  Standard_Boolean check = Standard_True;
-
-  // Set default arguments
-  double radius_l = 20.0;
-  double radius_r = 80.0;
-  // mkv 15.07.03 double bend_angle = M_PI/2.0;
-  double bend_angle = M_PI/2.0;
-
-  double major_rad = 280.0;
-  double wall_thickness = 10.0;
-                   
-
-  // Convert arguments
-  if (argc>1) radius_l = atof(argv[1]);
-  if (argc>2) radius_r = atof(argv[2]);
-  if (argc>3) bend_angle = atof(argv[3]);
-  if (argc>4) major_rad = atof(argv[4]);
-  if (argc>5) wall_thickness = atof(argv[5]);
-
-  // mkv 15.07.03 if ((bend_angle >= 2.0*M_PI)) {
-  if ((bend_angle >= 2.0*M_PI)) {
-    di << "The arguments are invalid." << "\n";
-    return(TCL_ERROR);
-  }
-  di << "creating the shape for a bent tube" << "\n";
-  gp_Ax2 origin(gp_Pnt(500.0,-300.0, 100.0),
-               gp_Dir(0.0, -1.0/sqrt(2.0), -1.0/sqrt(2.0)));
-
-  TopoDS_Face firstFace, lastFace;
-  TopoDS_Solid wallSolid, myShape;
-  // Construct a circle for the first face, on the xy-plane at the origin
-  gp_Pln circ1Plane(origin.Location(), origin.Direction());
-  gp_Circ faceCircle(origin, radius_l);
-  gp_Circ outFaceCircle(origin, radius_l+wall_thickness);
-
-  // Construct center for a circle to be the spine of
-  // revolution, on the xz-plane at x=major_rad
-  gp_Pnt circ_center = origin.Location().Translated(
-                                                   major_rad*origin.XDirection()
-                                                   );
-
-  // This point will be the center of the second face.
-  gp_Pnt endPoint = origin.Location();
-  endPoint.Translate(major_rad*(1.0-cos(bend_angle))*origin.XDirection()) ;
-  endPoint.Translate((-major_rad*sin(bend_angle))*origin.Direction());
-
-  // Construct the plane for the second face to sit on.
-  gp_Pln circ2Plane = gce_MakePln(circ_center, endPoint,
-                                 endPoint.Translated(major_rad*origin.YDirection())
-                                 ).Value();
-
-  // The circle used for the spine.
-  gp_Ax2 spineAxis(circ_center, origin.YDirection(), origin.XDirection());
-  gp_Circ circle(spineAxis, major_rad);
-
-  gp_Ax2 circ2axis(endPoint, circ2Plane.Axis().Direction(), origin.YDirection());
-  gp_Circ faceCircle2(circ2axis,radius_r);
-  gp_Circ outFaceCircle2(circ2axis,radius_r+wall_thickness);
-
-  TopoDS_Edge E1_1 = BRepBuilderAPI_MakeEdge(faceCircle, 0, M_PI);
-  TopoDS_Edge E1_2 = BRepBuilderAPI_MakeEdge(faceCircle, M_PI, 2.*M_PI);
-  TopoDS_Wire Wire1_ = BRepBuilderAPI_MakeWire(E1_1, E1_2);
-  
-  // Create the face at the near end for the wall solid, an annular ring.
-  TopoDS_Edge Eout1_1 = BRepBuilderAPI_MakeEdge(outFaceCircle, 0, M_PI);
-  TopoDS_Edge Eout1_2 = BRepBuilderAPI_MakeEdge(outFaceCircle, M_PI, 2.*M_PI);
-  TopoDS_Wire outerWire1_ = BRepBuilderAPI_MakeWire(Eout1_1, Eout1_2);
-  TopoDS_Edge E2_1 = BRepBuilderAPI_MakeEdge(faceCircle2, 0, M_PI);
-  TopoDS_Edge E2_2 = BRepBuilderAPI_MakeEdge(faceCircle2, M_PI, 2.*M_PI);
-  TopoDS_Wire Wire2_ = BRepBuilderAPI_MakeWire(E2_1, E2_2);
-  
-  // Create the face at the far end for the wall solid, an annular ring.
-  TopoDS_Edge Eout2_1 = BRepBuilderAPI_MakeEdge(outFaceCircle2, 0, M_PI);
-  TopoDS_Edge Eout2_2 = BRepBuilderAPI_MakeEdge(outFaceCircle2, M_PI, 2.*M_PI);
-  TopoDS_Wire outerWire2_ = BRepBuilderAPI_MakeWire(Eout2_1, Eout2_2);
-
-  BRepBuilderAPI_MakeFace mkFace;
-
-  Handle(Geom_Curve) SpineCurve = GC_MakeArcOfCircle(circle,
-                                                    endPoint,
-                                                    origin.Location(),
-                                                    Standard_True).Value();
-  Handle(Law_Linear) myLaw = new Law_Linear();
-  Handle(Law_Linear) myLaw2 = new Law_Linear();
-
-  myLaw->Set(SpineCurve->FirstParameter(),
-            radius_r/radius_l,
-            SpineCurve->LastParameter(),
-            1.0);
-
-  myLaw2->Set(SpineCurve->FirstParameter(),
-             (radius_r+wall_thickness)/(radius_l+wall_thickness),
-             SpineCurve->LastParameter(),
-             1.0);
-
-  di << "SpineCurve->FirstParameter() is " << SpineCurve->FirstParameter() << "\n";
-  di << "SpineCurve->LastParameter() is " << SpineCurve->LastParameter() << "\n";
-  di << "Law1 Value at FirstParameter() is " << myLaw->Value(SpineCurve->FirstParameter()) << "\n";
-  di << "Law1 Value at LastParameter() is " << myLaw->Value(SpineCurve->LastParameter()) << "\n";
-  di << "radius_r / radius_l is " << radius_r/radius_l << "\n";
-
-  BRepBuilderAPI_MakeEdge mkEdge;
-
-  mkEdge.Init(SpineCurve);
-  if (!mkEdge.IsDone()) return TCL_ERROR;
-  TopoDS_Wire SpineWire = BRepBuilderAPI_MakeWire(mkEdge.Edge()).Wire();
-
-  sprintf (name,"SpineWire");
-  DBRep::Set(name,SpineWire);
-
-  sprintf (name,"Wire1_");
-  DBRep::Set(name,Wire1_);
-
-  sprintf (name,"outerWire1_");
-  DBRep::Set(name,outerWire1_);
-
-  sprintf (name,"Wire2_");
-  DBRep::Set(name,Wire2_);
-
-  sprintf (name,"outerWire2_");
-  DBRep::Set(name,outerWire2_);
-
-  di.Eval("fit");
-
-  TopoDS_Vertex Location1, Location2;
-
-  TopExp::Vertices(SpineWire, Location2, Location1);
-
-  sprintf (name,"Location1");
-  DBRep::Set(name,Location1);
-
-  sprintf (name,"Location2");
-  DBRep::Set(name,Location2);
-
-  // Make inner pipe shell
-  BRepOffsetAPI_MakePipeShell mkPipe1(SpineWire);
-  mkPipe1.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
-  mkPipe1.SetTransitionMode(BRepBuilderAPI_Transformed);
-  mkPipe1.SetMode(Standard_False);
-  mkPipe1.SetLaw(Wire1_, myLaw, Location1, Standard_False, Standard_False);
-  mkPipe1.Build();
-  if (!mkPipe1.IsDone()) return TCL_ERROR;
-
-  // Make outer pipe shell
-  BRepOffsetAPI_MakePipeShell mkPipe2(SpineWire);
-  mkPipe2.SetTolerance(1.0e-8,1.0e-8,1.0e-6);
-  mkPipe2.SetTransitionMode(BRepBuilderAPI_Transformed);
-  mkPipe2.SetMode(Standard_False);
-  mkPipe2.SetLaw(outerWire1_, myLaw2, Location1, Standard_False, Standard_False);
- mkPipe2.Build();
-  if (!mkPipe2.IsDone()) return TCL_ERROR;
-
-//    sprintf(name,"w1-first");
-//    DBRep::Set(name,mkPipe1.FirstShape());
-
-//    sprintf(name,"w1-last");
-//    DBRep::Set(name,mkPipe1.LastShape());
-
-//    sprintf(name,"w2-first");
-//    DBRep::Set(name,mkPipe2.FirstShape());
-
-//    sprintf(name,"w2-last");
-//    DBRep::Set(name,mkPipe2.LastShape());
-
-  BRepOffsetAPI_Sewing SewIt(1.0e-4);
-
-  // Make tube
-  TopExp_Explorer getFaces;
-  TopoDS_Face test_face;
-  getFaces.Init(mkPipe1.Shape(), TopAbs_FACE);
-  while (getFaces.More())
-    {
-      SewIt.Add(getFaces.Current().Reversed());
-      getFaces.Next();
-    }
-
-  // Make face for first opening
-  Handle(Geom_Plane) Plane1 = new Geom_Plane(circ1Plane);
-  mkFace.Init(Plane1,Standard_False,Precision::Confusion());
-  mkFace.Add(TopoDS::Wire(outerWire1_));
-  mkFace.Add(TopoDS::Wire(Wire1_.Reversed()));
-  if (!mkFace.IsDone()) return TCL_ERROR;
-  TopoDS_Face Face1 = mkFace.Face();
-
-  // Make face for second opening
-  Handle(Geom_Plane) Plane2 = new Geom_Plane(circ2Plane);
-  mkFace.Init(Plane2,Standard_False,Precision::Confusion());
-  mkFace.Add(TopoDS::Wire(outerWire2_));
-  mkFace.Add(TopoDS::Wire(Wire2_.Reversed()));
-  if (!mkFace.IsDone()) return TCL_ERROR;
-  TopoDS_Face Face2 = mkFace.Face();
-
-  // Grab the gas solid now that we've extracted the faces.
-  mkPipe1.MakeSolid();
-  myShape = TopoDS::Solid(mkPipe1.Shape());
-
-  getFaces.Clear();
-  getFaces.Init(mkPipe2.Shape(), TopAbs_FACE);
-  while (getFaces.More())
-    {
-      SewIt.Add(getFaces.Current());
-      getFaces.Next();
-    }
-
-  SewIt.Add(Face1.Reversed());
-  SewIt.Add(Face2);
-
-  SewIt.Perform();
-
-  di << "The result of the Sewing operation is a ";
-  // Check to see if we have a solid
-  switch (SewIt.SewedShape().ShapeType()) {
-  case (TopAbs_COMPOUND):
-    di << "TopAbs_COMPOUND" << "\n";
-    break;
-  case (TopAbs_COMPSOLID):
-    di << "TopAbs_COMPSOLID" << "\n";
-    break;
-  case (TopAbs_SOLID):
-    di << "TopAbs_SOLID" << "\n";
-    break;
-  case (TopAbs_SHELL):
-    di << "TopAbs_SHELL" << "\n";
-    break;
-  case (TopAbs_FACE):
-    di << "TopAbs_FACE" << "\n";
-    break;
-  case (TopAbs_WIRE):
-    di << "TopAbs_WIRE" << "\n";
-    break;
-  case (TopAbs_EDGE):
-    di << "TopAbs_EDGE" << "\n";
-    break;
-  case (TopAbs_VERTEX):
-    di << "TopAbs_VERTEX" << "\n";
-    break;
-  case (TopAbs_SHAPE):
-    di << "TopAbs_SHAPE" << "\n";
-  }
-
-  BRep_Builder B;
-
-  TopoDS_Shell TubeShell;
-  di << "Can we turn it into a shell? ";
-  try {
-    OCC_CATCH_SIGNALS
-    TubeShell = TopoDS::Shell(SewIt.SewedShape());
-    B.MakeSolid(wallSolid);
-    B.Add(wallSolid,TubeShell);
-    di << " yes" << "\n";
-  }
-  catch (Standard_TypeMismatch) {
-    di << "Can't convert to shell..." << "\n";
-    TopExp_Explorer getSol;
-    getSol.Init(SewIt.SewedShape(), TopAbs_SOLID);
-    if (getSol.More()) {
-      di << "First solid found in compound" << "\n";
-      wallSolid = TopoDS::Solid(getSol.Current());
-      TopoDS_Solid test_solid;
-      while (getSol.More())
-       {
-         di << "Next solid found in compound" << "\n";
-         getSol.Next();
-         test_solid = TopoDS::Solid(getSol.Current());
-//////#if ! defined(BRepAlgoAPI_def01)
-//////   BRepAlgoAPI_Fuse fuser(test_solid, wallSolid);
-//////#else
-//////   BRepAlgo_Fuse fuser(test_solid, wallSolid);
-//////#endif
-//////   fuser.Build();
-         if (IsBRepAlgoAPI) {
-           di << "BRepAlgoAPI_Fuse fuser(test_solid, wallSolid)" <<"\n";
-           BRepAlgoAPI_Fuse fuser(test_solid, wallSolid);
-           fuser.Build();
-           wallSolid = TopoDS::Solid(fuser.Shape());
-         } else {
-           di << "BRepAlgo_Fuse fuser(test_solid, wallSolid)" <<"\n";
-           BRepAlgo_Fuse fuser(test_solid, wallSolid);
-           fuser.Build();
-           wallSolid = TopoDS::Solid(fuser.Shape());
-         }
-//////   wallSolid = TopoDS::Solid(fuser.Shape());
-       }
-    } else {
-      // Let's see if we can extract shells instead of solids.
-      TopExp_Explorer getShel;
-      getShel.Init(SewIt.SewedShape(), TopAbs_SHELL);
-      if (getShel.More()) {
-       di << "First shell found in compound" << "\n";
-       B.MakeSolid(wallSolid);
-       di << "B.Add(wallSolid,TopoDS::Shell(getShel.Current()));" << "\n";
-       int i = 1;
-       while (getShel.More())
-         {
-           di << "Next shell found in compound" << "\n";
-           di << "B.Add(wallSolid,TopoDS::Shell(getShel.Current()));" << "\n";
-           sprintf(name,"shell%d", i++);
-           DBRep::Set(name,getShel.Current());
-           B.Add(wallSolid,TopoDS::Shell(getShel.Current()));
-           getShel.Next();
-         }
-      }
-    }
-  }
-
-  sprintf(name,"result");
-  DBRep::Set(name,wallSolid);
-
-  // Now calculated the volume of the outside tube.
-  GProp_GProps gprops;
-  BRepGProp::VolumeProperties(wallSolid, gprops);
-  di << "The wallSolid's volume is: " << gprops.Mass() << "\n";
-
-  if (check) {
-    if (!(BRepCheck_Analyzer(wallSolid).IsValid()))
-      di << "The TopoDS_Solid was checked, and it was invalid!" << "\n";
-    else
-      di << "The TopoDS_Solid was checked, and it was valid." << "\n";
-    if (!wallSolid.Closed())
-      di << "The TopoDS_Solid is not closed!" << "\n";
-    else
-      di << "The TopoDS_Solid is closed." << "\n";
-    if (!wallSolid.Checked())
-      di << "The TopoDS_Solid is not checked!" << "\n";
-    else
-      di << "The TopoDS_Solid has been checked." << "\n";
-    if (wallSolid.Infinite())
-      di << "The TopoDS_Solid is infinite!" << "\n";
-    else
-      di << "The TopoDS_Solid is finite." << "\n";
-  }
-
-  di << "The result is a ";
-  // Check to see if we have a solid
-  switch (wallSolid.ShapeType()) {
-  case (TopAbs_COMPOUND):
-    di << "TopAbs_COMPOUND" << "\n";
-    break;
-  case (TopAbs_COMPSOLID):
-    di << "TopAbs_COMPSOLID" << "\n";
-    break;
-  case (TopAbs_SOLID):
-    di << "TopAbs_SOLID" << "\n";
-    break;
-  case (TopAbs_SHELL):
-    di << "TopAbs_SHELL" << "\n";
-    break;
-  case (TopAbs_FACE):
-    di << "TopAbs_FACE" << "\n";
-    break;
-  case (TopAbs_WIRE):
-    di << "TopAbs_WIRE" << "\n";
-    break;
-  case (TopAbs_EDGE):
-    di << "TopAbs_EDGE" << "\n";
-    break;
-  case (TopAbs_VERTEX):
-    di << "TopAbs_VERTEX" << "\n";
-    break;
-  case (TopAbs_SHAPE):
-    di << "TopAbs_SHAPE" << "\n";
-  }
-
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <BRepBndLib.hxx>
-#include <TopTools_Array1OfShape.hxx>
-#include <TColStd_Array1OfReal.hxx>
-#include <BRepBuilderAPI_Copy.hxx>
-#include <BRepAlgoAPI_Cut.hxx>
-#include <BRepAlgoAPI_Common.hxx>
-//////////#else
-//////////#include <BRepAlgo_Cut.hxx>
-//////////#include <BRepAlgo_Common.hxx>
-//////////#include <BRepAlgoAPI_Cut.hxx>
-//////////#include <BRepAlgoAPI_Common.hxx>
-#include <BRepAlgo_Cut.hxx>
-#include <BRepAlgo_Common.hxx>
-#include <Precision.hxx>
-
-static Standard_Integer OCC817 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-  //////////if(argc != 3) {
-  //////////  cout << "Usage : " << argv[0] << " result mesh_delta" << endl;
-  //////////  return 1;        
-  //////////}
-  if(argc < 3 || argc > 4) {
-    di << "Usage : " << argv[0] << " result mesh_delta [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 4) {
-    Standard_Integer IsB = atoi(argv[3]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def02)
-//      di << "Error: There is not BRepAlgo_Cut class" << "\n";
-//      return 1;
-#endif
-#if ! defined(BRepAlgo_def03)
-//      di << "Error: There is not BRepAlgo_Common class" << "\n";
-//      return 1;
-#endif
-    }
-  }
-  
-  Standard_Real delt = 5.0*Precision::Confusion();
-  Standard_Real mesh_delt = atof(argv[2]);
-  if (mesh_delt <= 0.0)
-  {
-    di<<"Error: mesh_delta must be positive value"<<"\n";
-    return -1;
-  }
-
-  // Create outer box solid
-  gp_Pnt P(0,0,0);
-  TopoDS_Solid fullSolid = BRepPrimAPI_MakeBox(P, 30.0, 30.0, 30.0).Solid();
-
-  // Create inner box solid
-  P.SetX(10); P.SetY(10); P.SetZ(10);
-  TopoDS_Solid internalSolid = BRepPrimAPI_MakeBox(P, 10.0, 10.0, 10.0).Solid();
-
-  // Cut inner from outer
-//////////#if ! defined(BRepAlgoAPI_def01)
-//////////  BRepAlgoAPI_Cut cut( fullSolid, internalSolid );
-//////////#else
-//////////  BRepAlgo_Cut cut( fullSolid, internalSolid );
-//////////#endif
-//////////  TopoDS_Shape cut_shape = cut.Shape();
-//////////  if ( !cut.IsDone() )
-//////////  {
-//////////    cout << "Error: Could not cut volumes" << endl;
-//////////    return -1;
-//////////  }
-
-  TopoDS_Shape cut_shape;
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Cut cut( fullSolid, internalSolid )" <<"\n";
-    BRepAlgoAPI_Cut cut( fullSolid, internalSolid );
-    cut_shape = cut.Shape();
-    if ( !cut.IsDone() )
-      {
-       di << "Error: Could not cut volumes" << "\n";
-       return -1;
-      }
-  } else {
-    di << "BRepAlgo_Cut cut( fullSolid, internalSolid )" <<"\n";
-    BRepAlgo_Cut cut( fullSolid, internalSolid );
-    cut_shape = cut.Shape();
-    if ( !cut.IsDone() )
-      {
-       di << "Error: Could not cut volumes" << "\n";
-       return -1;
-      }
-  }
-
-  // see if we have a solid
-  Standard_Integer found_solid = 0;
-  TopoDS_Solid cutSolid;
-  TopExp_Explorer Ex;
-  for (Ex.Init(cut_shape, TopAbs_SOLID); Ex.More(); Ex.Next())
-  {
-    TopoDS_Solid sol = TopoDS::Solid(Ex.Current());
-    if (!sol.IsNull()) { cutSolid = sol; found_solid++; }
-  }
-  if ( found_solid != 1 )
-  {
-    di << "Error: Cut operation produced " << found_solid << " solids" << "\n";
-    return -1;
-  }
-  DBRep::Set(argv[1],cutSolid);
-
-  // Calculate initial volume
-  GProp_GProps volumeVProps;
-  BRepGProp::VolumeProperties (cutSolid, volumeVProps);
-  di << "Info: Original volume  = " << volumeVProps.Mass() << "\n";
-
-  //
-  // build bounding box and calculate bounds for initial mesh
-  //
-  Bnd_Box bndBox;
-  BRepBndLib::Add( cutSolid, bndBox );
-  Standard_Real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax;
-  bndBox.Get( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
-  Xmin -= delt;
-  Ymin -= delt;
-  Zmin -= delt;
-  Xmax += delt;
-  Ymax += delt;
-  Zmax += delt;
-  di<<"Info: Bounds\n  ("<<Xmin<<","<<Ymin<<","<<Zmin<<")\n  ("<<Xmax<<","<<Ymax<<","<<Zmax<<")"<<"\n";
-
-  // grid the bounding box
-  Standard_Integer NumXsubvolumes = (Xmax - Xmin) / mesh_delt; if (NumXsubvolumes <= 0) NumXsubvolumes = 1;
-  Standard_Integer NumYsubvolumes = (Ymax - Ymin) / mesh_delt; if (NumYsubvolumes <= 0) NumYsubvolumes = 1;
-  Standard_Integer NumZsubvolumes = (Zmax - Zmin) / mesh_delt; if (NumZsubvolumes <= 0) NumZsubvolumes = 1;
-  const Standard_Real StepX = (Xmax - Xmin) / NumXsubvolumes;
-  const Standard_Real StepY = (Ymax - Ymin) / NumYsubvolumes;
-  const Standard_Real StepZ = (Zmax - Zmin) / NumZsubvolumes;
-  const Standard_Integer NumSubvolumes = NumXsubvolumes * NumYsubvolumes * NumZsubvolumes;
-  di << "Info: NumSubvolumesX = " << NumXsubvolumes << "\n";
-  di << "Info: NumSubvolumesY = " << NumYsubvolumes << "\n";
-  di << "Info: NumSubvolumesZ = " << NumZsubvolumes << "\n";
-  di << "Info: NumSubvolumes = " << NumSubvolumes << "\n";
-
-  //
-  // construct initial mesh of cutSolid
-  //
-  TopTools_Array1OfShape SubvolumeSolid(0,NumSubvolumes-1);
-  TColStd_Array1OfReal SubvolumeVol(0,NumSubvolumes-1);
-  Standard_Real accumulatedVolume = 0.0;
-  Standard_Integer i, j, k, l = 0;
-  Standard_Real x = Xmin;
-  for ( i = 0; i < NumXsubvolumes; i++ )
-  {
-    Standard_Real y = Ymin;
-    for ( j = 0; j < NumYsubvolumes; j++ )
-    {
-      Standard_Real z = Zmin;
-      for ( k = 0; k < NumZsubvolumes; k++ )
-      {
-       P.SetX(x);
-       P.SetY(y);
-       P.SetZ(z);
-       TopoDS_Shape aSubvolume = BRepPrimAPI_MakeBox(P, StepX, StepY, StepZ).Solid();
-        di<<"Info: box b_"<<l<<" "<<P.X()<<" "<<P.Y()<<" "<<P.Z()<<" "<<StepX<<" "<<StepY<<" "<<StepZ<<"\n";
-       if ( aSubvolume.IsNull())
-        {
-         di << "Error: could not construct subvolume " << l << "\n";
-         return 1;
-       }
-       SubvolumeSolid.SetValue(l,aSubvolume);
-       GProp_GProps subvolumeVProps;
-       BRepGProp::VolumeProperties (SubvolumeSolid(l), subvolumeVProps);
-        const Standard_Real vol = subvolumeVProps.Mass();
-       di << "Info: original subvolume " << l << " volume = " << vol << "\n";
-        SubvolumeVol.SetValue(l,vol);
-        accumulatedVolume += vol;
-       l++;
-       z += StepZ;
-      }
-      y += StepY;
-    }
-    x += StepX;
-  }
-  di << "Info: Accumulated mesh volume = " << accumulatedVolume << "\n";
-
-  //  
-  // trim mesh to cutSolid
-  //
-  accumulatedVolume = 0.0;
-  for ( l = 0; l < NumSubvolumes; l++ )
-  {
-    TopoDS_Shape copySolid = BRepBuilderAPI_Copy(cutSolid).Shape();
-
-    // perform common
-//////////#if ! defined(BRepAlgoAPI_def01)
-//////////    BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
-//////////#else
-//////////    BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
-//////////#endif
-//////////    if (!common.IsDone())
-//////////    {
-//////////      cout << "Error: could not construct a common solid " << l << endl;
-//////////      return 1;
-//////////    }
-
-    TopoDS_Shape aCommonShape;
-    if (IsBRepAlgoAPI) {
-      di << "BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l))" <<"\n";
-      BRepAlgoAPI_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
-      if (!common.IsDone())
-       {
-         di << "Error: could not construct a common solid " << l << "\n";
-         return 1;
-       }
-      aCommonShape = common.Shape();
-    } else {
-      di << "BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l))" <<"\n";
-      BRepAlgo_Common common(copySolid/*cutSolid*/, SubvolumeSolid(l));
-      if (!common.IsDone())
-       {
-         di << "Error: could not construct a common solid " << l << "\n";
-         return 1;
-       }
-      aCommonShape = common.Shape();
-    }
-
-    // see if we have a solid
-    found_solid = 0;
-    TopoDS_Shape commonShape;
-    //////////for (Ex.Init(common.Shape(), TopAbs_SOLID); Ex.More(); Ex.Next())
-    for (Ex.Init(aCommonShape, TopAbs_SOLID); Ex.More(); Ex.Next())
-    {
-      TopoDS_Solid sol = TopoDS::Solid(Ex.Current());
-      if (!sol.IsNull()) { commonShape = sol; found_solid++; }
-    }
-    if ( found_solid != 1 )
-    {
-      di << "Info: Common operation " << l << " produced " << found_solid << " solids" << "\n";
-    }
-    else
-    {
-      SubvolumeSolid.SetValue(l,commonShape);
-      GProp_GProps subvolumeVProps;
-      BRepGProp::VolumeProperties (SubvolumeSolid(l), subvolumeVProps);
-      const Standard_Real vol = subvolumeVProps.Mass();
-      const Standard_Boolean err = (vol > SubvolumeVol(l)) || (vol <= 0.0);
-      //cout << (err? "ERROR" : "Info") << ": final subvolume " << l << " volume = " << vol << endl;
-      if (err)
-       di << "ERROR" << ": final subvolume " << l << " volume = " << vol << "\n";
-      else
-       di << "Info" << ": final subvolume " << l << " volume = " << vol << "\n";
-      accumulatedVolume += vol;
-      if (err)
-      {
-        char astr[80];
-        sprintf(astr,"e_%d",l);
-        DBRep::Set(astr,commonShape);
-      }
-    }
-  }
-  di << "Info: Accumulated meshed volume = " << accumulatedVolume << "\n";
-
-  return 0;    
-}
-
-void QARicardo::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QARicardo";
-
-  theCommands.Add ("OCC332", "OCC332 [wall_thickness [dia1 [dia2 [length [major_radius]]]]]", __FILE__, OCC332bug, group);
-  //////theCommands.Add("OCC544", "OCC544 [[[[[wT [[[[d1 [[[d2 [[R [length]]]]]", __FILE__, OCC544, group);
-  theCommands.Add("OCC544", "OCC544 [[[[[wT [[[[d1 [[[d2 [[R [length [BRepAlgoAPI/BRepAlgo = 1/0]]]]]]", __FILE__, OCC544, group);
-  //////theCommands.Add("OCC817", "OCC817 result mesh_delta", __FILE__, OCC817, group);
-  theCommands.Add("OCC817", "OCC817 result mesh_delta [BRepAlgoAPI/BRepAlgo = 1/0]", __FILE__, OCC817, group);
-
-  return;
-}
diff --git a/src/QARicardo/QARicardo_CMPLRS.edl b/src/QARicardo/QARicardo_CMPLRS.edl
deleted file mode 100755 (executable)
index 2eae0bb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
--- Created on: 2002-05-16
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-@ifnotdefined ( %QARicardo_CMPLRS_EDL) then
-@set %QARicardo_CMPLRS_EDL = "";
-
-  @uses "CSF.edl" ;
-
-  @string %CMPLRS_CXX_Options = " -I"%CSF_TCL_INCLUDE  %CMPLRS_CXX_Options ;
-
-
-@endif;
diff --git a/src/QARina/QARina.cdl b/src/QARina/QARina.cdl
deleted file mode 100755 (executable)
index 76193e7..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-03-19
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QARina
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
-    
diff --git a/src/QARina/QARina.cxx b/src/QARina/QARina.cxx
deleted file mode 100755 (executable)
index d14c773..0000000
+++ /dev/null
@@ -1,1111 +0,0 @@
-// Created on: 2002-03-19
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#include <stdio.h>
-
-#include <QARina.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <Geom2d_Line.hxx>
-#include <TColgp_Array1OfPnt2d.hxx>
-#include <Geom2d_BezierCurve.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
-#include <Geom2dGcc_QualifiedCurve.hxx>
-#include <Geom2dGcc_Circ2d2TanRad.hxx>
-#include <Geom2d_Circle.hxx>
-#include <TopoDS_Edge.hxx>
-#include <TopoDS.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <gp_Lin.hxx>
-#include <BRepFeat_SplitShape.hxx>
-#include <DBRep_DrawableShape.hxx>
-#include <BRep_Builder.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-#include <BRepExtrema_DistShapeShape.hxx>
-#include <Draw.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <BRepLib_MakeVertex.hxx>
-#include <BRepLib_MakeEdge.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
-#include <GeomAPI_Interpolate.hxx>
-#include <Precision.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <OSD_Path.hxx>
-#include <ShapeBuild_ReShape.hxx>
-#include <ShapeExtend_WireData.hxx>
-#include <TopoDS_Wire.hxx>
-#include <ShapeExtend_WireData.hxx>
-#include <ShapeFix_Wire.hxx>
-#include <ShapeAnalysis_WireOrder.hxx>
-#include <ShapeAnalysis_Wire.hxx>
-#include <TopExp.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <BRep_Tool.hxx>
-#include <ShapeAnalysis_Curve.hxx>
-#include <V3d_View.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-static Standard_Integer BUC60897 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  Standard_Character abuf[16];
-
-  Handle(Geom2d_Line) aLine = new Geom2d_Line(gp_Pnt2d(100, 0), gp_Dir2d(-1, 0));
-  sprintf(abuf,"line");
-  Standard_CString st = abuf;
-  DrawTrSurf::Set (st, aLine);
-
-  TColgp_Array1OfPnt2d aPoints(1, 3);
-  aPoints.SetValue(1, gp_Pnt2d(0, 0));
-  aPoints.SetValue(2, gp_Pnt2d(50, 50));
-  aPoints.SetValue(3, gp_Pnt2d(0, 100));
-  Handle(Geom2d_BezierCurve) aCurve = new Geom2d_BezierCurve(aPoints);
-  sprintf(abuf,"curve");
-  DrawTrSurf::Set (st, aCurve);
-
-  Geom2dAdaptor_Curve aCLine(aLine);
-  Geom2dAdaptor_Curve aCCurve(aCurve);
-  Geom2dGcc_QualifiedCurve aQualifCurve1(aCLine, GccEnt_outside);
-  Geom2dGcc_QualifiedCurve aQualifCurve2(aCCurve, GccEnt_outside);
-  Geom2dGcc_Circ2d2TanRad aGccCirc2d(aQualifCurve1, aQualifCurve2, 10, 1e-7);
-  if(!aGccCirc2d.IsDone())
-  {
-    di << "Faulty: can not create a circle." << "\n";
-    return 1;
-  }
-  for(Standard_Integer i = 1; i <= aGccCirc2d.NbSolutions(); i++)
-  {
-    gp_Circ2d aCirc2d = aGccCirc2d.ThisSolution(i);
-    di << "circle : X " << aCirc2d.Location().X() << " Y " << aCirc2d.Location().Y() << " R " << aCirc2d.Radius();
-    Standard_Real aTmpR1, aTmpR2;
-    gp_Pnt2d aPnt2d1, aPnt2d2;
-    aGccCirc2d.Tangency1(i, aTmpR1, aTmpR2, aPnt2d1);
-    aGccCirc2d.Tangency2(i, aTmpR1, aTmpR2, aPnt2d2);
-    di << "\n" << "tangency1 : X " << aPnt2d1.X() << " Y " << aPnt2d1.Y();
-    di << "\n" << "tangency2 : X " << aPnt2d2.X() << " Y " << aPnt2d2.Y() << "\n";
-    
-    sprintf(abuf,"circle_%d",i);
-    Handle(Geom2d_Curve) circ_res = new Geom2d_Circle(aCirc2d);
-    DrawTrSurf::Set (st, circ_res);
-  }
-
-  di << "done" << "\n";
-  return 0;
-}
-
-static Standard_Integer BUC60889 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 10) {
-    di << "Usage : " << argv[0] << " point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2" << "\n";
-    return 1;
-  } else {
-    gp_Pnt p1, p2;
-    if (!(DrawTrSurf::GetPoint(argv[1], p1)) || !(DrawTrSurf::GetPoint(argv[2], p2)))
-    {
-      di << "Need two points to define a band" << "\n";
-      return 1;
-    }
-    TopoDS_Edge ed = TopoDS::Edge(DBRep::Get(argv[3]));
-    if (ed.IsNull())
-    {
-      di << "Need an edge to define the band direction" << "\n";
-      return 1;
-    }
-    BRepAdaptor_Curve curve(ed);
-    gp_Dir d = curve.Line().Direction();
-    Bnd_Box bnd_box;
-    bnd_box.Update(atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7]), atof(argv[8]), atof(argv[9]));
-    if(bnd_box.IsOut(p1, p2, d))
-      di << "The band lies out of the box" << "\n";
-    else
-      di << "The band intersects the box" << "\n";
-    
-    return 0;
-  }
-}
-
-static Standard_Integer BUC60852 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 8)
-    di << "Usage : " << argv[0] << " name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2" << "\n";
-  else {
-    TopoDS_Edge shape = TopoDS::Edge(DBRep::Get(argv[1]));
-    if(shape.ShapeType() != TopAbs_EDGE)
-      di << "shape must be an edge" << "\n";
-    else {
-      BRepAdaptor_Curve curve(shape);
-      gp_Lin lin = curve.Line();
-      Bnd_Box bnd_box;
-      bnd_box.Update(atof(argv[2]), atof(argv[3]), atof(argv[4]), atof(argv[5]), atof(argv[6]), atof(argv[7]));
-      if(bnd_box.IsOut(lin))
-       di << "Line that lies on edge does not intersect the box" << "\n";
-      else
-       di << "Line that lies on edge intersects the box" << "\n";
-    }
-  }
-  return 0;
-}
-
-static Standard_Integer BUC60854 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv)
-{
-  Standard_Integer newnarg;
-  if (argc < 3) return 1;
-  TopoDS_Shape S = DBRep::Get(argv[2]);
-  BRepFeat_SplitShape Spls(S);
-  Standard_Boolean pick = Standard_False;
-  TopoDS_Shape EF;
-  Standard_Real u,v;
-  Standard_Integer i = 3;
-  for ( newnarg=3; newnarg<argc; newnarg++) {
-    if (argv[newnarg][0] == '@') {
-      break;
-    }
-  }
-  if (newnarg == 3 || 
-      (newnarg !=argc && ((argc-newnarg)<=2 || (argc-newnarg)%2 != 1))) {
-    return 1;
-  }
-  if (i<newnarg) {
-    pick = (argv[i][0] == '.');
-    EF = DBRep::Get(argv[i],TopAbs_FACE);
-    if (EF.IsNull()) return 1;
-  }
-  while (i < newnarg) {
-    if (pick) {
-      DBRep_DrawableShape::LastPick(EF,u,v);
-    }
-    if (EF.ShapeType() == TopAbs_FACE) {
-      i++;
-      while (i < newnarg) {
-       TopoDS_Shape W;
-       Standard_Boolean rever = Standard_False;
-       if (argv[i][0] == '-') {
-         if (argv[i][1] == '\0')
-           return 1;
-         pick = (argv[i][1] == '.');
-         const char* Temp = argv[i]+1;
-         W = DBRep::Get(Temp,TopAbs_SHAPE,Standard_False);
-         rever = Standard_True;
-       }
-       else {
-         pick = (argv[i][0] == '.');
-         W = DBRep::Get(argv[i],TopAbs_SHAPE,Standard_False);
-       }
-       if (W.IsNull()) {
-         return 1;
-       }
-       TopAbs_ShapeEnum wtyp = W.ShapeType();
-       if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE && pick) {
-         Standard_Real u,v;
-         DBRep_DrawableShape::LastPick(W,u,v);
-         wtyp = W.ShapeType();
-       }
-       if (wtyp != TopAbs_WIRE && wtyp != TopAbs_EDGE) {
-         EF = DBRep::Get(argv[i]);
-         break;
-       }
-       else {
-         if (rever) {
-           W.Reverse();
-         }
-         if (wtyp == TopAbs_WIRE) {
-           Spls.Add(TopoDS::Wire(W),TopoDS::Face(EF));
-         }
-         else {
-           Spls.Add(TopoDS::Edge(W),TopoDS::Face(EF));
-         }
-       }
-       i++;
-      }
-    }
-    else
-      return 1;
-  }
-  for (i++; i<argc; i+=2) {
-    TopoDS_Shape Ew,Es;
-    TopoDS_Shape aLocalShape(DBRep::Get(argv[i],TopAbs_EDGE));
-    Es = TopoDS::Edge(aLocalShape);
-    if (Es.IsNull()) {
-      return 1;
-    }
-    aLocalShape = DBRep::Get(argv[i+1],TopAbs_EDGE);
-    Ew = TopoDS::Edge(aLocalShape);
-    if (Ew.IsNull()) {
-      return 1;
-    }
-    Spls.Add(TopoDS::Edge(Ew),TopoDS::Edge(Es));
-  }
-  Spls.Build();
-  const TopTools_ListOfShape& aLeftPart = Spls.Left();
-  BRep_Builder BB;
-  TopoDS_Shape aShell;
-  BB.MakeShell(TopoDS::Shell(aShell));
-  TopTools_ListIteratorOfListOfShape anIter(aLeftPart);
-  for(; anIter.More(); anIter.Next()) BB.Add(aShell, anIter.Value());
-  DBRep::Set(argv[1],aShell);
-  return 0;
-}
-
-static Standard_Integer BUC60870 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Standard_Integer i1;
-  if (argc != 5) {
-    di << "Usage : " << argv[0] << " result name_of_shape_1 name_of_shape_2 dev" << "\n";
-    return 1;
-  }
-  const char *ns1 = (argv[2]), *ns2 = (argv[3]), *ns0 = (argv[1]);
-  TopoDS_Shape S1(DBRep::Get(ns1)), S2(DBRep::Get(ns2))  ;
-  Standard_Real dev =  atof(argv[4]);
-  BRepExtrema_DistShapeShape dst(S1 ,S2, dev );
-  if (dst.IsDone()) {
-    char named[100];
-    sprintf(named, "%s%s" ,ns0,"_val");
-    char* tempd = named;
-    Draw::Set(tempd,dst.Value());
-    di << named << " ";
-    for (i1=1; i1<= dst.NbSolution(); i1++) {
-      gp_Pnt P1,P2;
-      P1 = (dst.PointOnShape1(i1));
-      P2 = (dst.PointOnShape2(i1));
-      if (dst.Value()<=1.e-9) {
-       TopoDS_Vertex V =BRepLib_MakeVertex(P1);
-       char namev[100];
-       if (i1==1) {
-         sprintf(namev, "%s" ,ns0);
-       } else {
-         sprintf(namev, "%s%d" ,ns0,i1);
-       }
-       char* tempv = namev;
-       DBRep::Set(tempv,V);
-       di << namev << " ";
-      } else {
-       char name[100];
-       TopoDS_Edge E = BRepLib_MakeEdge (P1, P2);
-       if (i1==1) {
-         sprintf(name,"%s",ns0);
-       } else {
-         sprintf(name,"%s%d",ns0,i1);
-       }
-       char* temp = name;
-       DBRep::Set(temp,E);
-       di << name << " " ;
-      }
-    }
-  } else {
-    di << "Faulty : found a problem"<< "\n";
-  }
-  return 0;
-}
-
-static Standard_Integer BUC60902 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  Handle(TColgp_HArray1OfPnt) aPnts = new TColgp_HArray1OfPnt(1,5);
-  gp_Pnt aP(0., 0., 0.);
-  for(Standard_Integer i = 1; i <= 5; i++) {
-    aP.SetX((i-1)*1.57);
-    aP.SetY(Sin((i-1)*1.57));
-    aPnts->SetValue(i, aP);
-  }
-  GeomAPI_Interpolate anInterpolater(aPnts, Standard_False, Precision::Confusion());
-  anInterpolater.Perform(); 
-  if(!anInterpolater.IsDone()) {
-    di << "Faulty : error in interpolation" << "\n";
-    return 1;
-  }
-  Handle(Geom_BSplineCurve) aCur = anInterpolater.Curve(); 
-  gp_Vec aFirstTang, aLastTang;
-  aCur->D1(aCur->FirstParameter(), aP, aFirstTang);
-  aCur->D1(aCur->LastParameter(), aP, aLastTang);
-  di << " Used Tang1 = " << aFirstTang.X() << " " << aFirstTang.Y() << " " << aFirstTang.Z() << "\n"; 
-  di << " Used Tang2 = " << aLastTang.X() << " " << aLastTang.Y() << " " << aLastTang.Z() << "\n"; 
-  GeomAPI_Interpolate anInterpolater1(aPnts, Standard_False, Precision::Confusion());
-  anInterpolater1.Load(aFirstTang, aLastTang, Standard_False); 
-  anInterpolater1.Perform(); 
-  if(!anInterpolater1.IsDone()) {
-    di << "Faulty : error in interpolation 1" << "\n";
-    return 1;
-  }
-  aCur = anInterpolater1.Curve();
-  gp_Vec aFirstTang1, aLastTang1;
-  aCur->D1(aCur->FirstParameter(), aP, aFirstTang1);
-  aCur->D1(aCur->LastParameter(), aP, aLastTang1);
-  di << " Tang1 after compute = " << aFirstTang1.X() << " " << aFirstTang1.Y() << " " << aFirstTang1.Z() << "\n"; 
-  di << " Tang2 after compute = " << aLastTang1.X() << " " << aLastTang1.Y() << " " << aLastTang1.Z() << "\n"; 
-  if(aFirstTang.IsEqual(aFirstTang1, Precision::Confusion(), Precision::Angular())) {
-    di << "First tangent is OK" << "\n";
-  }
-  else {
-    di << "Faulty : first tangent is wrong" << "\n";
-  }
-  if(aLastTang.IsEqual(aLastTang1, Precision::Confusion(), Precision::Angular())) {
-    di << "Last tangent is OK" << "\n";
-  }
-  else {
-    di << "Faulty : last tangent is wrong" << "\n";
-  }
-  return 0;
-}
-
-static Standard_Integer BUC60944 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " path" << "\n";
-  }
-
-  TCollection_AsciiString in(argv[1]);
-  OSD_Path* aPath = new OSD_Path(in);
-  TCollection_AsciiString out;
-  aPath->SystemName(out);
-  if(in == out) 
-    di << "The convertion is right." << "\n";
-  else
-    di << "Faulty : The convertion is incorrect : " << out.ToCString() << "\n";
-  di << out.ToCString() << "\n";
-//  cout << aPath->Trek() << " !" << endl;
-  return 0;
-}
-
-Standard_Boolean BuildWiresWithReshape
-                (const Handle(ShapeBuild_ReShape)& theReshape,
-                 const TopTools_ListOfShape &theListOfEdges,
-                 TopTools_ListOfShape       &theListOfWires,
-                 const Standard_Boolean      isFixConnectedMode,
-                 const Standard_Boolean      isKeepLoopsMode,
-                 const Standard_Real         theTolerance)
-{
-  TopTools_ListIteratorOfListOfShape anEdgeIter;
-  Standard_Boolean                   isDone;
-  TopoDS_Wire                        aWire;
-
-  theListOfWires.Clear();
-  Handle(ShapeExtend_WireData) aWireData  = new ShapeExtend_WireData;
-  Handle(ShapeFix_Wire) aShFixWire = new ShapeFix_Wire;
-  aShFixWire->SetContext (theReshape);
-
-  Handle(ShapeAnalysis_Wire) aWireAnalyzer;
-  ShapeAnalysis_WireOrder aWireOrder;
-
-  aShFixWire->Load(aWireData);
-  aShFixWire->SetPrecision(theTolerance);
-
-  for(anEdgeIter.Initialize(theListOfEdges); anEdgeIter.More(); anEdgeIter.Next())
-    aWireData->Add(TopoDS::Edge(anEdgeIter.Value()));
-
-  aWireOrder.KeepLoopsMode() = isKeepLoopsMode;
-  aWireAnalyzer = aShFixWire->Analyzer();
-  aWireAnalyzer->CheckOrder(aWireOrder, Standard_True);
-
-  aShFixWire->FixReorder(aWireOrder);
-  isDone = !aShFixWire->StatusReorder(ShapeExtend_FAIL);
-  if (!isDone)
-    return Standard_False;
-
-  if (isFixConnectedMode)
-  {
-    aShFixWire->ModifyTopologyMode() = Standard_True;
-    aShFixWire->FixConnected(theTolerance);
-  }
-
-  aWire = aWireData->Wire();
-
-//   if (aWire.Closed())
-//   {
-//     theListOfWires.Append(aWire);
-//     return Standard_True;
-//   }
-
-  Standard_Integer i;
-  BRep_Builder     aBuilder;
-  TopoDS_Wire      aCurWire;
-  TopoDS_Vertex    aVf;
-  TopoDS_Vertex    aVl;
-  TopoDS_Vertex    aVlast;
-  Standard_Integer aNbEdges = aWireData->NbEdges();
-
-  aBuilder.MakeWire(aCurWire);
-  if (aNbEdges >= 1)
-  {
-    TopoDS_Edge anE = aWireData->Edge(1);
-    TopExp::Vertices(anE, aVf, aVlast, Standard_True);
-    aBuilder.Add(aCurWire, anE);
-  }
-
-  for(i = 2; i <= aNbEdges; i++)
-  {
-    TopoDS_Edge anE = aWireData->Edge(i);
-    TopExp::Vertices(anE, aVf, aVl, Standard_True);
-    if (aVf.IsSame(aVlast))
-    {
-      aBuilder.Add(aCurWire, anE);
-      aVlast = aVl;
-    }
-    else
-    {
-      aVlast = aVl;
-      TopExp::Vertices(aCurWire, aVf, aVl);
-      if (aVf.IsSame(aVl))
-        aCurWire.Closed(Standard_True);
-      theListOfWires.Append(aCurWire);
-      aBuilder.MakeWire(aCurWire);
-      aBuilder.Add(aCurWire, anE);
-    }
-  }
-
-  TopExp::Vertices(aCurWire, aVf, aVl);
-  if (aVf.IsSame(aVl))
-    aCurWire.Closed(Standard_True);
-  theListOfWires.Append(aCurWire);
-
-  return Standard_True;
-}
-
-Standard_Boolean BuildWires(const TopTools_ListOfShape &theListOfEdges,
-                                     TopTools_ListOfShape       &theListOfWires,
-                                     const Standard_Boolean      isFixConnectedMode = Standard_False,
-                                     const Standard_Boolean      isKeepLoopsMode = Standard_True,
-                                     const Standard_Real         theTolerance = Precision::Confusion())
-{
-  Handle(ShapeBuild_ReShape) aReshape = new ShapeBuild_ReShape;
-  return BuildWiresWithReshape (aReshape, theListOfEdges, theListOfWires,
-                                isFixConnectedMode, isKeepLoopsMode, theTolerance);
-}
-
-Standard_Boolean BuildBoundWires(const TopoDS_Shape   &theShell,
-                                          TopTools_ListOfShape &theListOfWires)
-{
-  TopTools_IndexedDataMapOfShapeListOfShape
-                               anEdgeFaceMap;
-  Standard_Integer             i;
-  Standard_Boolean             isBound;
-  TopTools_ListOfShape         aBoundaryEdges;
-
-  TopExp::MapShapesAndAncestors(theShell, TopAbs_EDGE, TopAbs_FACE, anEdgeFaceMap);
-
-  isBound = Standard_False;
-  for (i = 1; i <= anEdgeFaceMap.Extent(); i++)
-  {
-    const TopTools_ListOfShape &anAncestFaces = anEdgeFaceMap.FindFromIndex(i);
-    if (anAncestFaces.Extent() == 1)
-    {
-      const TopoDS_Edge &anEdge = TopoDS::Edge(anEdgeFaceMap.FindKey(i));
-      if (!BRep_Tool::Degenerated(anEdge))
-      {
-        aBoundaryEdges.Append(anEdge);
-        isBound = Standard_True;
-      }
-    }
-  }
-
-  if (!isBound)
-    return Standard_True;
-
-  return BuildWires(aBoundaryEdges, theListOfWires);
-}
-
-static Standard_Integer BUC60868 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 3) {
-    di << "Usage : " <<argv[0] << " Result Shell" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape aShell = DBRep::Get(argv[2]);
-
-  if (aShell.IsNull()) {
-    di << "Faulty : The shape is NULL" << "\n";
-    return 1;
-  }
-
-  TopTools_ListOfShape               aListOfWires;
-  BuildBoundWires(aShell, aListOfWires);
-
-  TopoDS_Shape aRes;
-  if (aListOfWires.IsEmpty())
-    di << "no bound" << "\n";
-  else if (aListOfWires.Extent() == 1)
-    aRes = aListOfWires.First();
-  else {
-    BRep_Builder aBld;
-    aBld.MakeCompound (TopoDS::Compound(aRes));
-    TopTools_ListIteratorOfListOfShape aWireIter (aListOfWires);
-    for(; aWireIter.More(); aWireIter.Next())
-      aBld.Add (aRes, aWireIter.Value());
-  }
-
-  DBRep::Set(argv[1], aRes);
-  return 0;
-}
-
-static Standard_Integer BUC60924 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 5) {
-    di << "Usage : " <<argv[0] << " curve X Y Z" << "\n";
-    return 1;
-  }
-
-  Handle(Geom_Curve) aCurve = DrawTrSurf::GetCurve(argv[1]);
-
-  if (aCurve.IsNull()) {
-    di << "Faulty : the curve is NULL." << "\n";
-    return 1;
-  }
-  
-  gp_XYZ aVec(atof(argv[2]),atof(argv[3]),atof(argv[4]));
-  
-  Standard_Boolean isPlanar=Standard_False;
-  isPlanar=ShapeAnalysis_Curve::IsPlanar(aCurve,aVec,1e-7);
-  
-  if(isPlanar)
-    di << "The curve is planar !" << "\n";
-  else 
-    di << "Faulty : the curve is not planar!" << "\n";
-  
-  return 0;
-}
-
-static Standard_Integer  BUC60920(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    cerr << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  di.Eval("box b 10 10 10");
-  di.Eval("box w 20 20 20");
-  di.Eval("explode w e");
-
-  di.Eval(" vdisplay b");
-  di.Eval("vsetdispmode 1");
-
-  const char * Shname="w_11";
-  TopoDS_Shape theShape =  DBRep::Get(Shname);
-
-  Handle(AIS_Shape) anAISShape = new AIS_Shape( theShape ); 
-  myAISContext->Display( anAISShape, Standard_True );
-  
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  
-  double Xv,Yv;
-  myV3dView->Project(20,20,0,Xv,Yv);
-//  cout<<Xv<<"\t"<<Yv<<endl;
-  
-  Standard_Integer Xp,Yp;
-  myV3dView->Convert(Xv,Yv,Xp,Yp);
-//  cout<<Xp<<"\t"<<Yp<<endl;
-
-  myAISContext->MoveTo( Xp,Yp, myV3dView  );
-  myAISContext->MoveTo( Xp,Yp, myV3dView  );
-
-//   if (myAISContext->IsHilighted(anAISShape)) 
-//              cout << "has hilighted shape : OK"   << endl;
-//   else       cout << "has hilighted shape : bugged - Faulty "   << endl;
-  
-  return 0;
-}
-
-#include <LDOMParser.hxx>
-static Standard_Integer  OCC983 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2) {
-    di << "Usage : " << argv[0] << " file" << "\n";
-    return 1;
-  }
-
-  LDOMParser aParser;
-  LDOM_Document myDOM;
-
-  const char *File = (argv[1]);
-
-  if(!aParser.parse(File)) {
-    myDOM=aParser.getDocument();
-    di<<"Document parsed"<<"\n";
-  } else {
-    di<<"Document not parsed"<<"\n";
-    return 0;
-  }
-
-  LDOM_Element root = myDOM.getDocumentElement();
-
-  if ( root.isNull() ) {
-    di<<"Root element is null"<<"\n";
-    return 0;
-  }
-
-  TCollection_AsciiString RootName = root.getTagName();
-  di << "   RootName = " << RootName.ToCString() << "\n";
-  LDOM_NodeList aChildList = root.GetAttributesList();
-  for(Standard_Integer i=0,n=aChildList.getLength();i<n;i++) {
-    LDOM_Node item = aChildList.item(i);
-    TCollection_AsciiString itemName = item.getNodeName();
-    TCollection_AsciiString itemValue = item.getNodeValue();
-    di << "       AttributeName = " << itemName.ToCString() << "\n";
-    di << "       AttributeValue = " << itemValue.ToCString() << "\n";
-  }
-
-//  LDOM_Element element;
-//  for ( element = (const LDOM_Element&) root.getFirstChild();
-//       !element.isNull();
-//       element = (const LDOM_Element&) element.getNextSibling() ) {
-  LDOM_Element element;
-  LDOM_Node    node;
-  for ( node = root.getFirstChild(), element = (const LDOM_Element&) node;
-       !element.isNull();
-       node = element.getNextSibling(), element = (const LDOM_Element&) node) {
-    TCollection_AsciiString ElementName = element.getTagName();
-    di << "   ElementName = " << ElementName.ToCString() << "\n";
-    LDOM_NodeList aChildList2 = element.GetAttributesList();
-    for(Standard_Integer i2=0,n2=aChildList2.getLength();i2<n2;i2++) {
-      LDOM_Node item2 = aChildList2.item(i2);
-      TCollection_AsciiString itemName2 = item2.getNodeName();
-      TCollection_AsciiString itemValue2 = item2.getNodeValue();
-      di << "       AttributeName = " << itemName2.ToCString() << "\n";
-      di << "       AttributeValue = " << itemValue2.ToCString() << "\n";
-    }
-  }
-
-  return 0;
-}
-
-static Standard_Integer  OCC984 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2) {
-    di << "Usage : " << argv[0] << " file" << "\n";
-    return 1;
-  }
-
-  LDOMParser aParser;
-  LDOM_Document myDOM;
-
-  //Standard_Character  *File = new Standard_Character [100];
-  //sprintf(File,"%s",argv[1]);
-  const char *File = (argv[1]);
-
-  if(!aParser.parse(File)) {
-    myDOM=aParser.getDocument();
-    di<<"Document parsed"<<"\n";
-  } else {
-    di<<"Document not parsed"<<"\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC1786 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 2)
-  {
-    di << "Usage : " << argv[0] << " AutoHilight=0/1" << "\n";
-    return 1;
-  }
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-  {
-    cerr << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  Standard_Integer AutoHilightInteger =  atoi(argv[1]);
-  Standard_Boolean AutoHilightBoolean = Standard_False;
-  if (AutoHilightInteger != 0) {
-     AutoHilightBoolean = Standard_True;
-  }
-  aContext->SetAutomaticHilight(AutoHilightBoolean);
-  return 0;
-}
-
-//#include <math.h>
-// See QAOCC.cxx OCC6143
-//static Standard_Integer OCC1723 (Draw_Interpretor& /*di*/, Standard_Integer argc, const char ** argv)
-//{
-//  if( argc != 1)
-//  {
-//    cout << "Usage : " << argv[0] << endl;
-//    return 1;
-//  }
-//
-//  Standard_Boolean isBad = Standard_False, isCaught;
-//
-//  // Case 1
-//  isCaught = Standard_False;
-//  {
-//    try {
-//      OCC_CATCH_SIGNALS
-//      Standard_Integer a = 1;
-//      Standard_Integer b = 0;
-//      Standard_Integer c = a / b;
-//    }
-//    catch ( Standard_Failure ) {
-//      isCaught = Standard_True;
-//      cout << "OCC1723 Case 1 : OK" << endl;
-//    }
-//  }
-//  isBad = isBad || !isCaught;
-//
-//  // Case 2
-//  isCaught = Standard_False;
-//  {
-//    try {
-//      OCC_CATCH_SIGNALS
-//      Standard_Real d = -1.0;
-//      Standard_Real e = sqrt(d);
-//    }
-//    catch ( Standard_Failure ) {
-//      isCaught = Standard_True;
-//      cout << "OCC1723 Case 2 : OK" << endl;
-//    }
-//  }
-//  isBad = isBad || !isCaught;
-//
-//  // Case 3
-//  isCaught = Standard_False;
-//  {
-//    try {
-//      OCC_CATCH_SIGNALS
-//      Standard_Real f = 1.0e-200;
-//      Standard_Real g = 1.0e-200;
-//      Standard_Real h = f * g;
-//    }
-//    catch ( Standard_Failure ) {
-//      isCaught = Standard_True;
-//      cout << "OCC1723 Case 3 : OK" << endl;
-//    }
-//  }
-//  // MSV: underflow is not caught
-//  //isBad = isBad || !isCaught;
-//
-//  // Case 4
-//  isCaught = Standard_False;
-//  {
-//    try {
-//      OCC_CATCH_SIGNALS
-//      Standard_Real i = 1.0e+200;
-//      Standard_Real j = 1.0e+200;
-//      Standard_Real k = i * j;
-//    }
-//    catch ( Standard_Failure ) {
-//      isCaught = Standard_True;
-//      cout << "OCC1723 Case 4 : OK" << endl;
-//    }
-//  }
-//  isBad = isBad || !isCaught;
-//
-//  if (isBad) {
-//    cout << "OCC1723 : Error" << endl;
-//  } else {
-//    cout << "OCC1723 : OK" << endl;
-//  }
-//
-//  return 0;
-//}
-
-#include <locale.h>
-static Standard_Integer OCC1919_get (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-  const TCollection_AsciiString anOldNumLocale =
-    (Standard_CString) setlocale (LC_NUMERIC, NULL);
-  di << "LC_NUMERIC = " << anOldNumLocale.ToCString() << "\n";
-  return 0;
-}
-static Standard_Integer OCC1919_set (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 2)
-  {
-    di << "Usage : " << argv[0] << " LC_NUMERIC" << "\n";
-    return 1;
-  }
-  TCollection_AsciiString aNumLocale(argv[1]);
-  setlocale(LC_ALL, "") ;
-  setlocale(LC_NUMERIC, aNumLocale.ToCString()) ;
-  return 0;
-}
-#include <DDF.hxx>
-#include <TDF_Label.hxx>
-#include <TDataStd_Real.hxx>
-#include <NCollection_BaseMap.hxx>
-static Standard_Integer OCC1919_real (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc == 4) {
-    Handle(TDF_Data) DF;
-    if (!DDF::GetDF(argv[1],DF)) return 1;
-    TDF_Label L;
-    DDF::AddLabel(DF, argv[2], L);
-
-    //TDataStd_Real::Set(L,atof(arg[3]));
-    TCollection_AsciiString AsciiStringReal(argv[3]);
-    if (!AsciiStringReal.IsRealValue()) return 1;
-    Standard_Real aReal = AsciiStringReal.RealValue();
-    di << "aReal = " << aReal << "\n";
-
-    TDataStd_Real::Set(L,aReal);
-    return 0;
-  }
-  return 1;
-}
-
-#include <TDataStd_UAttribute.hxx>
-static Standard_Integer OCC2932_SetIDUAttribute (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 5)
-  {
-    di << "Usage : " << argv[0] << " (DF, entry, oldLocalID, newLocalID)" << "\n";
-    return 1;
-  }
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) return 1; 
-  TDF_Label label;
-  if( !DDF::FindLabel(DF, argv[2], label) ) {
-    di << "No label for entry " << argv[2] << "\n";
-    return 0;
-  }
-  Standard_GUID old_guid(argv[3]);  //"00000000-0000-0000-2222-000000000000");
-  Standard_GUID new_guid(argv[4]);  //"00000000-0000-0000-2222-000000000001");
-
-  Handle(TDataStd_UAttribute) UA;    
-  if( !label.FindAttribute(old_guid, UA) ) {
-    di << "No UAttribute Attribute on label " << argv[2] << "\n";
-    return 0;
-  }
-  Handle(TDataStd_UAttribute) anotherUA;    
-  if( label.FindAttribute(new_guid, anotherUA) ) {
-    di << "There is this UAttribute Attribute on label " << argv[2] << "\n";
-    return 0;
-  }
-  UA->SetID(new_guid);
-  return 0;  
-}
-
-static Standard_Integer OCC2932_SetTag (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 4)
-  {
-    di << "Usage : " << argv[0] << " (DF, entry, Tag)" << "\n";
-    return 1;
-  }
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) return 1;
-  TDF_Label L;
-  DDF::AddLabel(DF, argv[2], L);
-  Standard_Integer Tag = atoi(argv[3]);
-  Handle(TDF_TagSource) A = TDF_TagSource::Set(L);
-  A->Set(Tag);
-  return 0;
-}
-
-#include <TDataStd_Current.hxx>
-static Standard_Integer OCC2932_SetCurrent (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 3)
-  {
-    di << "Usage : " << argv[0] << " (DF, entry)" << "\n";
-    return 1;
-  }
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) return 1;
-  TDF_Label L;
-  DDF::AddLabel(DF, argv[2], L);
-  TDataStd_Current::Set(L);  
-  return 0;
-}
-
-#include <TDataStd_Expression.hxx>
-static Standard_Integer OCC2932_SetExpression (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 4)
-  {
-    di << "Usage : " << argv[0] << " (DF, entry, Expression)" << "\n";
-    return 1;
-  }
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) return 1;
-  TDF_Label L;
-  DDF::AddLabel(DF, argv[2], L);
-  TCollection_ExtendedString Expression(argv[3]);
-  Handle(TDataStd_Expression) A = TDataStd_Expression::Set(L);
-  A->SetExpression(Expression);
-  return 0;
-}
-
-#include <TDataStd_Relation.hxx>
-static Standard_Integer OCC2932_SetRelation (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 4)
-  {
-    di << "Usage : " << argv[0] << " (DF, entry, Relation)" << "\n";
-    return 1;
-  }
-  Handle(TDF_Data) DF;
-  if (!DDF::GetDF(argv[1],DF)) return 1;
-  TDF_Label L;
-  DDF::AddLabel(DF, argv[2], L);
-  TCollection_ExtendedString Relation(argv[3]);
-  Handle(TDataStd_Relation) A = TDataStd_Relation::Set(L);
-  A->SetRelation(Relation);
-  return 0;
-}
-
-static Standard_Integer OCC3277 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if( argc != 2)
-  {
-    di << "Usage : " << argv[0] << " string" << "\n";
-    return 1;
-  }
-  TCollection_ExtendedString ExtendedString;
-  TCollection_ExtendedString InputString(argv[1]);
-  ExtendedString.Cat(InputString);
-  //ExtendedString.Print(cout);
-  Standard_SStream aSStream;
-  ExtendedString.Print(aSStream);
-  di << aSStream;
-  return 0;
-}
-
-static Standard_Integer OCC6794 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc > 2)
-    {
-      di << "Usage: " << argv[0] << " [nb]" << "\n";
-      return 1;
-    }
-
-  char* max = ::getenv( "MMGT_THRESHOLD" );
-  
-  Standard_Integer aNb = 1;
-  if ( max )
-    aNb += atoi( max );
-  else
-    aNb += 40000;
-
-  if ( argc > 1 )
-    aNb = atoi( argv[1] );
-
-  di << "Use nb = " << aNb << "\n";
-
-  const char* c = "a";
-  {
-    TCollection_AsciiString anAscii;
-    for ( int i = 1; i <= aNb; i++ ) {
-      anAscii += TCollection_AsciiString( c );
-    }
-    Standard_Integer aLength = anAscii.Length();
-    di << "aLength = " << aLength << "\n";
-  }
-  return 0;
-}
-
-static Standard_Integer OCC16485 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc > 1)
-    {
-      di << "Usage: " << argv[0] << "\n";
-      return 1;
-    }
-
-  // Create points with X co-ordinate from varying from 0. to 1000.
-  // anc compute cumulative bounding box by adding boxes for all the 
-  // points, enlarged on tolerance
-  
-  Standard_Real tol = 1e-3;
-  int nbstep = 1000;
-  Bnd_Box Box;
-  for ( int i=0; i <= nbstep; i++ )
-  {
-    gp_Pnt p(i, 0., 0.);
-    Bnd_Box B;
-    B.Add(p);
-    B.Enlarge(tol);
-    B.Add ( Box ); 
-    Box = B; // in this case XMin of Box will grow each time
-  }
-  
-  Standard_Real xmin, ymin, zmin, xmax, ymax, zmax;
-  Box.Get (xmin, ymin, zmin, xmax, ymax, zmax);
-  //cout.precision(16);
-  //cout << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << endl;
-  di << "Resulting dimensions: Xmin = " << xmin << " , Xmax = " << xmax << " , Tolerance = " << tol << "\n";
-  if ( Abs ( xmin + tol ) > 1e-10 )
-      di << "TEST FAILED: Xmin must be equal to -1e3!\n";
-  else
-      di << "TEST OK\n";
-      //cout << "TEST FAILED: Xmin must be equal to -1e3!" << endl;
-      //cout << "TEST OK" << endl;
-      //di << "TEST FAILED: Xmin must be equal to -1e3!\n";
-      //di << "TEST OK\n";
-  return 0;
-}
-//Resulting dimensions: Xmin = -0.001 , Xmax = 1000.001 , Tolerance = 0.001
-//TEST OK
-
-void QARina::Commands(Draw_Interpretor& theCommands) {
-  const char *group = "QARina";
-
-  theCommands.Add ("BUC60897", "BUC60897", __FILE__, BUC60897, group);
-  theCommands.Add ("BUC60889", "BUC60889 point_1 point_2 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60889, group);
-  theCommands.Add ("BUC60852", "BUC60852 name_of_edge bndbox_X1 bndbox_Y1 bndbox_Z1 bndbox_X2 bndbox_Y2 bndbox_Z2", __FILE__, BUC60852, group);
-  theCommands.Add ("BUC60854", "BUC60854 result_shape name_of_shape name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] [ name_of_face name_of_wire/name_of_edge [ name_of_wire/name_of_edge ... ] ... ] [ @ edge_on_shape edge_on_wire [ edge_on_shape edge_on_wire ... ] ] ", __FILE__, BUC60854, group);
-  theCommands.Add ("BUC60870", "BUC60870 result name_of_shape_1 name_of_shape_2 dev", __FILE__, BUC60870, group);
-  theCommands.Add ("BUC60902", "BUC60902", __FILE__, BUC60902, group);
-  theCommands.Add ("BUC60944", "BUC60944 path", __FILE__, BUC60944, group);
-  theCommands.Add ("BUC60868", "BUC60868 Result Shell", __FILE__, BUC60868, group);
-  theCommands.Add ("BUC60924", "BUC60924 curve X Y Z", __FILE__, BUC60924, group);
-  theCommands.Add ("BUC60920", "BUC60920", __FILE__, BUC60920, group);
-  theCommands.Add ("OCC983", "OCC983 file", __FILE__, OCC983, group);
-  theCommands.Add ("OCC984", "OCC984 file", __FILE__, OCC984, group);
-
-  theCommands.Add ("OCC1786", "OCC1786 AutoHilight=0/1", __FILE__, OCC1786, group);
-
-//  theCommands.Add ("OCC1723", "OCC1723", __FILE__, OCC1723, group);
-
-  theCommands.Add ("OCC1919_get", "OCC1919_get", __FILE__, OCC1919_get, group);
-
-  theCommands.Add ("OCC1919_set", "OCC1919_set LC_NUMERIC", __FILE__, OCC1919_set, group);
-
-  theCommands.Add ("OCC1919_real", "OCC1919_real (DF, entry, value)", __FILE__, OCC1919_real, group);
-
-  theCommands.Add ("OCC2932_SetIDUAttribute", "OCC2932_SetIDUAttribute (DF, entry, oldLocalID, newLocalID)", __FILE__, OCC2932_SetIDUAttribute, group);
-
-  theCommands.Add ("OCC2932_SetTag", "OCC2932_SetTag (DF, entry, Tag)", __FILE__, OCC2932_SetTag, group);
-
-  theCommands.Add ("OCC2932_SetCurrent", "OCC2932_SetCurrent (DF, entry)", __FILE__, OCC2932_SetCurrent, group);
-
-  theCommands.Add ("OCC2932_SetExpression", "OCC2932_SetExpression (DF, entry, Expression)", __FILE__, OCC2932_SetExpression, group);
-
-  theCommands.Add ("OCC2932_SetRelation", "OCC2932_SetRelation (DF, entry, Relation)", __FILE__, OCC2932_SetRelation, group);
-
-  theCommands.Add ("OCC3277", "OCC3277 string", __FILE__, OCC3277, group);
-
-  theCommands.Add ("OCC6794", "OCC6794 [nb]", __FILE__, OCC6794, group);
-
-  theCommands.Add ("OCC16485", "OCC16485", __FILE__, OCC16485, group);
-
-  return;
-}
diff --git a/src/QARoutelous/QARoutelous.cdl b/src/QARoutelous/QARoutelous.cdl
deleted file mode 100755 (executable)
index 412c535..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
--- Created on: 2002-04-09
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QARoutelous
-     uses Draw,
-          AIS,
-          SelectMgr,
-          Prs3d,
-          PrsMgr
-is
-    class PresentableObject;
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QARoutelous/QARoutelous.cxx b/src/QARoutelous/QARoutelous.cxx
deleted file mode 100755 (executable)
index 77b06bf..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-// Created on: 2002-04-09
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QARoutelous.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <QARoutelous_PresentableObject.hxx>
-
-Handle(QARoutelous_PresentableObject) theObject1=NULL;
-Handle(QARoutelous_PresentableObject) theObject2=NULL;
-
-static Standard_Integer BUC60720 (Draw_Interpretor& di,Standard_Integer argc,const char ** argv )
-{
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " 0/1" << "\n";
-  }
-
-  if(atoi(argv[1]) == 0) {
-    if ( theObject1.IsNull() )
-      {
-       theObject1 = new QARoutelous_PresentableObject();
-       theObject1->SetDisplayMode(0);
-       myAISContext->Display(theObject1);
-      }
-  } else if(atoi(argv[1]) == 1) {
-    if ( theObject2.IsNull() )
-      {
-       theObject2 = new QARoutelous_PresentableObject();
-       theObject2->SetDisplayMode(1);
-       myAISContext->Display(theObject2);
-      }
-  } else {
-    di << "Usage : " << argv[0] << " 0/1" << "\n";
-    return -1;
-  }
-  return 0;
-}
-
-void QARoutelous::Commands(Draw_Interpretor& theCommands)
-{
-  char *group = "QARoutelous";
-  theCommands.Add("BUC60720","BUC60720 0/1",__FILE__,BUC60720,group);
-}
diff --git a/src/QARoutelous/QARoutelous_PresentableObject.cdl b/src/QARoutelous/QARoutelous_PresentableObject.cdl
deleted file mode 100755 (executable)
index 33fde7a..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
--- Created on: 2002-04-09
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-class PresentableObject from QARoutelous inherits InteractiveObject from AIS
-uses
-    Selection from SelectMgr,
-    PresentationManager3d from PrsMgr,
-    Presentation from Prs3d,
-    TypeOfPresentation3d from PrsMgr
-is
-    
-    Create(aTypeOfPresentation3d: TypeOfPresentation3d from PrsMgr = PrsMgr_TOP_AllView) returns mutable PresentableObject from QARoutelous;
-    
-    ComputeSelection(me:mutable; aSelection :mutable Selection from SelectMgr;
-                                 aMode      : Integer) is redefined virtual protected;
-
-    Compute(me:mutable;
-           aPresentationManager: PresentationManager3d from PrsMgr;
-            aPresentation: mutable Presentation from Prs3d;
-            aMode: Integer from Standard = 0)
-    is redefined virtual protected;
-           
-end PresentableObject;
-    
diff --git a/src/QARoutelous/QARoutelous_PresentableObject.cxx b/src/QARoutelous/QARoutelous_PresentableObject.cxx
deleted file mode 100755 (executable)
index b6790f8..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-// Created on: 2002-04-09
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QARoutelous_PresentableObject.ixx>
-#include <QARoutelous_PresentableObject.hxx>
-
-#include <Graphic3d_Group.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Aspect_Array1OfEdge.hxx>
-#include <Graphic3d_VertexC.hxx>
-#include <Graphic3d_VertexNC.hxx>
-#include <Graphic3d_Array1OfVertexC.hxx>
-#include <Graphic3d_Array1OfVertexNC.hxx>
-#include <AIS_Drawer.hxx>
-
-QARoutelous_PresentableObject::QARoutelous_PresentableObject(const PrsMgr_TypeOfPresentation3d aTypeOfPresentation3d)
-     :AIS_InteractiveObject(aTypeOfPresentation3d)
-{
-}
-
-void QARoutelous_PresentableObject::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
-                               const Handle(Prs3d_Presentation)& aPresentation,
-                               const Standard_Integer aMode )
-{
-  Handle(Graphic3d_Structure) theStructure = Handle(Graphic3d_Structure)::DownCast(aPresentation);
-  Handle(Graphic3d_Group) theGroup= new  Graphic3d_Group(theStructure);
-  Handle_Prs3d_ShadingAspect theAspect = myDrawer->ShadingAspect();
-  Graphic3d_MaterialAspect mat = theAspect->Aspect()->FrontMaterial();
-  mat.SetReflectionModeOff(Graphic3d_TOR_AMBIENT);
-  mat.SetReflectionModeOff(Graphic3d_TOR_DIFFUSE);
-  mat.SetReflectionModeOff(Graphic3d_TOR_SPECULAR);
-  mat.SetReflectionModeOff(Graphic3d_TOR_EMISSION);
-  theAspect->SetMaterial(mat);
-  theGroup->SetPrimitivesAspect(theAspect->Aspect());
-  
-  Aspect_Array1OfEdge aListEdge(1, 3);
-  aListEdge.SetValue(1, Aspect_Edge(1, 2, Aspect_TOE_VISIBLE));
-  aListEdge.SetValue(2, Aspect_Edge(2, 3, Aspect_TOE_VISIBLE));
-  aListEdge.SetValue(3, Aspect_Edge(3, 1, Aspect_TOE_VISIBLE));
-  theGroup->BeginPrimitives();
-
-  switch (aMode) 
-    {
-    case 0://using VertexC
-      {
-       Graphic3d_Array1OfVertexC theArray1(1, 3);
-
-       theArray1.SetValue(1, Graphic3d_VertexC(0,0,0,Quantity_NOC_RED));
-       theArray1.SetValue(2, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
-       theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
-       theGroup->TriangleSet(theArray1, aListEdge);
-       
-       theArray1.SetValue(1, Graphic3d_VertexC(0,5,1,Quantity_NOC_BLUE1));
-       theArray1.SetValue(2, Graphic3d_VertexC(5,5,-1,Quantity_NOC_GREEN));
-       theArray1.SetValue(3, Graphic3d_VertexC(5,0,1,Quantity_NOC_YELLOW));
-       theGroup->TriangleSet(theArray1, aListEdge);
-      }
-      break;
-    case 1://using VertexNC
-      {
-       Graphic3d_Array1OfVertexNC theArray1(1, 3);
-       
-       theArray1.SetValue(1, Graphic3d_VertexNC(5,0,0, //coord
-                                                0,0,1, //normal
-                                                Quantity_NOC_RED));
-       theArray1.SetValue(2, Graphic3d_VertexNC(5,5,1, //coord
-                                                1,1,1, //normal
-                                                Quantity_NOC_BLUE1));
-       theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
-                                                0,1,1,  //normal
-                                                Quantity_NOC_YELLOW));
-       theGroup->TriangleSet(theArray1, aListEdge);
-       
-       theArray1.SetValue(1, Graphic3d_VertexNC(5,5,1, //coord
-                                                1,1,1, //normal
-                                                Quantity_NOC_BLUE1));
-       theArray1.SetValue(2, Graphic3d_VertexNC(10,5,-1, //coord
-                                                0,0,-1,  //normal
-                                                Quantity_NOC_GREEN));
-       theArray1.SetValue(3, Graphic3d_VertexNC(10,0,1, //coord
-                                                0,1,1,  //normal
-                                                Quantity_NOC_YELLOW));
-       theGroup->TriangleSet(theArray1, aListEdge);
-      }
-      break;
-    }
-  theGroup->EndPrimitives();
-  
-}
-
-void QARoutelous_PresentableObject::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
-                                        const Standard_Integer aMode) {
-}
diff --git a/src/QASamtech/QASamtech.cdl b/src/QASamtech/QASamtech.cdl
deleted file mode 100755 (executable)
index ade41f8..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
--- Created on: 2002-03-18
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QASamtech
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
-    
diff --git a/src/QASamtech/QASamtech.cxx b/src/QASamtech/QASamtech.cxx
deleted file mode 100755 (executable)
index 2c591d3..0000000
+++ /dev/null
@@ -1,881 +0,0 @@
-// Created on: 2002-03-18
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QASamtech.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <GProp_GProps.hxx>
-#include <BRepGProp.hxx>
-#include <TopoDS_Edge.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <AIS_Trihedron.hxx>
-#include <Geom_Axis2Placement.hxx>
-#include <gp_Ax2.hxx>
-#include <Geom_Circle.hxx>
-#include <AIS_Circle.hxx>
-#include <V3d_View.hxx>
-#include <TopoDS.hxx>
-#include <Geom_Plane.hxx>
-#include <gp_Pln.hxx>
-#include <AIS_AngleDimension.hxx>
-
-#include <TopExp_Explorer.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <GC_MakePlane.hxx>
-#include <AIS_PlaneTrihedron.hxx>
-#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
-
-#include <BRep_Tool.hxx>
-#include <Geom_BSplineCurve.hxx>
-#include <GeomConvert_CompCurveToBSplineCurve.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <Precision.hxx>
-
-#include <GProp_PrincipalProps.hxx>
-
-#include <OSD_Path.hxx>
-#include <Standard_ProgramError.hxx>
-
-//#include <QAModTopOpe_Limitation.hxx>
-#include <QANewModTopOpe_Limitation.hxx>
-
-//#include <QAModTopOpe_Glue.hxx>
-#include <QANewModTopOpe_Glue.hxx>
-
-#include <ShapeFix_Wireframe.hxx>
-#include <ShapeBuild_ReShape.hxx>
-
-#include <ViewerTest_Tool.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-
-//#include <QAModTopOpe_ReShaper.hxx>
-#include <QANewModTopOpe_ReShaper.hxx>
-
-#include <ViewerTest_EventManager.hxx>
-
-#include <TColgp_Array1OfPnt2d.hxx>
-
-#include <DDocStd.hxx>
-#include <TDocStd_Document.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-#if ! defined(WNT)
-extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#else
-Standard_EXPORT ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
-#endif
-
-static Standard_Integer BUC60848 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 2 ) {
-    di << "Usage : " << argv[0] << " shape " << "\n";
-    return 1;
-  }
-  TopoDS_Shape S = DBRep::Get( argv[1] );
-  if ( S.IsNull() ) {
-    di << "Shape is empty" << "\n";
-    return 1;
-  }
-  GProp_GProps G;
-  BRepGProp::VolumeProperties( S,G );
-  Standard_Real GRes;
-  GRes = G.Mass();
-  if ( GRes < 0 ) {
-    di << "Result is negative : " << GRes << "\n";
-    return 1;
-  } else {
-    di << "Volume : " << GRes << "\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer BUC60828 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge(gp_Pnt(0.,0.,0.), gp_Pnt(0.,0.,1.)); 
-  Standard_Boolean aValue; 
-  aValue=anEdge.Infinite(); 
-  di << "Initial flag : " << (Standard_Integer) aValue << "\n";
-  anEdge.Infinite(Standard_True); 
-  Standard_Boolean aValue1; 
-  aValue1=anEdge.Infinite(); 
-  di << "Current flag : " << (Standard_Integer) aValue1 << "\n";
-  if(aValue1) di << "Flag was set properly." << "\n";
-  else di << "Faulty : flag was not set properly." << "\n";
-  return 0;
-}
-
-static Standard_Integer  BUC60814(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  
-  // TRIHEDRON
-  Handle(AIS_Trihedron) aTrihedron;
-  Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
-  aTrihedron=new AIS_Trihedron(aTrihedronAxis);
-  myAISContext->Display(aTrihedron);
-  
-  //Circle
-  gp_Pnt P(10,10,10);
-  gp_Dir V(1,0,0);
-  gp_Ax2 aAx2(P,V);
-  
-  Handle(Geom_Circle) ahCircle=new Geom_Circle(aAx2,20);
-  Handle(AIS_Circle)   aCircle=new AIS_Circle(ahCircle);
-  myAISContext->Display(aCircle);
-    
-  myAISContext->SelectionColor(Quantity_NOC_BLUE1);
-  
-  myAISContext->AddOrRemoveSelected(aTrihedron);
-  myAISContext->AddOrRemoveSelected(aCircle);
-  
-  return 0;
-}
-
-static Standard_Integer  BUC60774(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return -1;
-  }
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  
-  double Xc,Yc,Width, Height;
-  myV3dView->Center(Xc,Yc);
-  myV3dView-> Size (Width, Height);
-  
-  double Xmin,Ymin;
-  Xmin=Xc-Width/2;
-  Ymin=Yc-Height/2;
-  double Xmax,Ymax;
-  Xmax=Xc+Width/2;
-  Ymax=Yc+Height/2;
-    
-  Standard_Integer XPmin,YPmin;
-  myV3dView->Convert(Xmin,Ymin,XPmin,YPmin);
-//  cout<<Xmin<<"\t"<<Ymin<<endl;
-//  cout<<XPmin<<"\t"<<YPmin<<endl;
-
-  Standard_Integer XPmax,YPmax;
-  myV3dView->Convert(Xmax,Ymax,XPmax,YPmax);
-//  cout<<Xmax<<"\t"<<Ymax<<endl;
-//  cout<<XPmax<<"\t"<<YPmax<<endl;
-  
-  AIS_StatusOfPick status;
-  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_NothingSelected)
-             di << "status = AIS_SOP_NothingSelected : OK"   << "\n";
-  else       di << "status = AIS_SOP_NothingSelected : bugged - Faulty "   << "\n";
-  
-  di.Eval("box b 10 10 10");
-  di.Eval(" vdisplay b");
-
-  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_OneSelected)
-             di << "status = AIS_SOP_OneSelected : OK"   << "\n";
-  else       di << "status = AIS_SOP_OneSelected : bugged - Faulty "   << "\n";
-
-  di.Eval("box w 20 20 20 20 20 20");
-  di.Eval(" vdisplay w");
-
-  if ((status=myAISContext->Select(XPmin,YPmin,XPmax,YPmax,myV3dView))==AIS_SOP_SeveralSelected)
-             di << "status = AIS_SOP_SeveralSelected : OK"   << "\n";
-  else       di << "status = AIS_SOP_SeveralSelected : bugged - Faulty "   << "\n";
-  
-  return 0;
-
-}  
-
-static Standard_Integer BUC60972 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  if(argc != 6) {
-    di << "Usage : " << argv[0] << " edge edge plane val text" << "\n";
-    return 1;
-  }
-  
-  TopoDS_Edge aFirst = TopoDS::Edge(DBRep::Get(argv[1],TopAbs_EDGE));
-  TopoDS_Edge aSecond = TopoDS::Edge(DBRep::Get(argv[2],TopAbs_EDGE));
-  Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(DrawTrSurf::GetSurface(argv[3]));
-  if(aPlane.IsNull())
-    return 1;
-  
-  di << aPlane->Pln().SquareDistance( gp_Pnt(0,0,0) ) << "\n";
-  
-  TCollection_ExtendedString aText(argv[5]);
-  //Standard_ExtString ExtString_aText = aText.ToExtString();
-  //di << ExtString_aText << " " << atof(argv[4]) << "\n";
-  di << argv[5] << " " << atof(argv[4]) << "\n";
-  
-  Handle(AIS_AngleDimension) aDim = new AIS_AngleDimension(aFirst, aSecond, aPlane, atof(argv[4]), aText);
-  aContext->Display(aDim);                                                         
-  
-  return 0;
-}
-
-static Standard_Integer OCC218bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  if(argc != 5) {
-    di << "Usage : " << argv[0] << " name plane Xlabel Ylabel" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape S = DBRep::Get( argv[2] );
-  if ( S.IsNull() ) {
-    di << "Shape is empty" << "\n";
-    return 1;
-  }
-
-  TCollection_AsciiString name(argv[1]);
-  TCollection_AsciiString Xlabel(argv[3]);
-  TCollection_AsciiString Ylabel(argv[4]);
-  
-  // Construction de l'AIS_PlaneTrihedron
-  Handle(AIS_PlaneTrihedron) theAISPlaneTri;
-
-  Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
-  if (IsBound) {
-    // on recupere la shape dans la map des objets displayes
-    Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
-      
-    // On verifie que l'AIS InteraciveObject est bien 
-    // un AIS_PlaneTrihedron
-    if (aShape->Type()==AIS_KOI_Datum && aShape->Signature()==4) {
-      // On downcast aShape de AIS_InteractiveObject a AIS_PlaneTrihedron
-      theAISPlaneTri = *(Handle(AIS_PlaneTrihedron)*) &aShape;
-
-      theAISPlaneTri->SetXLabel(Xlabel);
-      theAISPlaneTri->SetYLabel(Ylabel);
-  
-      aContext->Redisplay(theAISPlaneTri, Standard_False);
-      aContext->UpdateCurrentViewer();
-    }
-  } else {
-    TopoDS_Face  FaceB=TopoDS::Face(S);
-  
-    // Construction du Plane
-    // recuperation des edges des faces.
-    TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
-  
-    TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
-    // declarations 
-    gp_Pnt A,B,C;
-  
-    // si il y a plusieurs edges
-    if (FaceExpB.More() ) {
-      FaceExpB.Next();
-      TopoDS_Edge EdgeC=TopoDS::Edge(FaceExpB.Current() );
-      BRepAdaptor_Curve theCurveB(EdgeB);
-      BRepAdaptor_Curve theCurveC(EdgeC);
-      A=theCurveC.Value(0.1);
-      B=theCurveC.Value(0.9);
-      C=theCurveB.Value(0.5);
-    }
-    else {
-      // FaceB a 1 unique edge courbe
-      BRepAdaptor_Curve theCurveB(EdgeB);
-      A=theCurveB.Value(0.1);
-      B=theCurveB.Value(0.9);
-      C=theCurveB.Value(0.5);
-    }
-    // Construction du Geom_Plane
-    GC_MakePlane MkPlane(A,B,C);
-    Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
-    
-    // on le display & bind
-    theAISPlaneTri= new AIS_PlaneTrihedron(theGeomPlane );
-    
-    theAISPlaneTri->SetXLabel(Xlabel);
-    theAISPlaneTri->SetYLabel(Ylabel);
-    
-    GetMapOfAIS().Bind ( theAISPlaneTri, name);
-    aContext->Display(theAISPlaneTri );
-  }
-  return 0;
-}
-
-static Standard_Integer OCC295(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 4) {
-    di << "Usage : " << argv[0] << " edge_result edge1 edge2" << "\n";
-    return 1;
-  }
-  
-  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
-  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
-  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
-  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
-  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
-  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
-  Standard_Real f1,l1,f2,l2;
-  Standard_Boolean After =  Standard_True;
-  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
-  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
-  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
-  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
-  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
-  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
-  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
-  bsplc2->SetPole(1, pmid);
-  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
-  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
-  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
-  if(MkEdge.IsDone()) {
-    TopoDS_Edge nedge = MkEdge.Edge();
-    DBRep::Set ( argv[1], nedge );
-    return 0;
-  }
-  else return 1;
-}
-
-static Standard_Integer OCC49 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-
-  if ( argc != 2 ) {
-    di << "Usage : " << argv[0] << " name" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape S = DBRep::Get(argv[1]);
-  if (S.IsNull()) return 0;
-
-  GProp_GProps G;
-  BRepGProp::VolumeProperties(S,G);
-  GProp_PrincipalProps Pr = G.PrincipalProperties();
-  Standard_Boolean Result = Pr.HasSymmetryAxis();
-  if (Result) {
-    di << "1" << "\n";
-  } else {
-    di << "0" << "\n";
-  }
-  return 0;
-}
-
-static Standard_Integer OCC132 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  /*
-     OCC132:
-     =======
-
-     ... the validation of the name of files in Analyse_DOS and Analyse_UNIX is : 
-
-     characters not allowed in DOS/WNT names are 
-     / 
-     : 
-     * 
-     ? 
-     " 
-     < 
-     > 
-     | 
-     and  more than one dot in filename.
-     */
-
-  if ( argc != 2 ) {
-    di << "Usage : " << argv[0] << " DependentName" << "\n";
-    return 1;
-  }
-
-  OSD_SysType SysType1 = OSD_OS2;
-  OSD_SysType SysType2 = OSD_WindowsNT;
-
-  {
-    try {
-      OCC_CATCH_SIGNALS
-      OSD_Path Path (argv[1], SysType1);
-    }
-    catch (Standard_ProgramError) {
-      di << "1" << "\n";
-      return 0;
-    }
-  }
-
-  {
-    try {
-      OCC_CATCH_SIGNALS
-      OSD_Path Path (argv[1], SysType2);
-    }
-    catch (Standard_ProgramError) {
-      di << "2" << "\n";
-      return 0;
-    }
-  }
-  
-  di << "0" << "\n";
-  return 0;
-}
-
-static Standard_Integer OCC405 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 4) {
-    di << "Usage : " << argv[0] << " edge_result edge1 edge2; merge two edges" << "\n";
-    return 1;
-  }
-  
-  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
-  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
-  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
-  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
-  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
-  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
-  Standard_Real f1,l1,f2,l2;
-  Standard_Boolean After =  Standard_True;
-  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
-  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
-  if(e1.Orientation() == TopAbs_REVERSED) {
-    Standard_Real cf = f1;
-      f1 = ac1->ReversedParameter ( l1 );
-      l1 = ac1->ReversedParameter ( cf );
-      ac1 = ac1->Reversed();
-    }
-    if(e2.Orientation() == TopAbs_REVERSED) {
-      Standard_Real cf = f2;
-      f2 = ac2->ReversedParameter ( l2 );
-      l2 = ac2->ReversedParameter ( cf );
-      ac2 = ac2->Reversed();
-    }
-  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
-  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
-  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
-  if(bsplc1->FirstParameter() < f1 - Precision::PConfusion() || 
-     bsplc1->LastParameter() > l1 + Precision::PConfusion()) {
-    Handle(Geom_BSplineCurve) aBstmp  = Handle(Geom_BSplineCurve)::DownCast(bsplc1->Copy());
-    aBstmp->Segment(f1,l1);
-    gp_Pnt p1 = aBstmp->Pole(1);
-    gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
-    bsplc1 =aBstmp; 
-  }
-  if(bsplc2->FirstParameter() < f2 - Precision::PConfusion() || 
-     bsplc2->LastParameter() > l2 + Precision::PConfusion()) {
-    Handle(Geom_BSplineCurve) aBstmp  = Handle(Geom_BSplineCurve)::DownCast(bsplc2->Copy());
-    aBstmp->Segment(f2,l2);
-    gp_Pnt p1 = aBstmp->Pole(1);
-    gp_Pnt p2 = aBstmp->Pole(aBstmp->NbPoles());
-    bsplc2 =aBstmp; 
-  }
-  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
-  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
-  bsplc2->SetPole(1, pmid);
-  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
-  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
-  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
-  if(MkEdge.IsDone()) {
-    TopoDS_Edge nedge = MkEdge.Edge();
-    DBRep::Set ( argv[1], nedge );
-    return 0;
-  }
-  else return 1;
-}
-
-static Standard_Integer OCC252 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(!(argc == 4 || argc == 5)) {
-    di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n";
-    return 1;
-  }
-  
-  TopoDS_Shape s1 = DBRep::Get(argv[2]);
-  TopoDS_Shape s2 = DBRep::Get(argv[3]);
-  if (s1.IsNull() || s2.IsNull()) return 1;
-
-  //QAModTopOpe_ModeOfLimitation ModeOfLimitation = QAModTopOpe_Forward;
-  QANewModTopOpe_ModeOfLimitation ModeOfLimitation = QANewModTopOpe_Forward;
-  if(argc==5) {
-    Standard_Integer ModeOfLimitationInteger = atoi(argv[4]);
-    if(!(ModeOfLimitationInteger == 0 || ModeOfLimitationInteger == 1 || ModeOfLimitationInteger == 2)) {
-      di << "Usage : " << argv[0] << " result part tool [ModeOfLimitation=0/1/2]" << "\n";
-      return 1;
-    }
-    //if (ModeOfLimitationInteger == 1) ModeOfLimitation = QAModTopOpe_Reversed;
-    //if (ModeOfLimitationInteger == 2) ModeOfLimitation = QAModTopOpe_BothParts;
-    if (ModeOfLimitationInteger == 1) ModeOfLimitation = QANewModTopOpe_Reversed;
-    if (ModeOfLimitationInteger == 2) ModeOfLimitation = QANewModTopOpe_BothParts;
-  }
-
-  //TopoDS_Shape res = QAModTopOpe_Limitation(s1,s2,ModeOfLimitation);
-  TopoDS_Shape res = QANewModTopOpe_Limitation(s1,s2,ModeOfLimitation);
-  if (res.IsNull()) {
-    di << "Error : result is null" << "\n";
-    return 1;
-  }
-
-  DBRep::Set(argv[1],res);
-
-  return 0;
-}
-
-static Standard_Integer OCC307 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(!(argc == 4 || argc == 5)) {
-    di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n";
-    return 1;
-  }
-  
-  TopoDS_Shape s1 = DBRep::Get(argv[2]);
-  TopoDS_Shape s2 = DBRep::Get(argv[3]);
-  if (s1.IsNull() || s2.IsNull()) return 1;
-
-  Standard_Boolean AllowCutting = Standard_False;
-  if(argc==5) {
-    Standard_Integer AllowCuttingInteger = atoi(argv[4]);
-    if(!( AllowCuttingInteger == 0 || AllowCuttingInteger == 1)) {
-      di << "Usage : " << argv[0] << " result part tool [AllowCutting=0/1]" << "\n";
-      return 1;
-    }
-    if (AllowCuttingInteger == 1) AllowCutting = Standard_True;
-  }
-
-  //TopoDS_Shape res = QAModTopOpe_Glue(s1,s2,AllowCutting);
-  TopoDS_Shape res = QANewModTopOpe_Glue(s1,s2,AllowCutting);
-  if (res.IsNull()) {
-    di << "Error : result is null" << "\n";
-    return 1;
-  }
-
-  DBRep::Set(argv[1],res);
-
-  return 0;
-}
-
-static Standard_Integer OCC395 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 4) {
-    di << "Usage : " << argv[0] << " edge_result edge1 edge2" << "\n";
-    return 1;
-  }
-  //TCollection_AsciiString fnom(a[1]);
-  //Standard_Boolean modfic = XSDRAW::FileAndVar(a[1],a[2],a[3],"IGES",fnom,rnom,resnom);
-  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
-  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
-  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
-  if(Sh1.ShapeType() != TopAbs_EDGE || Sh2.ShapeType() != TopAbs_EDGE) return 1;
-  TopoDS_Edge e1 = TopoDS::Edge(Sh1);
-  TopoDS_Edge e2 = TopoDS::Edge(Sh2);
-  Standard_Real f1,l1,f2,l2;
-  Standard_Boolean After =  Standard_True;
-  Handle(Geom_Curve) ac1 = BRep_Tool::Curve(e1,f1,l1);
-  Handle(Geom_Curve) ac2 = BRep_Tool::Curve(e2,f2,l2);
-  if(e1.Orientation() == TopAbs_REVERSED) {
-      //Standard_Real cf = cf1;
-      //cf1 = ac1->ReversedParameter ( cl1 );
-      //cl1 = ac1->ReversedParameter ( cf );
-      ac1 = ac1->Reversed();
-    }
-    if(e2.Orientation() == TopAbs_REVERSED) {
-      //Standard_Real cf = cf2;
-      //ac2 = ac2->ReversedParameter ( cl2 );
-      //ac2 = ac2->ReversedParameter ( cf );
-      ac2 = ac2->Reversed();
-    }
-  Handle(Geom_BSplineCurve) bsplc1 = Handle(Geom_BSplineCurve)::DownCast(ac1);
-  Handle(Geom_BSplineCurve) bsplc2 = Handle(Geom_BSplineCurve)::DownCast(ac2);
-  if(bsplc1.IsNull() || bsplc2.IsNull()) return 1;
-  gp_Pnt pmid = 0.5 * ( bsplc1->Pole(bsplc1->NbPoles()).XYZ() + bsplc2->Pole(1).XYZ() );
-  bsplc1->SetPole(bsplc1->NbPoles(), pmid);
-  bsplc2->SetPole(1, pmid);
-  GeomConvert_CompCurveToBSplineCurve connect3d(bsplc1);
-  if(!connect3d.Add(bsplc2,Precision::Confusion(), After, Standard_False)) return 1;
-  BRepBuilderAPI_MakeEdge MkEdge(connect3d.BSplineCurve());
-  if(MkEdge.IsDone()) {
-    TopoDS_Edge nedge = MkEdge.Edge();
-    DBRep::Set ( argv[1], nedge );
-    return 0;
-  }
-  else return 1;
-}
-
-static Standard_Integer OCC394 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc < 3) {
-    di << "Usage : " << argv[0] << " edge_result edge [tol [mode [tolang]]]" << "\n";
-    return 1;
-  }
-   TopoDS_Shape Sh = DBRep::Get(argv[2]);
-   Standard_Integer k = 3;
-   Standard_Real tol = 100000;
-   Standard_Integer mode = 2;
-   Standard_Real tolang = M_PI/2;
-   if(argc > k) 
-     tol = atof(argv[k++]);
-   
-   if(argc > k) 
-     mode=  atoi(argv[k++]);
-   
-   if(argc > k) 
-     tolang = atof(argv[k++]);
-     
-   
-   Handle(ShapeFix_Wireframe) aSfwr = new ShapeFix_Wireframe();
-   Handle(ShapeBuild_ReShape) aReShape = new ShapeBuild_ReShape;
-   aSfwr->SetContext(aReShape);
-   aSfwr->Load(Sh);
-   aSfwr->SetPrecision(tol);
-   Standard_Boolean aModeDrop = Standard_True;
-   if(mode == 2) 
-     aModeDrop = Standard_False;
-   
-    TopTools_MapOfShape theSmallEdges, theMultyEdges;
-  TopTools_DataMapOfShapeListOfShape theEdgeToFaces,theFaceWithSmall;
-  aSfwr->CheckSmallEdges(theSmallEdges,theEdgeToFaces,theFaceWithSmall, theMultyEdges);
-  aSfwr->MergeSmallEdges (theSmallEdges,theEdgeToFaces,theFaceWithSmall, theMultyEdges, aModeDrop,tolang);
-   //aSfwr->FixSmallEdges(); 
-  TopoDS_Shape resShape =  aSfwr->Shape();;
-  DBRep::Set ( argv[1], resShape );
-  return 0;
-}
-
-static Standard_Integer OCC301 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  //Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("OCC301");
-  //ViewerTest_Tool::InitViewerTest (context);
-  Handle(AIS_InteractiveContext) context = ViewerTest::GetAISContext();
-  if(context.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  if ( argc != 5 ) {
-    di << "Usage : " << argv[0] << " X Y Z ArrowSize" << "\n";
-    return 1;
-  }
-
-  Standard_Real X = atof(argv[1]);
-  Standard_Real Y = atof(argv[2]);
-  Standard_Real Z = atof(argv[3]);
-  Standard_Real ArrowSize = atof(argv[4]);
-
-  gp_Pnt p1 = gp_Pnt(10.,10.,0.);
-  gp_Pnt p2 = gp_Pnt(50.,10.,0.);
-  gp_Pnt p3 = gp_Pnt(50.,50.,0.);
-
-  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(p1, p2);
-  TopoDS_Edge E2 = BRepBuilderAPI_MakeEdge(p2, p3);
-
-  context->Display(new AIS_Shape(E1)); 
-  context->Display(new AIS_Shape(E2)); 
-
-  gp_Pnt plnpt(0, 0, 0);
-  gp_Dir plndir(0, 0, 1);
-  Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
-
-  Handle(AIS_AngleDimension) AngleDimension = new AIS_AngleDimension(E2, E1, pln, -3.14/2., "Angle");
-
-  AngleDimension->SetPosition(gp_Pnt(X, Y, Z));
-  AngleDimension->SetArrowSize(ArrowSize);
-
-  context->Display(AngleDimension);
-  return 0;
-}
-
-static Standard_Integer OCC294 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc < 4) {
-    di << "Usage : " << argv[0] << " shape_result shape edge" << "\n";
-    return 1;
-  }
-  TopoDS_Shape Sh1 = DBRep::Get(argv[2]);
-  TopoDS_Shape Sh2 = DBRep::Get(argv[3]);
-  if(Sh1.IsNull() || Sh2.IsNull()) return 1;
-  if(Sh2.ShapeType() != TopAbs_EDGE) return 1;
-
-  //QAModTopOpe_ReShaper ReShaper(Sh1);
-  QANewModTopOpe_ReShaper ReShaper(Sh1);
-  ReShaper.Remove(Sh2);
-  const TopoDS_Shape& ResultShape = ReShaper.GetResult();
-  if(ResultShape.IsNull()) {
-    di << "Faulty " << argv[0] << " : " << argv[1] << " - shape_result is null" << "\n";
-    return 1;
-  }
-
-  DBRep::Set ( argv[1], ResultShape);
-  return 0;
-}
-
-static Standard_Integer OCC60 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  if(argc < 5) {
-    di << "Usage : " << argv[0] << " xmin ymin xmax ymax; selection window" << "\n";
-    return 1;
-  }
-
-  Standard_Integer xmin = atoi(argv[1]);
-  Standard_Integer ymin = atoi(argv[2]);
-  Standard_Integer xmax = atoi(argv[3]);
-  Standard_Integer ymax = atoi(argv[4]);
-
-  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
-
-  Handle(ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
-  EM->Select(xmin,ymin,xmax,ymax);
-
-  return 0;
-}
-
-static Standard_Integer OCC70 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  if(argc < 7) {
-    di << "Usage : " << argv[0] << " x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection" << "\n";
-    return 1;
-  }
-  if (((argc - 1) % 2) != 0) {
-    di << "Usage : " << argv[0] << " x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection" << "\n";
-    return 1;
-  }
-
-  Standard_Integer i, j, np = (argc-1) / 2;
-  TColgp_Array1OfPnt2d Polyline(1,np);
-  j = 1;
-  for (i = 1; i <= np; i++) {
-    Polyline(i) = gp_Pnt2d(atof(argv[j]), atof(argv[j+1]));
-    j += 2;
-  }
-
-  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
-
-  aContext->Select(Polyline,V3dView);
-  aContext->UpdateCurrentViewer();
-
-  return 0;
-}
-
-static Standard_Integer OCC261 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " Doc" << "\n";
-    return 1;
-  }
-
-  Handle(TDocStd_Document) Doc;
-  if(DDocStd::GetDocument(argv[1], Doc)) {
-    Doc->ClearRedos();
-    return 0;
-  } else
-    return 1;
-}
-
-#include <OSD_File.hxx>
-static Standard_Integer OCC710 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 2) {
-    di << "Usage : " << argv[0] << " path" << "\n";
-  }
-
-  TCollection_AsciiString in(argv[1]);
-  OSD_File* aFile = new OSD_File(in);
-  Standard_Boolean anExists = aFile->Exists();
-  if(anExists == Standard_True) 
-    di << "1" << "\n";
-  else
-    di << "0" << "\n";
-  return 0;
-}
-
-#include <ShapeFix_Shell.hxx>
-static Standard_Integer OCC904 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc != 4) {
-    di << "Usage : " << argv[0] << " result shape nonmanifoldmode(0/1)" << "\n";
-  }
-  TopoDS_Shape S = DBRep::Get(argv[2]);
-  if (S.IsNull() || S.ShapeType() != TopAbs_SHELL) {
-    di << " Shape is null" << "\n";
-    return 1;
-  }
-  Standard_Boolean nonmanifmode = (atoi(argv[3]) != 0);
-  Handle(ShapeFix_Shell) SFSh = new ShapeFix_Shell;
-  SFSh->FixFaceOrientation(TopoDS::Shell(S),Standard_True,nonmanifmode);
-  DBRep::Set(argv[1],SFSh->Shape());
-  return 0;
-}
-
-void QASamtech::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QASamtech";
-
-  theCommands.Add ("BUC60848", "BUC60848 shape", __FILE__, BUC60848, group);
-  theCommands.Add ("BUC60828", "BUC60828", __FILE__, BUC60828, group);
-  theCommands.Add ("BUC60814", "BUC60814", __FILE__, BUC60814, group);
-  theCommands.Add ("BUC60774", "BUC60774", __FILE__, BUC60774, group);
-  theCommands.Add ("BUC60972", "BUC60972 edge edge plane val text ", __FILE__, BUC60972, group);
-  theCommands.Add ("OCC218", "OCC218 name plane Xlabel Ylabel", __FILE__, OCC218bug, group);
-  theCommands.Add ("OCC295", "OCC295 edge_result edge1 edge2", __FILE__, OCC295, group);
-  theCommands.Add ("OCC49", "OCC49 name", __FILE__, OCC49, group);
-  theCommands.Add ("OCC132", "OCC132 DependentName", __FILE__, OCC132, group);
-  theCommands.Add ("OCC405", "OCC405 edge_result edge1 edge2; merge two edges", __FILE__, OCC405, group);
-  theCommands.Add ("OCC252", "OCC252 result part tool [ModeOfLimitation=0/1/2]", __FILE__, OCC252, group);
-  theCommands.Add ("OCC307", "OCC307 result part tool [AllowCutting=0/1]", __FILE__, OCC307, group);
-  theCommands.Add ("OCC395", "OCC395 edge_result edge1 edge2", __FILE__, OCC395, group);
-  theCommands.Add ("OCC394", "OCC394 edge_result edge [tol [mode [tolang]]]", __FILE__, OCC394, group);
-  theCommands.Add ("OCC301", "OCC301 X Y Z ArrowSize", __FILE__, OCC301, group);
-  theCommands.Add ("OCC294", "OCC294 shape_result shape edge", __FILE__, OCC294, group);
-  theCommands.Add ("OCC60", "OCC60 xmin ymin xmax ymax; selection window", __FILE__, OCC60, group);
-  theCommands.Add ("OCC70", "OCC70 x1 y1 x2 y2 x3 y3 [x y ...]; polygon of selection", __FILE__, OCC70, group);
-  theCommands.Add ("OCC261", "OCC261 Doc", __FILE__, OCC261, group);
-  theCommands.Add ("OCC710", "OCC710 path", __FILE__, OCC710, group);
-  theCommands.Add ("OCC904", "OCC904 result shape nonmanifoldmode(0/1)", __FILE__, OCC904, group);
-
-  return;
-}
diff --git a/src/QATelco/QATelco.cdl b/src/QATelco/QATelco.cdl
deleted file mode 100755 (executable)
index 0b910ca..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
--- Created on: 2002-03-18
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QATelco
-     uses Draw,
-          gp,
-          TCollection,
-          Quantity,
-          Graphic3d,
-          PrsMgr,
-          Prs3d,
-          SelectMgr,
-          AIS
-is
-    class MyText;
-    
-    Commands(DI : in out Interpretor from Draw);
-end;
-    
diff --git a/src/QATelco/QATelco.cxx b/src/QATelco/QATelco.cxx
deleted file mode 100755 (executable)
index 48b7f89..0000000
+++ /dev/null
@@ -1,2305 +0,0 @@
-// Created on: 2002-03-18
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#if defined(WOKC40)
-#define V2D
-#define Viewer2dTest QAViewer2dTest
-#endif
-
-#include <stdio.h>
-
-#include <QATelco.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <Geom_Circle.hxx>
-#include <Geom_Ellipse.hxx>
-#include <Geom_Plane.hxx>
-#include <gp_Pln.hxx>
-#include <Geom2d_Curve.hxx>
-#include <GeomAPI.hxx>
-#include <Geom2dAdaptor_Curve.hxx>
-#include <Geom2dGcc_QualifiedCurve.hxx>
-#include <Geom2dGcc_Lin2d2Tan.hxx>
-#include <Geom2d_Line.hxx>
-#include <BRepBuilderAPI_MakeEdge.hxx>
-#include <TopoDS_Edge.hxx>
-#include <Precision.hxx>
-#include <Geom2d_Circle.hxx>
-#include <Geom2dGcc_MyQCurve.hxx>
-#include <GccEnt_QualifiedCirc.hxx>
-#include <Geom2dGcc_MyL2d2Tan.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <TopExp_Explorer.hxx>
-#include <TopoDS.hxx>
-#include <TopoDS_Wire.hxx>
-#include <BRep_Tool.hxx>
-#include <gp_Circ.hxx>
-#include <BRepOffsetAPI_MakePipeShell.hxx>
-#include <AIS_Trihedron.hxx>
-#include <Geom_Axis2Placement.hxx>
-#include <V3d_View.hxx>
-#include <ViewerTest_Tool.hxx>
-#include <BRepBuilderAPI_MakeVertex.hxx>
-#include <AIS_LengthDimension.hxx>
-#include <AIS_RadiusDimension.hxx>
-#include <BRepPrimAPI_MakeBox.hxx>
-#include <GeomAdaptor_Surface.hxx>
-#include <Extrema_ExtPS.hxx>
-#include <Geom_CartesianPoint.hxx>
-#include <Geom2d_CartesianPoint.hxx>
-#include <Geom2dGcc_Circ2d3Tan.hxx>
-#include <Aspect_Window.hxx>
-
-#include <TopoDS_Compound.hxx>
-#include <TopoDS_CompSolid.hxx>
-#include <StdSelect_ShapeTypeFilter.hxx>
-
-#include <QATelco_MyText.hxx>
-
-#if defined(WOKC40)
-#include <QAViewer2dTest.hxx>
-#include <QAViewer2dTest_DoubleMapOfInteractiveAndName.hxx>
-#else
-#include <Viewer2dTest.hxx>
-#include <Viewer2dTest_DoubleMapOfInteractiveAndName.hxx>
-#endif
-
-#include <Prs3d_Projector.hxx>
-#include <HLRAlgo_Projector.hxx>
-#include <AIS2D_ProjShape.hxx>
-#include <AIS2D_InteractiveContext.hxx>
-#include <Standard_ErrorHandler.hxx>
-
-#if ! defined(WNT)
-#if defined(WOKC40)
-extern QAViewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
-#else
-extern Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
-#endif
-#else
-Standard_EXPORT Viewer2dTest_DoubleMapOfInteractiveAndName& GetMapOfAIS2D();
-#endif
-
-#include <GGraphic2d_SetOfCurves.hxx>
-#include <Graphic2d_SetOfSegments.hxx>
-
-#include <Graphic3d_NameOfFont.hxx>
-
-static Standard_Integer BUC60842 (Draw_Interpretor& di, Standard_Integer /*argc*/,const char ** /*argv*/)
-{
-  Standard_Character abuf[16];
-  //Standard_Character * abuf = new Standard_Character[16];
-
-  Standard_CString st = abuf;
-
-  Handle(Geom_Circle) cir = new Geom_Circle (gp_Ax2 (gp_Pnt (823.687192, 502.366825, 478.960440), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560)), 50);
-  Handle(Geom_Ellipse) ell = new Geom_Ellipse (gp_Ax2 (gp_Pnt (1262.224429, 425.040878, 363.609716), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560)), 150, 100);
-  Handle(Geom_Plane) plne = new Geom_Plane (gp_Ax3 (gp_Ax2 (gp_Pnt (1262.224429, 425.040878, 363.609716), gp_Dir (0.173648, 0.984808, 0.000000), gp_Dir (-0.932169, 0.164367, -0.322560))));
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-
-  gp_Pln pln = plne->Pln();
-  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d (ell, pln);
-  sprintf(abuf,"ell");
-  DrawTrSurf::Set(st,curve2d);
-  if(!aContext.IsNull()) {
-    Handle(AIS_Shape) aisp = 
-      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
-    aContext->Display (aisp);
-  }
-
-  Handle(Geom2d_Curve) fromcurve2d = GeomAPI::To2d (cir, pln);
-  sprintf(abuf,"cil");
-  DrawTrSurf::Set(st,fromcurve2d);
-  if(!aContext.IsNull()) {
-    Handle(AIS_Shape) aisp = 
-      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(fromcurve2d, pln)).Edge());
-    aContext->Display (aisp);
-  }
-
-  Geom2dAdaptor_Curve acur (curve2d), afromcur (fromcurve2d);
-  Geom2dGcc_QualifiedCurve qcur (acur, GccEnt_outside);
-  Geom2dGcc_QualifiedCurve qfromcur (afromcur, GccEnt_outside);
-  Geom2dGcc_Lin2d2Tan lintan (qcur, qfromcur, 0.1, 0.0, 0.0);
-  Standard_Integer i=0;
-  for(i=0;i<lintan.NbSolutions();i++) {
-    sprintf(abuf,"lintan_%d",i);
-    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
-    DrawTrSurf::Set(st,glin);
-    if(!aContext.IsNull()) {
-      Handle(AIS_Shape) aisp = 
-        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
-    }
-  }
-  di << " Is Done = \n" << (Standard_Integer) lintan.IsDone();
-  return 0;
-}
-
-static Standard_Integer BUC60843 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
-{
-  if (argc != 4 && argc != 5 && argc != 6 && argc != 7) {
-    di << "Usage : " << argv[0] << "result_shape name_of_circle name_of_curve [ par1 [ tol ] ]" << "\n";
-    return 1;
-  }
-
-  Standard_Real par1 = 0.0, par2 = 0.0;
-  Standard_Real tol  = Precision::Angular();
-  if (argc >= 5)
-    par1 = atof(argv[4]);
-  if (argc == 6)
-    par2 = atof(argv[5]);
-  if (argc == 7)
-    tol = atof(argv[6]);
-  Handle(Geom2d_Curve)  aCur2d1 = DrawTrSurf::GetCurve2d(argv[2]);
-  Handle(Geom2d_Curve)  aCur2d2 = DrawTrSurf::GetCurve2d(argv[3]);
-  if (aCur2d1.IsNull() || aCur2d2.IsNull()) {
-    di << "Faulty : not curves" << "\n";
-    return 1;
-  }
-  Standard_Boolean c1IsCircle = Standard_False;
-  Handle(Geom2d_Circle) aCir2d = Handle(Geom2d_Circle)::DownCast(aCur2d1);
-  if (!aCir2d.IsNull()) {
-    c1IsCircle = Standard_True;
-    if (argc == 6) tol = atof(argv[5]);
-  }
-  if(c1IsCircle) {
-    Geom2dAdaptor_Curve acur(aCur2d2);
-    Geom2dGcc_MyQCurve qcur(acur, GccEnt_unqualified);
-    GccEnt_QualifiedCirc qfromcur(aCir2d->Circ2d(), GccEnt_unqualified);
-    Geom2dGcc_MyL2d2Tan lintan(qfromcur, qcur , par1, tol); 
-    if (lintan.IsDone()) {
-      gp_Lin2d lin = lintan.ThisSolution(); 
-      Handle(Geom2d_Line) glin = new Geom2d_Line(lin); 
-      DrawTrSurf::Set(argv[1], glin);
-    } else {
-      di << "Faulty : tangent line is not done." << "\n";
-    }
-  }
-  else {
-    Geom2dAdaptor_Curve acur1(aCur2d1);
-    Geom2dAdaptor_Curve acur2(aCur2d2);
-    Geom2dGcc_MyQCurve qcur1(acur1, GccEnt_unqualified);
-    Geom2dGcc_MyQCurve qcur2(acur2, GccEnt_unqualified);
-    Geom2dGcc_MyL2d2Tan lintan(qcur1, qcur2 , par1, par2, tol); 
-    if (lintan.IsDone()) {
-      gp_Lin2d lin = lintan.ThisSolution(); 
-      Handle(Geom2d_Line) glin = new Geom2d_Line(lin); 
-      DrawTrSurf::Set(argv[1], glin);
-    } else {
-      di << "Faulty : tangent line is not done." << "\n";
-    }
-  }   
-  return 0;
-}
-
-static Standard_Integer BUC60970 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=3)
-  {
-    di << "Usage : " << argv[0] << " shape result" <<"\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape aResult = DBRep::Get(argv[1]);
-
-  BRepBuilderAPI_MakeWire bRepSpineWire; 
-  TopExp_Explorer exp_(aResult, TopAbs_WIRE); 
-
-  Standard_Integer i = 0; 
-  for(;exp_.More();exp_.Next()){     
-    i++; 
-    bRepSpineWire.Add(TopoDS::Wire(exp_.Current())); 
-  } 
-
-  //printf("total no of wires are ............. %d\n", i); 
-  di << "total no of wires are ............. " << i << "\n"; 
-
-  TopoDS_Wire spineWire = bRepSpineWire.Wire(); 
-  aContext->Display(new AIS_Shape(spineWire)); 
-
-  DBRep::Set("slineW",spineWire);
-
-  TopExp_Explorer spineWireExp(spineWire, TopAbs_EDGE); 
-  Standard_Real first, last; 
-  Handle_Geom_Curve curl_ = BRep_Tool::Curve(TopoDS::Edge(spineWireExp.Current()), first, last); 
-  gp_Pnt firstPnt; 
-  gp_Vec tanVec; 
-  curl_->D1(first, firstPnt, tanVec); 
-  tanVec.Normalize(); 
-  gp_Dir tanDir(tanVec.X(), tanVec.Y(), tanVec.Z()); 
-  gp_Ax2 gpAx2(firstPnt, tanDir); 
-  gp_Circ gpCirc(gpAx2, 2.5); 
-  BRepBuilderAPI_MakeWire aMWire(BRepBuilderAPI_MakeEdge(new Geom_Circle(gpCirc)).Edge());
-  TopoDS_Wire topoWire(aMWire); 
-  aContext->Display(new AIS_Shape(topoWire));
-
-  DBRep::Set("topoW",topoWire);
-
-  BRepOffsetAPI_MakePipeShell bRepPipe(spineWire);
-  bRepPipe.Add(topoWire); 
-  bRepPipe.Build(); 
-
-  aContext->Display(new AIS_Shape(bRepPipe.Shape())); 
-
-  DBRep::Set(argv[2],bRepPipe.Shape());
-
-  return 0;
-}
-
-static Standard_Integer  BUC60818(Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if(argc!=1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return -1;
-  }
-
-  Handle(AIS_InteractiveContext) myAISContext = ViewerTest::GetAISContext();
-  if(myAISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  // TRIHEDRON
-  Handle(AIS_Trihedron) aTrihedron;
-  Handle(Geom_Axis2Placement) aTrihedronAxis=new Geom_Axis2Placement(gp::XOY());
-  aTrihedron=new AIS_Trihedron(aTrihedronAxis);
-  myAISContext->Display(aTrihedron);
-
-  myAISContext->OpenLocalContext(); 
-  myAISContext->Load(aTrihedron,0); 
-
-  myAISContext->SetAutomaticHilight(  Standard_False );
-
-  Handle(V3d_View) myV3dView = ViewerTest::CurrentView();
-  double Xv,Yv;
-  myV3dView->Project(0,0,0,Xv,Yv);
-
-  Standard_Integer Xp,Yp;
-  myV3dView->Convert(Xv,Yv,Xp,Yp);
-
-  myAISContext->MoveTo( Xp,Yp, myV3dView  );
-  myAISContext->MoveTo( Xp,Yp, myV3dView  );
-
-  if (myAISContext->HasDetected(  )) 
-    di << "has detected shape : OK"   << "\n";
-  else       di << "has detected shape : bugged - Faulty "   << "\n";
-
-  myAISContext->SetAutomaticHilight(  Standard_True );
-
-  return 0;
-}
-
-static Standard_Integer BUC60915_1(Draw_Interpretor& di, Standard_Integer argc, const char ** /*argv*/)
-{
-  if (argc > 1) {
-    di<<"Function don't has parameters"<<"\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("buc60915");
-  ViewerTest_Tool::InitViewerTest (context);
-
-  //The following dimesion code has problems regarding arrow_size. The desired effect is not produced.
-  /***************************************/
-  //First view
-  /***************************************/
-  gp_Pnt p1 = gp_Pnt(602.51,50.,0.);
-  gp_Pnt p2 = gp_Pnt(602.51,200.,0.);
-  gp_Pnt p3 = gp_Pnt(102.51,200.,0.);
-  gp_Pnt p4 = gp_Pnt(102.51,170.,0.);
-  gp_Pnt p5 = gp_Pnt(502.51,170.,0.);
-  gp_Pnt p6 = gp_Pnt(502.51,80.,0.);
-  gp_Pnt p7 = gp_Pnt(102.51,80.,0.);
-  gp_Pnt p8 = gp_Pnt(102.51,50.,0.);
-  TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(p1);
-  TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(p2);
-  TopoDS_Vertex V3 = BRepBuilderAPI_MakeVertex(p3);
-  TopoDS_Vertex V4 = BRepBuilderAPI_MakeVertex(p4);
-  TopoDS_Vertex V5 = BRepBuilderAPI_MakeVertex(p5);
-  TopoDS_Vertex V6 = BRepBuilderAPI_MakeVertex(p6);
-  TopoDS_Vertex V7 = BRepBuilderAPI_MakeVertex(p7);
-  TopoDS_Vertex V8 = BRepBuilderAPI_MakeVertex(p8);
-  gp_Pnt plnpt(0, 0, 0);
-  gp_Dir plndir(0, 0, 1);
-  Handle(Geom_Plane) pln = new Geom_Plane(plnpt,plndir);
-  /***************************************/
-  //dimension "L 502.51"
-  /***************************************/
-  Handle(AIS_LengthDimension) len = new AIS_LengthDimension(V2, V3, pln, 502.51, "502.51");
-  len->SetPosition(gp_Pnt(350, 250, 0));
-  len->SetTypeOfDist(AIS_TOD_Horizontal);
-  len->SetArrowSize(30.0);
-  context->Display(len);
-  /***************************************/
-  //dimension "L 90"
-  /***************************************/
-  Handle(AIS_LengthDimension) len1 = new AIS_LengthDimension(V4, V7, pln, 90, "90");
-  len1->SetPosition(gp_Pnt(70, 120, 0));
-  len1->SetTypeOfDist(AIS_TOD_Vertical);
-  len1->SetArrowSize(100.0);
-  context->Display(len1);
-  /***************************************/
-  //dimension "L 150"
-  /***************************************/
-  Handle(AIS_LengthDimension) len2 = new AIS_LengthDimension(V1, V2, pln, 150, "150",gp_Pnt(650, 120, 0),DsgPrs_AS_BOTHAR,
-    AIS_TOD_Vertical, 100.0 );
-  //len2->SetPosition(gp_Pnt(650, 120, 0));
-  //len2->SetTypeOfDist(AIS_TOD_Vertical);
-  //len1->SetArrowSize(100.0);
-  context->Display(len2);
-  /***************************************/
-  //dimension "R 88.58"
-  /***************************************/
-  gp_Circ cir = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 88.58);
-  TopoDS_Edge E1 = BRepBuilderAPI_MakeEdge(cir,gp_Pnt(191.09,0,0.),gp_Pnt(191.09,-177.16,0.) );
-  Handle(AIS_RadiusDimension) dim1 = new AIS_RadiusDimension(E1,88.58, "R 88.58",gp_Pnt(-30.0, -80.0, 0.0),DsgPrs_AS_BOTHAR,
-    100.0 );
-  context->Display(dim1);
-  /***************************************/
-  //dimension "R 43.80"
-  /***************************************/
-  gp_Circ cir1 = gp_Circ(gp_Ax2(gp_Pnt(191.09, -88.58, 0), gp_Dir(0, 0, 1)), 43.80);
-  TopoDS_Edge E_cir1 = BRepBuilderAPI_MakeEdge(cir1);
-  dim1 = new AIS_RadiusDimension(E_cir1,43.80, "R 43.80",gp_Pnt(0.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 60.0 );
-  context->Display(dim1);
-  /***************************************/
-  //dimension "R 17.86"
-  /***************************************/
-  gp_Circ cir2 = gp_Circ(gp_Ax2(gp_Pnt(566.11, -88.58, 0), gp_Dir(0, 0, -1)), 17.86);
-  TopoDS_Edge E_cir2 = BRepBuilderAPI_MakeEdge(cir2);
-  dim1 = new AIS_RadiusDimension(E_cir2,17.86, "R 17.86",gp_Pnt(600.0, -50.0, 0.0),DsgPrs_AS_LASTAR, 40.0 );
-  context->Display(dim1);
-
-  return 0;
-}
-
-static Standard_Integer  OCC138 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
-  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300,300));
-  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500,500));
-
-  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
-  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
-  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
-
-  aContext->Display(ais1);
-  aContext->Display(ais2);
-  aContext->Display(ais3);
-
-  aContext->AddOrRemoveCurrentObject(ais1);
-  aContext->AddOrRemoveCurrentObject(ais2);
-  aContext->AddOrRemoveCurrentObject(ais3);
-
-  di << "\n No of currents = " << aContext->NbCurrents();
-
-  aContext->InitCurrent();
-
-  int count = 1;
-  while(aContext->MoreCurrent())
-  {
-    di << "\n count is = " << count++;
-    Handle_AIS_InteractiveObject ais = aContext->Current();
-    aContext->AddOrRemoveCurrentObject(ais);
-    aContext->InitCurrent();
-  }
-
-  return 0; 
-}
-
-static Standard_Integer BUC60821(Draw_Interpretor& di, Standard_Integer argc,const char ** argv )   
-{
-
-  if(argc < 3){
-    di << "Usage: " << argv[0] << " TextHight1 TextHight2 TextHight2";
-    return(-1);
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-
-  if(aContext.IsNull()) 
-  { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-
-  Handle(QATelco_MyText) txt1 = new QATelco_MyText("Gosha1",gp_Pnt(0,0,0),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_RED,atoi(argv[1]));
-  aContext->Display(txt1);
-
-  Handle(QATelco_MyText) txt2 = new QATelco_MyText("Gosha2",gp_Pnt(0,0,100),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_YELLOW,atoi(argv[2]));
-  aContext->Display(txt2);
-
-  Handle(QATelco_MyText) txt3 = new QATelco_MyText("Gosha3",gp_Pnt(0,100,100),Graphic3d_NOF_ASCII_SIMPLEX,Quantity_NOC_SKYBLUE,atoi(argv[3]));
-  aContext->Display(txt3);
-
-  return 0;
-}
-
-static int geom_get_2Dpt_from_3Dpt(const gp_Pnt& pnt3d, const gp_Pln& pln, gp_Pnt2d& pnt2d)
-{ 
-  int ret = 0; 
-  Handle_Geom_Plane gpln = new Geom_Plane(pln); 
-  GeomAdaptor_Surface adsur(gpln); 
-  Extrema_ExtPS extps(pnt3d, adsur, 0.001, 0.001); 
-  if( extps.IsDone() ) 
-  { 
-    int index;
-    for(index=1; index<= extps.NbExt(); index++ ) 
-    { 
-      Extrema_POnSurf pons = extps.Point(index); 
-      Standard_Real U, V; 
-      pons.Parameter(U, V); 
-      pnt2d.SetCoord(U, V); 
-      ret = 1; 
-    } 
-  } 
-  return ret;
-} 
-
-static Standard_Integer OCC353 (Draw_Interpretor& di, Standard_Integer , const char ** )
-{
-  gp_Ax2 ax21( gp_Pnt(100,0,0), gp_Dir(0,0,1) );
-  Handle_Geom_Circle h_cir1 = new Geom_Circle( ax21, 25 );
-
-  gp_Ax2 ax22( gp_Pnt(-100,0,0), gp_Dir(0,0,1) );
-  Handle_Geom_Circle h_cir2 = new Geom_Circle( ax22, 25 );
-
-  gp_Pln refpln( gp_Pnt(0,0,0), gp_Dir(0,0,1) );
-  Handle_Geom2d_Curve cir2d1 = GeomAPI::To2d(h_cir1, refpln);
-  Handle_Geom2d_Curve cir2d2 = GeomAPI::To2d(h_cir2, refpln);
-
-  Geom2dAdaptor_Curve adop1(cir2d1);
-  Geom2dAdaptor_Curve adop2(cir2d2);
-
-  Geom2dGcc_QualifiedCurve qcur1(adop1, GccEnt_enclosing);
-  Geom2dGcc_QualifiedCurve qcur2(adop2, GccEnt_enclosing);
-
-  Handle_Geom_CartesianPoint h_carpt = new Geom_CartesianPoint(0,175,0);
-
-  gp_Pnt pt3d = h_carpt->Pnt();
-  gp_Pnt2d pt2d;
-  geom_get_2Dpt_from_3Dpt(pt3d, refpln, pt2d);
-
-  Standard_CString st;
-  st = "cir2d1";
-  DrawTrSurf::Set(st,cir2d1);
-  st = "cir2d2";
-  DrawTrSurf::Set(st,cir2d2);
-  st = "pt2d";
-  DrawTrSurf::Set(st,pt2d);
-
-  Handle_Geom2d_CartesianPoint pt = new Geom2d_CartesianPoint(pt2d);
-  Geom2dGcc_Circ2d3Tan sol( qcur1, qcur2, pt, 0.001, 0.0, 0.0);
-
-  int res = 0;
-  Standard_Character buf[10];
-  buf[0] = '\0';
-
-  if( sol.IsDone() ) {
-    res = sol.NbSolutions();
-    for(Standard_Integer i=1;i<=res;i++) {
-      Handle(Geom2d_Circle) aC = new Geom2d_Circle(sol.ThisSolution(i));
-      sprintf(buf,"Result_%d",i);
-      st = buf;
-      DrawTrSurf::Set(st,aC);
-    }
-  }
-  else
-    di << "\n Faulty: no solutions found ";
-  //printf("\n Faulty: no solutions found ");
-
-  //printf("\n Num of solutions are %d ", res );
-  di << "\n Num of solutions are " << res << " ";
-
-  return 0;
-}
-
-static Standard_Integer OCC280 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-  { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return -1;
-  }
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " hlr=0/1 setsurfecedetail=0/1; set perspecrive view" << "\n";
-    return 1;
-  }
-
-  Standard_Integer HLR = atoi(argv[1]);
-  if (HLR != 0) {
-    HLR = 1;
-  }
-
-  Handle(V3d_View) aView = ViewerTest::CurrentView();
-
-  Handle(V3d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
-  if(atoi(argv[2])) {
-    aViewer->SetDefaultSurfaceDetail(V3d_TEX_ALL);
-  }
-  aViewer->SetDefaultTypeOfView(V3d_PERSPECTIVE);
-
-  Handle(Aspect_Window) asp = aView->Window();
-  aViewer->SetViewOff(aView);
-  aView->Remove();
-
-  Handle(V3d_View) aNewView = aViewer->CreateView();
-  ViewerTest::CurrentView(aNewView);
-
-  aNewView->SetWindow(asp);
-  if (!asp->IsMapped()) asp->Map();
-
-  aNewView->Update();
-
-  if (HLR == 1) {
-    di << "HLR" << "\n";
-    aNewView->SetDegenerateModeOff();
-  }
-
-  return 0;
-}
-
-static Standard_Integer  OCC232 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  BRep_Builder builder;
-  TopoDS_Compound comp;
-  TopoDS_CompSolid cs1, cs2;
-
-  builder.MakeCompound(comp);
-  builder.MakeCompSolid(cs1);
-  builder.MakeCompSolid(cs2);
-
-  TopoDS_Shape sh1 = BRepPrimAPI_MakeBox(gp_Pnt(0, 0, 0), 100, 100, 100).Shape();
-  TopoDS_Shape sh2 = BRepPrimAPI_MakeBox(gp_Pnt(100, 0, 0), 100, 100, 100).Shape();
-  TopoDS_Shape sh3 = BRepPrimAPI_MakeBox(gp_Pnt(200, 0, 0), 100, 100, 100).Shape();
-  builder.Add(cs1, sh1);
-  builder.Add(cs1, sh2);
-  builder.Add(cs1, sh3);
-
-  TopoDS_Shape sh4 = BRepPrimAPI_MakeBox(gp_Pnt(0, 500, 0), 100, 100, 100).Shape();
-  TopoDS_Shape sh5 = BRepPrimAPI_MakeBox(gp_Pnt(100, 500, 0), 100, 100, 100).Shape();
-  TopoDS_Shape sh6 = BRepPrimAPI_MakeBox(gp_Pnt(200, 500, 0), 100, 100, 100).Shape();
-
-  builder.Add(cs2, sh4);
-  builder.Add(cs2, sh5);
-  builder.Add(cs2, sh6);
-
-  builder.Add(comp, cs1);
-  builder.Add(comp, cs2);
-
-  Handle_AIS_Shape ais = new AIS_Shape(comp);
-  aContext->Display(ais);
-
-  TopExp_Explorer exp(comp,  TopAbs_COMPSOLID);
-  while(exp.More())
-  {
-    //printf("\n TopAbs_COMPSOLID is  there \n");
-    di << "\n TopAbs_COMPSOLID is  there \n";
-    exp.Next();
-  }
-
-  Handle (StdSelect_ShapeTypeFilter) filt = new StdSelect_ShapeTypeFilter(TopAbs_COMPSOLID);
-  aContext->AddFilter(filt);
-  aContext->CloseAllContexts();
-  aContext->OpenLocalContext(); 
-  aContext->ActivateStandardMode(TopAbs_SOLID);
-
-  return 0; 
-}
-
-static Standard_Integer  OCC138LC (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
-  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300,300));
-  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500,500));
-
-  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
-  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
-  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
-
-  aContext->Display(ais1);
-  aContext->Display(ais2);
-  aContext->Display(ais3);
-
-  aContext->AddOrRemoveSelected(ais1);
-  aContext->AddOrRemoveSelected(ais2);
-  aContext->AddOrRemoveSelected(ais3);
-
-  di << "\n No of selected = " << aContext->NbSelected();
-
-  aContext->InitSelected();
-
-  int count = 1;
-  while(aContext->MoreSelected())
-  {
-    di << "\n count is = %d" << count++;
-    Handle_AIS_InteractiveObject ais = aContext->SelectedInteractive();
-    aContext->AddOrRemoveSelected(ais);
-    aContext->InitSelected();
-  }
-
-  return 0; 
-}
-
-static Standard_Integer  OCC189 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext1 = ViewerTest::GetAISContext();
-  if(aContext1.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  Handle(AIS_InteractiveContext) aContext2 = ViewerTest::GetAISContext();
-  if(aContext2.IsNull()) { 
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  BRepPrimAPI_MakeBox box1(gp_Pnt(0, 0, 0),  gp_Pnt(100, 100, 100));
-  BRepPrimAPI_MakeBox box2(gp_Pnt(120, 120, 120),  gp_Pnt(300, 300, 300));
-  BRepPrimAPI_MakeBox box3(gp_Pnt(320, 320, 320),  gp_Pnt(500, 500, 500));
-
-  Handle_AIS_Shape ais1 = new AIS_Shape(box1.Shape());
-  Handle_AIS_Shape ais2 = new AIS_Shape(box2.Shape());
-  Handle_AIS_Shape ais3 = new AIS_Shape(box3.Shape());
-
-  aContext1->Display(ais1);
-  aContext1->Display(ais2);
-  aContext1->Display(ais3);
-
-  aContext2->Display(ais1);
-  aContext2->Display(ais2);
-  aContext2->Display(ais3);
-
-  aContext1->AddOrRemoveCurrentObject(ais1);
-  aContext1->AddOrRemoveCurrentObject(ais2);
-  aContext1->AddOrRemoveCurrentObject(ais3);
-
-  di << "\n Stage : 1";
-  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
-  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
-
-  di << "\n aContext1->IsCurrent = " << (Standard_Integer) aContext1->IsCurrent(ais1) << ", aContext2->IsCurrent = " << (Standard_Integer) aContext2->IsCurrent(ais1) << " ";
-
-  aContext2->AddOrRemoveCurrentObject(ais1);
-  aContext2->AddOrRemoveCurrentObject(ais2);
-  aContext2->AddOrRemoveCurrentObject(ais3);
-
-  di << "\n Stage : 2";
-  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
-  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
-
-  aContext1->InitCurrent();
-  int count1 = 1;
-  while(aContext1->MoreCurrent())
-  {
-    di << "\n count1 is = " << count1++;
-    Handle_AIS_InteractiveObject ais = aContext1->Current();
-    aContext1->AddOrRemoveCurrentObject(ais);
-    aContext1->InitCurrent();
-  }
-
-  di << "\n Stage : 3";
-  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
-  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents() << "\n\n";
-
-  aContext2->InitCurrent();
-  int count2 = 1;
-  while(aContext2->MoreCurrent())
-  {
-    di << "\n count2 is = " << count2++;
-    Handle_AIS_InteractiveObject ais = aContext2->Current();
-    aContext2->AddOrRemoveCurrentObject(ais);
-    aContext2->InitCurrent();
-  }
-
-  di << "\n\n Stage : 4";
-  di << "\n \t No of currents on aContext1 = " << aContext1->NbCurrents();
-  di << "\n \t No of currents on aContext2 = " << aContext2->NbCurrents();
-
-  return 0; 
-}
-
-static Standard_Integer  OCC389 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 3)
-  {
-    di<<"Usage: " << argv[0] << " name shape1 [shape2] ..."<<"\n";
-    return 1;
-  }
-
-  //if (Viewer2dTest::CurrentView().IsNull())
-  //{ 
-  //  cout << "2D AIS Viewer Initialization ..." << endl;
-  //  Viewer2dTest::ViewerInit(); 
-  //  cout << "Done" << endl;
-  //}
-
-  di<<"Begin!"<<"\n";
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  di<<"Check InteractiveContext"<<"\n";
-
-  if(aContext.IsNull()) {
-    di << "use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  di<<"CloseLocalContext"<<"\n";
-  aContext->CloseLocalContext();
-
-  di<<"OpenLocalContext"<<"\n";
-  aContext->OpenLocalContext();
-
-  TCollection_AsciiString name(argv[1]);
-
-  di<<"Found name"<<"\n";
-  Standard_Boolean IsBound = GetMapOfAIS2D().IsBound2(name);
-  if (IsBound)
-  {
-    di<<"Already displayed"<<"\n";
-  }
-  else // Create the AIS2D_ProjShape from a name
-  {
-    di<<"Create the AIS2D_ProjShape from a name; (1)"<<"\n";
-    Prs3d_Projector aPrs3dProjector(Standard_False, 1, -1.0,0.2,0.3, 0.0, 0.0, 0.0, -0.0,0.0,1.0);
-    di<<"Create the AIS2D_ProjShape from a name; (2)"<<"\n";
-    HLRAlgo_Projector aProjector = aPrs3dProjector.Projector();
-    di<<"Create the AIS2D_ProjShape from a name; (3)"<<"\n";
-    Handle(AIS2D_ProjShape) shp_2d =
-      new AIS2D_ProjShape(aProjector, 0, Standard_False, Standard_True);
-    di<<"Create the AIS2D_ProjShape from a name; (4)"<<"\n";
-
-    Standard_Integer i;
-    Standard_Boolean isValid = Standard_False;
-    for (i = 2; i < argc; i++)
-    {
-      di<<"i="<< i-1 <<"\n";
-      TopoDS_Shape aShape = DBRep::Get(argv[i]);
-      if (!aShape.IsNull())
-      {
-        shp_2d->Add( aShape );
-        di<<"Added shape: "<<argv[i]<<"\n";
-        isValid = Standard_True;
-      }
-    }
-
-    if (isValid)
-    {
-      di<<"Now start displaying..."<<"\n";
-      aContext->Display(shp_2d, 1, 1, Standard_True);
-
-      GetMapOfAIS2D().Bind(shp_2d, name);
-    }
-  }
-
-  aContext->UpdateCurrentViewer();
-  return 0; 
-}
-
-#include <BRepBndLib.hxx>
-#include <Draw.hxx>
-//=======================================================================
-//function : OCC566
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC566(Draw_Interpretor& di,Standard_Integer n,const char ** a)
-{
-  if (n < 2) {
-    di<<"Usage: " << a[0] << " shape [ xmin ymin zmin xmax ymax zmax]"<<"\n";
-    return 1;
-  }
-  TopoDS_Shape S = DBRep::Get(a[1]);
-  if (S.IsNull()) return 1;
-  Bnd_Box B;
-  BRepBndLib::AddClose(S,B);
-  Standard_Real axmin,aymin,azmin,axmax,aymax,azmax;
-  B.Get(axmin,aymin,azmin,axmax,aymax,azmax);
-  di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax;
-  if (n >= 8) {
-    Draw::Set(a[2],axmin) ;
-    Draw::Set(a[3],aymin) ;
-    Draw::Set(a[4],azmin) ;
-    Draw::Set(a[5],axmax) ;
-    Draw::Set(a[6],aymax) ;
-    Draw::Set(a[7],azmax) ;
-  }
-  return 0;
-}
-
-#include <BRepFilletAPI_MakeFillet.hxx>
-//=======================================================================
-//function : OCC570
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC570 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
-{
-  if (argc < 2) {
-    di<<"Usage: " << argv[0] << " result"<<"\n";
-    return 1;
-  }
-
-  BRepPrimAPI_MakeBox mkBox(100.,100.,100.);
-  TopoDS_Shape aBox = mkBox.Shape();
-
-  TopExp_Explorer aExp;
-  aExp.Init(aBox,TopAbs_WIRE);
-  if (aExp.More())
-  {
-    TopoDS_Shape aWire = aExp.Current();
-
-    aExp.Init(aWire,TopAbs_EDGE);
-    TopoDS_Edge e1 = TopoDS::Edge(aExp.Current()); aExp.Next();
-    TopoDS_Edge e2 = TopoDS::Edge(aExp.Current()); aExp.Next();
-    TopoDS_Edge e3 = TopoDS::Edge(aExp.Current()); aExp.Next();
-    TopoDS_Edge e4 = TopoDS::Edge(aExp.Current());
-
-    try
-    {
-      OCC_CATCH_SIGNALS
-        BRepFilletAPI_MakeFillet mkFillet(aBox);
-      mkFillet.SetContinuity(GeomAbs_C1,.001);
-
-      // Setup variable fillet data
-      TColgp_Array1OfPnt2d t_pnt(1,4);
-      t_pnt.SetValue(1,gp_Pnt2d(0.0,5.0));
-      t_pnt.SetValue(2,gp_Pnt2d(0.3,15.0));
-      t_pnt.SetValue(3,gp_Pnt2d(0.7,15.0));
-      t_pnt.SetValue(4,gp_Pnt2d(1.0,5.0));
-
-      // HERE:
-      // It is impossible to build fillet if at least one edge
-      // with variable radius is added!!! If all are constant, everything is ok.
-      mkFillet.Add(t_pnt,e1);
-      mkFillet.Add(5.0,e2);
-      mkFillet.Add(t_pnt,e3);
-      mkFillet.Add(5.0,e4);
-
-      mkFillet.Build();
-      TopoDS_Shape aFinalShape = mkFillet.Shape();
-
-      DBRep::Set(argv[1],aFinalShape);
-    }
-    catch(Standard_Failure)
-    {
-      di << argv[0] << ": Exception in fillet"<<"\n";
-      return 2;
-    }
-  }
-
-  return 0;
-}
-
-#include <Law_Interpol.hxx>
-
-static Standard_Real t3d = 1.e-4;
-static Standard_Real t2d = 1.e-5;
-static Standard_Real ta  = 1.e-2;
-static Standard_Real fl  = 1.e-3;
-static Standard_Real tapp_angle = 1.e-2;
-static GeomAbs_Shape blend_cont = GeomAbs_C1;
-
-static BRepFilletAPI_MakeFillet* Rakk = 0;
-static BRepFilletAPI_MakeFillet* Rake = 0;
-static char name[100];
-
-static void printtolblend(Draw_Interpretor& di)
-{
-  di<<"tolerance ang : "<<ta<<"\n";
-  di<<"tolerance 3d  : "<<t3d<<"\n";
-  di<<"tolerance 2d  : "<<t2d<<"\n";
-  di<<"fleche        : "<<fl<<"\n";
-
-  di<<"tolblend "<<ta<<" "<<t3d<<" "<<t2d<<" "<<fl<<"\n";
-}
-
-static Standard_Integer MKEVOL(Draw_Interpretor& di, 
-                               Standard_Integer narg, 
-                               const char ** a)
-{
-  if(Rake != 0) {delete Rake; Rake = 0;}
-  printtolblend(di);
-  if (narg < 3) return 1;
-  TopoDS_Shape V = DBRep::Get(a[2]);
-  Rake = new BRepFilletAPI_MakeFillet(V);
-  Rake->SetParams(ta,t3d,t2d,t3d,t2d,fl);
-  Rake->SetContinuity(blend_cont, tapp_angle);
-  if (narg == 4) {
-    ChFi3d_FilletShape FSh = ChFi3d_Rational;
-    if (!strcasecmp(a[3], "Q")) {
-      FSh = ChFi3d_QuasiAngular;
-    }
-    else if (!strcasecmp(a[3], "P")) {
-      FSh = ChFi3d_Polynomial;
-    }
-    Rake->SetFilletShape(FSh);
-  }
-  strcpy(name, a[1]);
-  return 0;
-}
-
-static Standard_Integer UPDATEVOL(Draw_Interpretor& di, 
-                                  Standard_Integer narg, 
-                                  const char ** a)
-{
-  if(Rake == 0){
-    di << "MakeFillet non initialise"<<"\n";
-    return 1 ;
-  }
-  if(narg%2 != 0 || narg < 4) return 1;
-  TColgp_Array1OfPnt2d uandr(1,(narg/2)-1);
-  Standard_Real Rad, Par;
-  TopoDS_Shape aLocalEdge(DBRep::Get(a[1],TopAbs_EDGE));
-  TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
-  for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){
-    Par = atof(a[2*ii]);
-    Rad = atof(a[2*ii + 1]);
-    uandr.ChangeValue(ii).SetCoord(Par,Rad);
-  }
-  //HELPDESK: Add law creation
-  const Standard_Boolean aLawMode = !strcmp(a[0],"OCC570evollaw");
-  if (aLawMode)
-  {
-    di<<"INFO: Using law to define variable fillet"<<"\n";
-    Handle(Law_Interpol) law = new Law_Interpol;
-    law->Set(uandr);
-    Rake->Add(law,E);
-  }
-  else
-    Rake->Add(uandr,E);
-
-  return 0;
-}
-
-static Standard_Integer BUILDEVOL(Draw_Interpretor& di,
-                                  Standard_Integer, 
-                                  const char **)
-{
-  if(Rake == 0){
-    di << "MakeFillet non initialise"<<"\n";
-    return 1 ;
-  }
-  Rake->Build();
-  if(Rake->IsDone()){
-    TopoDS_Shape result = Rake->Shape();
-    DBRep::Set(name,result);
-    if(Rake != 0) {delete Rake; Rake = 0;}
-    return 0;
-  }
-  if(Rake != 0) {delete Rake; Rake = 0;}
-  return 1;
-}
-
-#include <TColGeom_SequenceOfCurve.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomFill_NSections.hxx>
-#include <BRepBuilderAPI_MakeFace.hxx>
-//=======================================================================
-//function : OCC606
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC606 ( Draw_Interpretor& di, Standard_Integer n, const char ** a )
-{
-  if (n != 3 && n != 4)
-  {
-    di << "Usage : " << a[0] << " result shape [-t]" << "\n";
-    return 0;
-  }
-
-  Standard_Boolean TrimMode = (n == 4);
-  if (TrimMode) di<<"INFO: Using trimmed curves..."<<"\n";
-  else di<<"INFO: Using non trimmed curves..."<<"\n";
-
-  TopoDS_Shape S = DBRep::Get(a[2]);
-
-  TopExp_Explorer t_exp(S,TopAbs_EDGE);
-  TColGeom_SequenceOfCurve n_curves1;
-  TColStd_SequenceOfReal np;
-  Standard_Real param = 5.0;
-
-  for (;t_exp.More();t_exp.Next())
-  {
-    Standard_Real f,l;
-    Handle(Geom_Curve) h_cur = BRep_Tool::Curve(TopoDS::Edge(t_exp.Current()),f,l);
-    if (!h_cur.IsNull())
-    {
-      if (TrimMode) h_cur = new Geom_TrimmedCurve(h_cur,f,l);
-
-      n_curves1.Append(h_cur);
-      np.Append(param);
-      param += 1.0;
-    }
-  }
-
-  if (n_curves1.Length()>1 && !np.IsEmpty())
-  {
-    try
-    {
-      OCC_CATCH_SIGNALS
-        GeomFill_NSections b_surface1(n_curves1, np);
-      b_surface1.ComputeSurface();
-      Handle(Geom_BSplineSurface) result_surf1 = b_surface1.BSplineSurface();
-      if (!result_surf1.IsNull())
-      {
-        BRepBuilderAPI_MakeFace b_face1(result_surf1, Precision::Confusion());
-        TopoDS_Face bsp_face1 = b_face1.Face();
-        DBRep::Set(a[1],bsp_face1);
-      }
-    }
-    catch(Standard_Failure)
-    {
-      di<<"ERROR: Exception in GeomFill_NSections"<<"\n";
-    }
-  }
-
-
-  return 0;
-}
-
-//=======================================================================
-//function : OCC813
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC813 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
-{
-  if (argc < 3)
-  {
-    di << "Usage : " << argv[0] << " U V" << "\n";
-    return 1;
-  }
-
-  Standard_CString str;
-  Standard_Real U = atof(argv[1]);
-  Standard_Real V = atof(argv[2]);
-
-  //Between ellipse and point:
-
-  Handle(Geom_Ellipse) ell = new Geom_Ellipse(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
-    gp_Dir(0.173648,0.984808,0.000000),
-    gp_Dir(-0.932169,0.164367,-0.322560)), 150, 100);
-  Handle(Geom_Plane) plne = new Geom_Plane(gp_Ax3(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
-    gp_Dir(0.173648,0.984808,0.000000),
-    gp_Dir(-0.932169,0.164367,-0.322560))) );
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-
-  gp_Pnt2d pt2d(U,V);
-  gp_Pln pln = plne->Pln();
-
-  str = "OCC813_pnt"; DrawTrSurf::Set(str,pt2d);
-
-  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d(ell,pln);
-  Geom2dAdaptor_Curve acur(curve2d);
-  Geom2dGcc_QualifiedCurve qcur(acur, GccEnt_outside);
-
-  str = "OCC813_ell"; DrawTrSurf::Set(str,curve2d);
-  if(!aContext.IsNull()) {
-    Handle(AIS_Shape) aisp = 
-      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
-    aContext->Display (aisp);
-  }
-
-  //This does not give any solutions.
-  Geom2dGcc_Lin2d2Tan lintan(qcur, pt2d, 0.1);
-  di<<"OCC813 nb of solutions = "<<lintan.NbSolutions()<<"\n";
-
-  Standard_Character abuf[16];
-  Standard_CString st = abuf;
-
-  Standard_Integer i;
-  for(i=1;i<=lintan.NbSolutions();i++) {
-    sprintf(abuf,"lintan_%d",i);
-    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
-    DrawTrSurf::Set(st,glin);
-    if(!aContext.IsNull()) {
-      Handle(AIS_Shape) aisp = 
-        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
-    }
-  }
-
-  return 0;
-}
-
-//=======================================================================
-//function : OCC814
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC814 (Draw_Interpretor& di, Standard_Integer argc,const char ** argv)
-{
-  if (argc > 1)
-  {
-    di << "Usage : " << argv[0] << "\n";
-    return 1;
-  }
-
-  Standard_CString str;
-
-  //Between Ellipse and Circle:
-
-  Handle(Geom_Circle) cir = new Geom_Circle(gp_Ax2(gp_Pnt(823.687192,502.366825,478.960440),
-    gp_Dir(0.173648,0.984808,0.000000),
-    gp_Dir(-0.932169,0.164367,-0.322560)), 50);
-  Handle(Geom_Ellipse) ell = new Geom_Ellipse(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
-    gp_Dir(0.173648,0.984808,0.000000),
-    gp_Dir(-0.932169,0.164367,-0.322560)), 150, 100);
-  Handle(Geom_Plane) plne = new Geom_Plane(gp_Ax3(gp_Ax2(gp_Pnt(1262.224429,425.040878,363.609716),
-    gp_Dir(0.173648,0.984808,0.000000),
-    gp_Dir(-0.932169,0.164367,-0.322560))) );
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-
-  gp_Pln pln = plne->Pln();
-  Handle(Geom2d_Curve) curve2d = GeomAPI::To2d(ell, pln);
-  Handle(Geom2d_Curve) fromcurve2d = GeomAPI::To2d(cir, pln);
-
-  str = "OCC814_cir"; DrawTrSurf::Set(str,curve2d);
-  str = "OCC814_ell"; DrawTrSurf::Set(str,fromcurve2d);
-  if(!aContext.IsNull()) {
-    Handle(AIS_Shape) aisp = 
-      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(curve2d, pln)).Edge());
-    aContext->Display (aisp);
-  }
-  if(!aContext.IsNull()) {
-    Handle(AIS_Shape) aisp = 
-      new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(fromcurve2d, pln)).Edge());
-    aContext->Display (aisp);
-  }
-
-  Geom2dAdaptor_Curve acur(curve2d), afromcur(fromcurve2d);
-
-  Geom2dGcc_QualifiedCurve qcur(acur, GccEnt_outside) ;
-  Geom2dGcc_QualifiedCurve qfromcur(afromcur, GccEnt_outside) ;
-
-  //This does not give any solutions.
-  Geom2dGcc_Lin2d2Tan lintan(qcur, qfromcur, 0.1);
-  di<<"OCC814 nb of solutions = "<<lintan.NbSolutions()<<"\n";
-
-  Standard_Character abuf[16];
-  Standard_CString st = abuf;
-
-  Standard_Integer i;
-  for(i=1;i<=lintan.NbSolutions();i++) {
-    sprintf(abuf,"lintan_%d",i);
-    Handle(Geom2d_Line) glin = new Geom2d_Line(lintan.ThisSolution(i));
-    DrawTrSurf::Set(st,glin);
-    if(!aContext.IsNull()) {
-      Handle(AIS_Shape) aisp = 
-        new AIS_Shape (BRepBuilderAPI_MakeEdge(GeomAPI::To3d(glin, pln)).Edge());      aContext->Display (aisp);
-    }
-  }
-
-  return 0;
-}
-
-#include <ShapeAnalysis_Wire.hxx>
-#include <IntRes2d_SequenceOfIntersectionPoint.hxx>
-#include <TColgp_SequenceOfPnt.hxx>
-#include <ShapeFix_Wire.hxx>
-//=======================================================================
-//function : OCC884
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC884 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 3 || argc > 5)
-  {
-    di << "Usage : " << argv[0] << " result shape [toler [maxtoler]]" << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape shape = DBRep::Get(argv[2]); //read the shape
-
-  TopExp_Explorer exp(shape, TopAbs_EDGE);
-  if (!exp.More())
-  {
-    di<<"Error: no edge found"<<"\n";
-    return 1;
-  }
-
-  BRep_Builder builder;
-  TopoDS_Wire wire;
-  builder.MakeWire(wire);
-  builder.Add(wire, TopoDS::Edge(exp.Current()));
-
-  // HelpDesk: Create planar face if possible
-  TopoDS_Face face = BRepBuilderAPI_MakeFace(wire,Standard_True);
-
-  Handle(ShapeAnalysis_Wire) advWA = new ShapeAnalysis_Wire;
-  advWA->Load(wire);
-  advWA->SetFace(face);
-  advWA->SetPrecision(0.001);
-
-  IntRes2d_SequenceOfIntersectionPoint points2d;
-  TColgp_SequenceOfPnt points3d;
-
-  di << "Info: CheckSelfIntersectingEdge = " << (Standard_Integer) advWA->CheckSelfIntersectingEdge(1,points2d,points3d) << "\n";
-
-  ShapeExtend_Status status = ShapeExtend_FAIL1;
-  if (advWA->StatusSelfIntersection(status))
-    di << "Info: No P Curve found in the edge\n";
-
-  status = ShapeExtend_FAIL2; 
-  if (advWA->StatusSelfIntersection(status))
-    di << "Info: No Vertices found in the edge\n";
-
-  status = ShapeExtend_DONE1; 
-  if (advWA->StatusSelfIntersection(status))
-    di << "Info: Self-intersection found in the edge\n";
-
-  Standard_Integer i, num = points2d.Length();
-  di << "Info: No. of self-intersection points : " << num << "\n";
-
-  char str[80];
-  Standard_CString name = str;
-  for (i = 1; i <= num; ++i)
-  { 
-    gp_Pnt pt = points3d(i); 
-    di << "Info: Intersecting pt : (" << pt.X() << ", " << pt.Y() << ", " << pt.Z() << ")\n";
-    sprintf(str,"p_%d",i);
-    DrawTrSurf::Set(name,pt);
-  }
-
-  Handle(ShapeFix_Wire) sfw = new ShapeFix_Wire;
-  sfw->Load(wire);
-  sfw->SetFace(face);
-
-  if (argc > 3) sfw->SetPrecision(atof(argv[3])/*0.1*/);
-  if (argc > 4) sfw->SetMaxTolerance(atof(argv[4]));
-  di << "Info: Precision is set to " << sfw->Precision() << "\n";
-  di << "Info: MaxTolerance is set to " << sfw->MaxTolerance() << "\n";
-
-  sfw->ModifyTopologyMode() = 1;
-  sfw->ModifyGeometryMode() = 1; 
-  sfw->FixSelfIntersectingEdgeMode() = 1;
-  //printf("Info: FixSelfIntersection = %d\n",sfw->FixSelfIntersection());
-  di << "Info: FixSelfIntersection = " << (Standard_Integer) sfw->FixSelfIntersection() << "\n";
-
-  DBRep::Set(argv[1],sfw->Wire());
-
-  status = ShapeExtend_OK;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_OK : No intersection found\n";
-  //printf("Info: ShapeExtend_OK : No intersection found\n");
-
-  status = ShapeExtend_FAIL1;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_FAIL1 : analysis failed (edge has no pcurve, or no vertices etc.)\n";
-
-  status = ShapeExtend_FAIL2;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_FAIL2 : self-intersection was found, but not fixed because of limit of increasing tolerance (MaxTolerance)\n";
-
-  status = ShapeExtend_FAIL3;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_FAIL3 : intercestion of non adjacent edges found, but not fixed because of limit of increasing tolerance (MaxTolerance)\n";
-
-  status = ShapeExtend_DONE1;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE1 : tolerance of vertex was increased to fix self-intersection\n";
-
-  status = ShapeExtend_DONE2;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE2 : vertex was moved to fix self-intersection\n";
-
-  status = ShapeExtend_DONE3;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE3 : some edges were removed because of intersection\n";
-
-  status = ShapeExtend_DONE4;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE4 : pcurve(s) was(were) modified\n";
-
-  status = ShapeExtend_DONE5;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE5 : non adjacent intersection fixed by increasing tolerance of vertex(vertices)\n";
-
-  status = ShapeExtend_DONE6;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE6 : tolerance of edge was increased to hide intersection\n";
-
-  status = ShapeExtend_DONE7;
-  if (sfw->StatusSelfIntersection(status))
-    di << "Info: ShapeExtend_DONE7 : range of some edges was decreased to avoid intersection\n";
-
-  return 0;
-}
-
-#include <Aspect_FillMethod.hxx>
-//=======================================================================
-//function : OCC1188
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1188 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc < 2 || argc > 3)
-  {
-    di << "Usage : " << argv[0] << " imagefile [filltype] : Load image as background" << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
-  if(AISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  Aspect_FillMethod aFillType = Aspect_FM_CENTERED;
-  if (argc == 3)
-  {
-    const char* szType = argv[2];
-    if      (strcmp(szType, "NONE"    ) == 0) aFillType = Aspect_FM_NONE;
-    else if (strcmp(szType, "CENTERED") == 0) aFillType = Aspect_FM_CENTERED;
-    else if (strcmp(szType, "TILED"   ) == 0) aFillType = Aspect_FM_TILED;
-    else if (strcmp(szType, "STRETCH" ) == 0) aFillType = Aspect_FM_STRETCH;
-    else
-    {
-      di << "Wrong fill type : " << szType << "\n";
-      di << "Must be one of CENTERED, TILED, STRETCH, NONE" << "\n";
-      return 1;
-    }
-  }
-
-  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
-  V3dView->SetBackgroundImage(argv[1], aFillType, Standard_True);
-
-  return 0;
-}
-
-#include <AIS_Drawer.hxx>
-#include <Graphic3d_MaterialAspect.hxx>
-#include <Prs3d_ShadingAspect.hxx>
-//=======================================================================
-//function : OCC1174_1
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1174_1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2)
-  {
-    di << "Usage : " << argv[0] << " shape" << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
-  if(AISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape sh = DBRep::Get(argv[1]);
-
-  Handle(AIS_Shape) ais = new AIS_Shape(sh);
-
-  Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_RGB);
-  Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_RGB);
-
-  Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect();
-
-  Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE);
-  front.SetAmbientColor(colf);
-  front.SetDiffuseColor(colf);
-  front.SetSpecularColor(colf);
-  front.SetEmissiveColor(colf);
-  front.SetTransparency(0.0);
-  sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE);
-
-  Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE);
-  back.SetAmbientColor(colb);
-  back.SetDiffuseColor(colb);
-  back.SetSpecularColor(colb);
-  back.SetEmissiveColor(colb);
-  back.SetTransparency(0.0);
-  sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE);
-
-  AISContext->Display(ais,1,0);
-
-  Standard_Real r, g, b; 
-  sa->Color(Aspect_TOFM_FRONT_SIDE).Values(r,g,b, Quantity_TOC_RGB);
-  di << "Info: color on front side (" << r << "," << g << "," << b << ")\n";
-  sa->Color(Aspect_TOFM_BACK_SIDE).Values(r,g,b, Quantity_TOC_RGB);
-  di << "Info: color on back side (" << r << "," << g << "," << b << ")\n";
-
-  return 0;
-}
-
-//=======================================================================
-//function : OCC1174_2
-//purpose  : 
-//=======================================================================
-static Standard_Integer OCC1174_2 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 2)
-  {
-    di << "Usage : " << argv[0] << " shape" << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) AISContext = ViewerTest::GetAISContext();
-  if(AISContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  TopoDS_Shape sh = DBRep::Get(argv[1]);
-
-  Handle(AIS_Shape) ais = new AIS_Shape(sh); 
-  AISContext->Display(ais,1,0); 
-  AISContext->SetMaterial(ais,Graphic3d_NOM_SHINY_PLASTIC); 
-
-  Quantity_Color colf(0.0, 0.4, 0.0, Quantity_TOC_RGB); 
-  Quantity_Color colb(0.0, 0.0, 0.6, Quantity_TOC_RGB); 
-  Handle(Prs3d_ShadingAspect) sa = ais->Attributes()->ShadingAspect(); 
-
-  Graphic3d_MaterialAspect front = sa->Material(Aspect_TOFM_FRONT_SIDE); 
-  front.SetAmbientColor(colf); 
-  front.SetDiffuseColor(colf); 
-  front.SetSpecularColor(colf); 
-  front.SetEmissiveColor(colf); 
-  front.SetTransparency(0.4); 
-  sa->SetMaterial(front,Aspect_TOFM_FRONT_SIDE); 
-
-  Graphic3d_MaterialAspect back = sa->Material(Aspect_TOFM_BACK_SIDE); 
-  back.SetAmbientColor(colb); 
-  back.SetDiffuseColor(colb); 
-  back.SetSpecularColor(colb); 
-  back.SetEmissiveColor(colb); 
-  back.SetTransparency(0.2); 
-  sa->SetMaterial(back,Aspect_TOFM_BACK_SIDE); 
-
-  AISContext->Redisplay(ais,1,0);
-
-  return 0;
-}
-
-#include <Graphic2d_Segment.hxx>
-#include <Prs2d_Length.hxx>
-#include <Prs2d_AspectLine.hxx>
-#include <AIS2D_InteractiveObject.hxx>
-//=======================================================================
-//  OCC672:
-//         OCC672_Length
-//         OCC672_Angle
-//         OCC672_Diameter
-//         OCC672_ShortLength 
-//=======================================================================
-
-static Standard_Integer OCC672_Length (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
-{
-  if (n != 17) {
-    di << " wrong parameters !\n";
-    di << "must be : OCC672_Length x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 TxtAngle TxtPosH TxtPosV\n";
-    return 1;
-  }
-
-  Standard_Real x1=atof(argv[1]);
-  Standard_Real y1=atof(argv[2]);
-  Standard_Real x2=atof(argv[3]);
-  Standard_Real y2=atof(argv[4]);
-  Standard_Real x3=atof(argv[10]);
-  Standard_Real y3=atof(argv[11]);
-  Standard_Real x4=atof(argv[12]);
-  Standard_Real y4=atof(argv[13]);
-  Standard_Real txtAngle=atof(argv[14]);
-  Standard_Real txtPosH=atof(argv[15]);
-  Standard_Real txtPosV=atof(argv[16]);
-
-  di<<"Begin!\n";
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  di<<"Check InteractiveContext\n";
-
-  if(aContext.IsNull()) {
-    di << "use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  di<<"CloseLocalContext\n";
-  aContext->CloseLocalContext();
-
-  di<<"OpenLocalContext\n";
-  aContext->OpenLocalContext();
-  //step0 end  
-  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
-  Handle(Graphic2d_Segment) theSegmA, theSegmB, theSegmC, theSegmD;
-
-  theSegmA = new Graphic2d_Segment( aIO10, x1, y1, x2, y2 );
-  theSegmB = new Graphic2d_Segment( aIO10, x2, y2, x3, y3 );
-  theSegmC = new Graphic2d_Segment( aIO10, x3, y3, x4, y4 );
-  theSegmD = new Graphic2d_Segment( aIO10, x4, y4, x1, y1 );
-
-  aContext->Display( aIO10, Standard_True ); 
-
-  Handle(Prs2d_Length) length = new Prs2d_Length(aIO10, gp_Pnt2d(x1, y1), gp_Pnt2d(x2, y2), argv[5],
-    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
-    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR);
-
-  length->SetTextRelPos(txtPosH,txtPosV);
-  length->SetTextRelAngle(txtAngle);
-
-  Handle(Prs2d_AspectLine) theAspect = new Prs2d_AspectLine(Quantity_NOC_WHITE,
-    Aspect_TOL_SOLID, Aspect_WOL_THIN);
-  aIO10->SetAspect( theAspect,  length);
-  aContext->Display( aIO10, Standard_True );
-
-  Handle(Prs2d_Length) lengthB = new Prs2d_Length(aIO10, gp_Pnt2d(x2, y2), gp_Pnt2d(x3, y3), argv[5],
-    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
-    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR);
-
-  lengthB->SetTextRelPos(txtPosH,txtPosV);
-  lengthB->SetTextRelAngle(txtAngle);
-
-  aIO10->SetAspect( theAspect,  lengthB);
-  aContext->Display( aIO10, Standard_True );
-
-  Handle(Prs2d_Length) lengthC = new Prs2d_Length(aIO10, gp_Pnt2d(x3, y3), gp_Pnt2d(x4, y4), argv[5],
-    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
-    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR);
-
-  lengthC->SetTextRelPos(txtPosH,txtPosV);
-  lengthC->SetTextRelAngle(txtAngle);
-
-  aIO10->SetAspect( theAspect,  lengthC);
-  aContext->Display( aIO10, Standard_True );
-
-  Handle(Prs2d_Length) lengthD = new Prs2d_Length(aIO10, gp_Pnt2d(x4, y4), gp_Pnt2d(x1, y1), argv[5],
-    atof(argv[6]), atof(argv[7]), Prs2d_TOD_AUTOMATIC, 
-    atof(argv[8]), atof(argv[9]), Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR);
-
-  lengthD->SetTextRelPos(txtPosH,txtPosV);
-  lengthD->SetTextRelAngle(txtAngle);
-
-  aIO10->SetAspect( theAspect,  lengthD);
-  aContext->Display( aIO10, Standard_True );
-  return 0;
-}
-
-#include <Prs2d_Angle.hxx>
-static Standard_Integer OCC672_Angle (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
-{
-  if (n != 15) {
-    di << "Wrong parameters !\n";
-    di << "must be : OCC672_Angle x1 y1 x2 y2 x3 y3 aRadius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV  \n";
-    return 1;
-  }
-
-  Standard_Real x1=atof(argv[1]);
-  Standard_Real y1=atof(argv[2]);
-  Standard_Real x2=atof(argv[3]);
-  Standard_Real y2=atof(argv[4]);
-  Standard_Real x3=atof(argv[5]);
-  Standard_Real y3=atof(argv[6]);
-  Standard_Real aRadius=atof(argv[7]);
-  Standard_Real aTxtScale=atof(argv[9]);
-  Standard_Real anArrAngle=atof(argv[10]);
-  Standard_Real anArrLength=atof(argv[11]);
-  Standard_Real txtAngle=atof(argv[12]);
-  Standard_Real txtPosH=atof(argv[13]);
-  Standard_Real txtPosV=atof(argv[14]);
-
-  di<<"Begin!\n";
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  di<<"Check InteractiveContext\n";
-
-  if(aContext.IsNull()) {
-    di << "use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  di<<"CloseLocalContext\n";
-  aContext->CloseLocalContext();
-
-  di<<"OpenLocalContext\n";
-  aContext->OpenLocalContext();
-
-  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
-  Handle(Graphic2d_Segment) theSegmA, theSegmB;
-  theSegmA = new Graphic2d_Segment( aIO10, x1, y1, x2, y2 );
-  theSegmB = new Graphic2d_Segment( aIO10, x1, y1, x3, y3 );
-  aContext->Display( aIO10, Standard_True ); 
-
-  Handle(Prs2d_Angle) angle = new Prs2d_Angle(aIO10, gp_Pnt2d(x1, y1), gp_Pnt2d(x2, y2),gp_Pnt2d(x3,y3),
-    aRadius,argv[8],aTxtScale,anArrAngle,anArrLength,Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR);
-
-  angle->SetTextRelPos(txtPosH,txtPosV);
-  angle->SetTextAbsAngle(txtAngle);
-
-  aContext->Display( aIO10, Standard_True );
-  return 0; 
-}
-
-#include <Prs2d_Diameter.hxx>
-#include <gp_Circ2d.hxx>
-#include <Graphic2d_Circle.hxx>
-#include <Prs2d_AspectText.hxx>
-static Standard_Integer OCC672_Diameter (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
-{
-  if (n != 13) {
-    di << "Wrong parameters !\n";
-    di << "must be : OCC672_Diameter x1 y1 cx cy radius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV\n";
-    return 1;
-  }
-
-  Standard_Real x1=atof(argv[1]);
-  Standard_Real y1=atof(argv[2]);
-  Standard_Real cx=atof(argv[3]);    //coordinats for circle 
-  Standard_Real cy=atof(argv[4]);    //
-  Standard_Real radius=atof(argv[5]);//radius for circle 
-  Standard_Real aTxtScale=atof(argv[7]);
-  Standard_Real anArrAngle=atof(argv[8]);
-  Standard_Real anArrLength=atof(argv[9]);
-
-  Standard_Real txtAngle=atof(argv[10]);
-  Standard_Real txtPosH=atof(argv[11]);
-  Standard_Real txtPosV=atof(argv[12]);
-
-
-  di<<"Begin!\n";
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  di<<"Check InteractiveContext\n";
-
-  if(aContext.IsNull()) {
-    di << "use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  di<<"CloseLocalContext\n";
-  aContext->CloseLocalContext();
-
-  di<<"OpenLocalContext\n";
-  aContext->OpenLocalContext();
-  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject(); 
-
-  Handle (Graphic2d_Circle) HCirc;
-  HCirc= new Graphic2d_Circle(aIO10,cx,cy,radius);
-
-  gp_Dir2d myDir2d(1,0);
-  gp_Pnt2d myPnt2d(cx,cy);
-  gp_Ax2d myAx2d(myPnt2d,myDir2d);
-  gp_Circ2d myCirc(myAx2d,radius);
-
-  Handle(Prs2d_Diameter) diameter = new Prs2d_Diameter(aIO10, gp_Pnt2d(x1, y1),myCirc,
-    argv[6],aTxtScale,anArrAngle,anArrLength,
-    Prs2d_TOA_FILLED,
-    Prs2d_AS_BOTHAR,Standard_True);
-
-  diameter->SetTextRelPos(txtPosH,txtPosV);
-
-  diameter->SetTextAbsAngle(txtAngle);
-
-  aContext->Display( aIO10, Standard_True );
-
-  return 0;
-}
-
-#include <gp_Lin2d.hxx>
-static Standard_Integer OCC672_ShortLength (Draw_Interpretor& di, Standard_Integer n,const char ** argv)
-{
-  if (n != 17) {
-    di << " wrong parameters !\n";
-    di << "must be : OCC672_ShortLength x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 TxtAngle TxtPosH TxtPosV\n";
-    return 1;
-  }
-
-  Standard_Real x1=atof(argv[1]);
-  Standard_Real y1=atof(argv[2]);
-  Standard_Real x2=atof(argv[3]);
-  Standard_Real y2=atof(argv[4]);
-  Standard_Real x3=atof(argv[10]);
-  Standard_Real y3=atof(argv[11]);
-  Standard_Real x4=atof(argv[12]);
-  Standard_Real y4=atof(argv[13]);
-  Standard_Real txtAngle=atof(argv[14]);
-  Standard_Real txtPosH=atof(argv[15]);
-  Standard_Real txtPosV=atof(argv[16]);
-
-
-  di<<"Begin!\n";
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  di<<"Check InteractiveContext\n";
-
-  if(aContext.IsNull()) {
-    di << "use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  di<<"CloseLocalContext\n";
-  aContext->CloseLocalContext();
-
-  di<<"OpenLocalContext\n";
-  aContext->OpenLocalContext();
-
-  Handle(AIS2D_InteractiveObject) aIO10 = new AIS2D_InteractiveObject();
-  Handle(Graphic2d_Segment) theSegmA, theSegmB, theSegmC, theSegmD;
-  theSegmB = new Graphic2d_Segment( aIO10, x2, y2, x3, y3 );
-  theSegmD = new Graphic2d_Segment( aIO10, x4, y4, x1, y1 );
-
-  aContext->Display( aIO10, Standard_True ); 
-
-  gp_Pnt2d p3(x3,y3),p2(x2,y2),p1(x1,y1);
-  gp_Vec2d theVec(p3,p2);
-  gp_Dir2d theDir(theVec);
-  gp_Lin2d theLin1(p1,theDir);
-  gp_Lin2d theLin2(p3,theDir);
-
-  Handle(Prs2d_Length) length = new Prs2d_Length(aIO10, p1, theLin2, argv[5],
-    atof(argv[6]), 5.0, 20.0, 5.,
-    Prs2d_TOA_CLOSED,Prs2d_AS_BOTHAR,
-    Standard_True);
-
-
-  Handle(Prs2d_AspectLine) theAspect = new Prs2d_AspectLine(Quantity_NOC_WHITE,
-    Aspect_TOL_SOLID, Aspect_WOL_THIN);
-  length->SetTextRelPos(txtPosH,txtPosV);
-  length->SetTextRelAngle(txtAngle);
-
-  aIO10->SetAspect( theAspect,  length);
-  aContext->Display( aIO10, Standard_True );
-
-  return 0;
-}
-
-#include <TopoDS_Solid.hxx>
-#include <BRepFeat_MakeDPrism.hxx>
-//=======================================================================
-//function : OCCN1
-//purpose  : FEATURE OPERATION (BOSS and SLOT)
-//=======================================================================
-static Standard_Integer OCCN1 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 4)
-  {
-    di << "Usage : " << argv[0] << " angle fuse(1 for boss / 0 for slot) length" << "\n";
-    return 1;
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  Standard_Real    angle  = atof(argv[1]);
-  Standard_Integer fuse   = atoi(argv[2]);
-  Standard_Real    length = atof(argv[3]);
-
-  BRepBuilderAPI_MakeEdge edge1(gp_Pnt(0, 0, 0), gp_Pnt(50, 0, 0));
-  BRepBuilderAPI_MakeEdge edge2(gp_Pnt(50, 0, 0), gp_Pnt(50, 50, 0));
-  BRepBuilderAPI_MakeEdge edge3(gp_Pnt(50, 50, 0), gp_Pnt(0, 50, 0));
-  BRepBuilderAPI_MakeEdge edge4(gp_Pnt(0, 50, 0), gp_Pnt(0, 0, 0));
-  TopoDS_Edge ted1 = edge1.Edge();
-  TopoDS_Edge ted2 = edge2.Edge();
-  TopoDS_Edge ted3 = edge3.Edge();
-  TopoDS_Edge ted4 = edge4.Edge();
-
-  BRepBuilderAPI_MakeWire wire(ted1, ted2, ted3, ted4);
-  TopoDS_Wire twire = wire.Wire();
-
-  BRepBuilderAPI_MakeFace face(twire);
-  TopoDS_Face tface = face.Face();
-  ////////Handle_AIS_Shape face_ais = new AIS_Shape( tface );
-  ////////aContext->Display(face_ais);
-
-  TopoDS_Solid box;
-  BRepPrimAPI_MakeBox block(gp_Pnt(-50, -50, -150), 150, 150, 100);
-  box = block.Solid();
-
-  TopoDS_Face top_face;
-  top_face = block.TopFace();
-
-  BRepFeat_MakeDPrism slot(box, tface, top_face, angle, fuse,
-    Standard_True);
-
-  slot.Perform(length);
-  TopoDS_Shape S2 = slot.Shape();
-
-  DBRep::Set("OCCN1_tface",tface);
-  DBRep::Set("OCCN1_slot",S2);
-
-  return 0;
-}
-
-#include <BRepPrimAPI_MakeCylinder.hxx>
-#include <BRepPrimAPI_MakeSphere.hxx>
-#include <BRepAlgoAPI_Section.hxx>
-#include <BRepAlgo_Section.hxx>
-//=======================================================================
-//function : OCCN2
-//purpose  : BOOLEAN OPERATION
-//=======================================================================
-static Standard_Integer OCCN2 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc > 2) {
-    di << "Usage : " << argv[0] << " [BRepAlgoAPI/BRepAlgo = 1/0]" << "\n";
-    return 1;
-  }
-  Standard_Boolean IsBRepAlgoAPI = Standard_True;
-  if (argc == 2) {
-    Standard_Integer IsB = atoi(argv[1]);
-    if (IsB != 1) {
-      IsBRepAlgoAPI = Standard_False;
-#if ! defined(BRepAlgo_def04)
-#endif
-    }
-  }
-
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  BRepPrimAPI_MakeCylinder cylinder(50,200);
-  TopoDS_Shape cylinder_sh = cylinder.Shape();
-
-  BRepPrimAPI_MakeSphere sphere(gp_Pnt(60,0,100),50);
-  TopoDS_Shape sphere_sh = sphere.Shape();
-
-  //BRepAlgoAPI_Section section(cylinder_sh, sphere_sh);
-  //TopoDS_Shape shape = section.Shape();
-
-  TopoDS_Shape shape;
-  if (IsBRepAlgoAPI) {
-    di << "BRepAlgoAPI_Section section(cylinder_sh, sphere_sh)" <<"\n";
-    BRepAlgoAPI_Section section(cylinder_sh, sphere_sh);
-    section.Build();
-    if(!section.IsDone()){
-      di << "Error performing intersection: not done." << "\n";
-    }
-    shape = section.Shape();
-  } else {
-    di << "BRepAlgo_Section section(cylinder_sh, sphere_sh)" <<"\n";
-    BRepAlgo_Section section(cylinder_sh, sphere_sh);
-    section.Build();
-    if(!section.IsDone()){
-      di << "Error performing intersection: not done." << "\n";
-    }
-    shape = section.Shape();
-  }
-
-  DBRep::Set("OCCN2_cylinder",cylinder_sh);
-  DBRep::Set("OCCN2_sphere",sphere_sh);
-  DBRep::Set("OCCN2_section",shape);
-
-  return 0;
-}
-
-#include <TColgp_Array1OfPnt.hxx>
-#include <Geom_BezierCurve.hxx>
-
-static Standard_Integer OCC2569 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) 
-  {
-    di << "use 'vinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  if(argc != 3) {
-    di << "Usage : " << argv[0] << " nbpoles result" << "\n";
-    return 1;
-  }
-
-  int poles=atoi(argv[1]); 
-
-  TColgp_Array1OfPnt arr(1, poles); 
-  for(int i=1; i<=poles; i++) 
-    arr.SetValue(i, gp_Pnt(i+10, i*2+20, i*3+45)); 
-
-  Handle_Geom_BezierCurve bez = new Geom_BezierCurve(arr); 
-  if(bez.IsNull()) {
-    di << "\n The curve is not created.\n";
-  } else {
-    di << "\n Degree = " << bez->Degree() << "\n";   
-  }
-  TopoDS_Edge sh = BRepBuilderAPI_MakeEdge(bez).Edge(); 
-  Handle_AIS_Shape ais = new AIS_Shape(sh); 
-  aContext->Display(ais); 
-  DrawTrSurf::Set(argv[2],bez);
-  return 0;
-}
-
-#include <TopTools_IndexedMapOfShape.hxx>
-#include <TopExp.hxx>
-
-static Standard_Integer OCC1642 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if (argc != 10) {
-    di<<"Usage: " << argv[0] << " FinalWare FinalFace InitWare InitFace shape FixReorder FixDegenerated FixConnected FixSelfIntersection"<<"\n";
-    return 1;
-  }
-
-  TopoDS_Shape shape = DBRep::Get(argv[5]);
-
-  TopExp_Explorer exp(shape, TopAbs_WIRE);
-  TopoDS_Shape wire = exp.Current();
-
-  Handle(ShapeAnalysis_Wire) advWA = new ShapeAnalysis_Wire;
-  advWA->Load(TopoDS::Wire(wire));
-
-  DBRep::Set(argv[3],wire);
-
-  TopoDS_Face face =
-    BRepBuilderAPI_MakeFace(TopoDS::Wire(wire),Standard_True);
-
-  DBRep::Set(argv[4],face);
-
-  advWA->SetFace(face);
-  float precision_to_ana = 0.0001;
-  advWA->SetPrecision(precision_to_ana);
-
-  TopTools_IndexedMapOfShape M;
-  TopExp::MapShapes(wire, TopAbs_EDGE, M);
-
-  int j= 1;
-  for(j= 1; j<=M.Extent(); ++j) {
-    Standard_Integer num=1;
-    IntRes2d_SequenceOfIntersectionPoint points2d;
-    TColgp_SequenceOfPnt points3d;
-
-    cout << "\n j =" << j << ",  CheckSelfIntersectingEdge = " <<
-      advWA->CheckSelfIntersectingEdge(j, points2d, points3d);
-
-
-    ShapeExtend_Status status = ShapeExtend_FAIL1;
-    if(advWA->StatusSelfIntersection(status))
-
-      status = ShapeExtend_FAIL2;
-    if(advWA->StatusSelfIntersection(status))
-      di << "\n No Vertices found in the edge";
-
-    status = ShapeExtend_DONE1;
-    if(advWA->StatusSelfIntersection(status))
-      di << "\n Self-intersection found in the edge";
-
-    num = points2d.Length();
-    di << "\n No. of self-intersecting edges : " << num;
-
-    for(int i=1; i<=num; ++i) {
-      gp_Pnt pt = points3d(i);
-      di << "\n Intersecting pt : (" << pt.X() << ", " << pt.Y()<< ", " << pt.Z() << ")";
-    }
-
-  }
-
-  Handle_ShapeFix_Wire sfw = new ShapeFix_Wire;
-  sfw->Load(TopoDS::Wire(wire));
-  sfw->SetFace(face);
-  sfw->SetPrecision(Precision::Confusion());
-
-  sfw->FixReorderMode() = 1;
-  sfw->ClosedWireMode() = 1;
-  sfw->FixDegeneratedMode() = 1;
-  sfw->FixConnectedMode() = 1;
-  sfw->ModifyTopologyMode() = 1;
-  sfw->ModifyGeometryMode() = 1;
-  sfw->FixSelfIntersectionMode() = 1;
-  sfw->FixSelfIntersectingEdgeMode() = 1;
-  sfw->FixIntersectingEdgesMode() = 1;
-  sfw->FixNonAdjacentIntersectingEdgesMode() = 1;
-  sfw->FixEdgeCurvesMode() = 1;
-
-  sfw->ModifyRemoveLoopMode() = 1;
-  sfw->SetMaxTolerance(1.0);
-
-  di << "\n FixReorder = " << (Standard_Integer) sfw->FixReorder();
-  di << "\n FixDegenerated = " << (Standard_Integer) sfw->FixDegenerated();
-  di << "\n FixConnected = " << (Standard_Integer) sfw->FixConnected();
-  di << "\n";
-  di << "\n FixSelfIntersection = " << (Standard_Integer) sfw->FixSelfIntersection();
-  di << "\n";
-
-  Draw::Set(argv[6],sfw->FixReorder()) ;
-  Draw::Set(argv[7],sfw->FixDegenerated()) ;
-  Draw::Set(argv[8],sfw->FixConnected()) ;
-  Draw::Set(argv[9],sfw->FixSelfIntersection()) ;
-
-  ShapeExtend_Status status = ShapeExtend_OK;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_OK : No intersection found";
-
-  status = ShapeExtend_FAIL1;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_FAIL1 : analysis failed (edge has no pcurve,or no vertices etc.)";
-
-  status = ShapeExtend_FAIL2;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_FAIL2 : self-intersection was found, but not fixed because of limit of increasing tolerance (MaxTolerance)";
-
-  status = ShapeExtend_FAIL3;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_FAIL3 : intercestion of non adjacent edges found, but not fixed because of limit of increasing tolerance (MaxTolerance)";
-
-  status = ShapeExtend_DONE1;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE1 : tolerance of vertex was increased to fix self-intersection";
-
-  status = ShapeExtend_DONE2;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE2 : vertex was moved to fix self-intersection";
-
-  status = ShapeExtend_DONE3;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE3 : some edges were removed because of intersection";
-
-  status = ShapeExtend_DONE4;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE4 : pcurve(s) was(were) modified";
-
-  status = ShapeExtend_DONE5;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE5 : non adjacent intersection fixed by increasing tolerance of vertex(vertices)";
-
-  status = ShapeExtend_DONE6;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE6 : tolerance of edge was increased to hide intersection";
-
-  status = ShapeExtend_DONE7;
-  if(sfw->StatusSelfIntersection(status))
-    di << "\n ShapeExtend_DONE7 : range of some edges was decreased to avoid intersection";
-
-  TopoDS_Wire finalwire = sfw->Wire();
-
-  DBRep::Set(argv[1],finalwire);
-
-
-  advWA->Load(TopoDS::Wire(finalwire));
-
-  TopoDS_Face fface =
-    BRepBuilderAPI_MakeFace(TopoDS::Wire(finalwire),Standard_True);
-
-  DBRep::Set(argv[2],fface);
-
-  advWA->SetFace(fface);
-
-  TopTools_IndexedMapOfShape fM;
-  TopExp::MapShapes(finalwire, TopAbs_EDGE, fM);
-
-  for(j= 1; j<=fM.Extent(); ++j) {
-    Standard_Integer num=1;
-    IntRes2d_SequenceOfIntersectionPoint points2d;
-    TColgp_SequenceOfPnt points3d;
-
-    di << "\n j =" << j << ",  CheckSelfIntersectingEdge = " <<
-      (Standard_Integer) advWA->CheckSelfIntersectingEdge(j, points2d, points3d);
-
-
-    ShapeExtend_Status status = ShapeExtend_FAIL1;
-    if(advWA->StatusSelfIntersection(status))
-
-      status = ShapeExtend_FAIL2;
-    if(advWA->StatusSelfIntersection(status))
-      di << "\n No Vertices found in the edge";
-
-    status = ShapeExtend_DONE1;
-    if(advWA->StatusSelfIntersection(status))
-      di << "\n Self-intersection found in the edge";
-
-    num = points2d.Length();
-    di << "\n No. of self-intersecting edges : " << num;
-
-    for(int i=1; i<=num; ++i) {
-      gp_Pnt pt = points3d(i);
-      di << "\n Intersecting pt : (" << pt.X() << ", " << pt.Y() << ", " << pt.Z() << ")";
-    }
-
-  }
-
-  di << "\n";
-
-  return 0;
-}
-
-Standard_Integer OCC17480(Draw_Interpretor& di,   Standard_Integer n,   const char ** a)
-{
-  if ( n < 2 ) {
-    cout << "Usage: OCC17480 basic_shape <mode[0:1]>" <<endl;
-    return 0;    
-  }
-
-  TopoDS_Shape brep_pipe =  DBRep::Get(a[1]);
-
-  Standard_Boolean mode = Standard_False;
-  if(n == 3 && atoi(a[2]) == 1)
-    mode = Standard_True;
-
-  Handle_AIS_Shape ais_pipe = new AIS_Shape( brep_pipe );
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  Handle(AIS2D_InteractiveContext) aContext_2d = Viewer2dTest::GetAIS2DContext();
-
-  if(!aContext.IsNull())
-    aContext->Display(ais_pipe);      
-
-  if(!aContext_2d.IsNull())
-    aContext_2d->EraseAll(Standard_True);
-
-  gp_Ax3 ax3(gp_Pnt(0, 0, 0), gp_Dir(0, 0, 1), gp_Dir(0, 1, 0));
-  gp_Pln plane(ax3);
-  gp_Ax2 ax2 = ax3.Ax2();
-
-  HLRAlgo_Projector aProjector = HLRAlgo_Projector(ax2);
-  Handle_AIS2D_ProjShape myDisplayableShape = 
-    new AIS2D_ProjShape(aProjector, 0, mode, Standard_True);
-
-  myDisplayableShape->Add( brep_pipe );
-
-  di << "\n Total number of primitives : " << myDisplayableShape->Length();
-
-  Handle(Graphic2d_Line) mySectProjLines = myDisplayableShape->GetPrimitives();
-  Handle(Graphic2d_Line) mySectProjLinesHLR = myDisplayableShape->GetHLPrimitives();
-
-  Handle_Standard_Type sty = mySectProjLines->DynamicType();
-  Handle_Standard_Type sty1 = mySectProjLinesHLR->DynamicType();
-
-  di << "\n Class Name = " << (char*)sty->Name();
-  di << "\n HLR Class Name = " << (char*)sty1->Name();
-  di << "\n mySectProjLines.IsNull = " << (Standard_Integer) mySectProjLines.IsNull();
-  di << "\n mySectProjLinesHLR.IsNull = " << (Standard_Integer) mySectProjLinesHLR.IsNull();
-
-  Handle(GGraphic2d_SetOfCurves) setCurves;
-  Handle(Graphic2d_SetOfSegments) setSegments;
-
-  if(mySectProjLines->IsKind(STANDARD_TYPE(GGraphic2d_SetOfCurves)))
-  {
-    setCurves = Handle(GGraphic2d_SetOfCurves)::DownCast(mySectProjLines);
-    di << "\n Number of Curves in set = " << setCurves->Length();
-  }
-  if(mySectProjLines->IsKind(STANDARD_TYPE(Graphic2d_SetOfSegments)))    
-  {
-    setSegments = Handle(Graphic2d_SetOfSegments)::DownCast(mySectProjLines);
-    di << "\n Number of Curves in set = " << setSegments->Length();
-  }
-
-  Handle(GGraphic2d_SetOfCurves) setCurvesHLR;
-  Handle(Graphic2d_SetOfSegments) setSegmentsHLR;
-
-  if(mySectProjLinesHLR->IsKind(STANDARD_TYPE(GGraphic2d_SetOfCurves)))
-  {
-    setCurvesHLR = Handle(GGraphic2d_SetOfCurves)::DownCast(mySectProjLinesHLR);
-    di << "\n HLR Number of Curves in set = " << setCurvesHLR->Length();
-  }
-  if(mySectProjLinesHLR->IsKind(STANDARD_TYPE(Graphic2d_SetOfSegments)))
-  {
-    setSegmentsHLR = Handle(Graphic2d_SetOfSegments)::DownCast(mySectProjLinesHLR);
-    di << "\n HLR Number of Curves in set = " << setSegmentsHLR->Length();
-  }
-
-  aContext_2d->Display( myDisplayableShape,Standard_True );
-  return 0;
-}
-
-void QATelco::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QATelco";
-
-  theCommands.Add ("BUC60842", "BUC60842", __FILE__, BUC60842, group);
-  theCommands.Add ("BUC60843", "BUC60843 result_shape name_of_circle name_of_curve [ par1 [ tol ] ]", __FILE__, BUC60843, group);
-  theCommands.Add ("BUC60970", "BUC60970 shape result", __FILE__, BUC60970, group);
-  theCommands.Add ("BUC60818", "BUC60818", __FILE__, BUC60818, group);
-  theCommands.Add ("BUC60915", "BUC60915", __FILE__, BUC60915_1, group);
-  theCommands.Add ("OCC138", "OCC138", __FILE__, OCC138, group);
-  theCommands.Add ("BUC60821","BUC60821",__FILE__,BUC60821,group);
-  theCommands.Add ("OCC353","OCC353",__FILE__,OCC353,group);
-  theCommands.Add ("OCC280","OCC280 hlr=0/1 setsurfecedetail=0/1; set perspecrive view",__FILE__,OCC280,group);
-  theCommands.Add ("OCC232", "OCC232", __FILE__, OCC232 , group);
-  theCommands.Add ("OCC138LC", "OCC138LC", __FILE__, OCC138LC, group);
-  theCommands.Add ("OCC189", "OCC189", __FILE__, OCC189, group);
-  theCommands.Add ("OCC389", "OCC389 name shape1 [shape2] ...", __FILE__, OCC389, group);
-
-  theCommands.Add ("OCC566", "OCC566 shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box", __FILE__, OCC566, group);
-  theCommands.Add ("OCC570", "OCC570 result", __FILE__, OCC570, group);
-
-  theCommands.Add("OCC570mkevol",
-    "OCC570mkevol result object (then use updatevol) [R/Q/P]; mkevol",
-    __FILE__, MKEVOL,group);
-  theCommands.Add("OCC570updatevol",
-    "OCC570updatevol edge u1 rad1 u2 rad2 ...; updatevol",
-    __FILE__, UPDATEVOL,group);
-  theCommands.Add("OCC570updatevollaw",
-    "OCC570updatevollaw edge u1 rad1 u2 rad2 ...; updatevollaw",
-    __FILE__, UPDATEVOL,group);
-  theCommands.Add("OCC570buildevol",
-    "OCC570buildevol; end of the evol fillet computation",
-    __FILE__, BUILDEVOL,group);
-
-  theCommands.Add ("OCC606", "OCC606 result shape [-t]", __FILE__, OCC606, group);
-
-  theCommands.Add ("OCC813", "OCC813 U V", __FILE__, OCC813, group);
-  theCommands.Add ("OCC814", "OCC814", __FILE__, OCC814, group);
-  theCommands.Add ("OCC884", "OCC884 result shape [toler [maxtoler]]", __FILE__, OCC884, group);
-  theCommands.Add ("OCC1188", "OCC1188 imagefile [filltype] : Load image as background", __FILE__, OCC1188, group);
-
-  theCommands.Add ("OCC1174_1", "OCC1174_1 shape", __FILE__, OCC1174_1, group);
-  theCommands.Add ("OCC1174_2", "OCC1174_2 shape", __FILE__, OCC1174_2, group);
-
-  theCommands.Add("OCC672_Length"," OCC672_Length x1 y1 x2 y2 str scale_text length_dist angle_arrow length_arrow x3 y3 x4 y4 textAngle textPosH textPosV",__FILE__,OCC672_Length,group);
-  theCommands.Add("OCC672_Angle","OCC672_Angle x1 y1 x2 y2 x3 y3 aRadius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV",__FILE__,OCC672_Angle,group);
-  theCommands.Add("OCC672_Diameter","OCC672_Diameter x1 y1 cx cy radius aText aTxtScale anArrAngle anArrLength txtAngle txtPosH txtPosV",__FILE__,OCC672_Diameter,group);
-  theCommands.Add("OCC672_ShortLength","",__FILE__,OCC672_ShortLength,group);
-
-  theCommands.Add ("OCCN1", "OCCN1 angle fuse(1 for boss / 0 for slot) length", __FILE__, OCCN1, group);
-  theCommands.Add ("OCCN2", "OCCN2", __FILE__, OCCN2, group);
-
-  theCommands.Add ("OCC2569", "OCC2569 nbpoles result", __FILE__, OCC2569, group);
-
-  theCommands.Add ("OCC1642", "OCC1642 FinalWare FinalFace InitWare InitFace shape FixReorder FixDegenerated FixConnected FixSelfIntersection", __FILE__, OCC1642, group);
-
-  theCommands.Add ("OCC17480", "OCC17480 Shape", __FILE__, OCC17480, group);
-
-  return;
-}
diff --git a/src/QATelco/QATelco_MyText.cdl b/src/QATelco/QATelco_MyText.cdl
deleted file mode 100755 (executable)
index 76f9e32..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
--- Created on: 2002-04-10
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-class  MyText  from  QATelco  inherits  InteractiveObject  from  AIS 
-uses 
-    ExtendedString from TCollection, 
-    Pnt from gp, 
-    PresentationManager3d from PrsMgr, 
-    Presentation from Prs3d,
-    NameOfColor  from  Quantity,
-    Selection from SelectMgr
-is 
-    Create(aText  :ExtendedString  from  TCollection;aPosition  : Pnt  from  gp)
-    returns mutable MyText from QATelco;
-    Create(aText  :ExtendedString  from  TCollection;aPosition  : Pnt  from  gp;aFont :  CString from Standard; aColor : NameOfColor  from  Quantity; aHeight :Real  from  Standard)
-    returns mutable MyText from QATelco;
-
-    NbPossibleSelection(me)
-    returns Integer from Standard
-    is redefined virtual protected;
-    
-    Compute(me:mutable;
-            aPresentationManager: PresentationManager3d from PrsMgr;
-            aPresentation: mutable Presentation from Prs3d;
-            aMode: Integer from Standard = 0)
-    is redefined virtual protected;
-
-    ComputeSelection(me:mutable; aSelection :mutable Selection from SelectMgr;
-                                 aMode      : Integer) is redefined virtual protected;
-
-fields
-        myPosition                   : Pnt from gp;
-        myText                       : ExtendedString from TCollection;
-        myNameOfColor                : NameOfColor from Quantity;
-        myNameOfFont                 : CString from Standard;
-        myHeight                     : Real from Standard;
-end MyText;
-    
diff --git a/src/QATelco/QATelco_MyText.cxx b/src/QATelco/QATelco_MyText.cxx
deleted file mode 100755 (executable)
index 57fffac..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-// Created on: 2002-04-10
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QATelco_MyText.ixx>
-#include <QATelco_MyText.hxx>
-#include <Prs3d_Presentation.hxx>
-#include <Prs3d_TextAspect.hxx>
-#include <AIS_Drawer.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <Prs3d_Text.hxx>
-#include <Select3D_SensitiveBox.hxx>
-#include <SelectMgr_Selection.hxx>
-#include <Graphic3d_NameOfFont.hxx>
-
-/*************************************************************************
-*
-* CONSTRUCTION/DESTRUCTION
-*
-**************************************************************************/
-
-
-QATelco_MyText::QATelco_MyText(const TCollection_ExtendedString& aText, const gp_Pnt& aPosition, 
-                               const Standard_CString aFont, const Quantity_NameOfColor aColor, const Standard_Real aHeight)
-{
-  myPosition = aPosition;
-  myText = TCollection_ExtendedString(aText);
-  myNameOfFont = aFont;
-  myNameOfColor = aColor;
-  myHeight = aHeight;
-}
-
-
-/*************************************************************************
-*
-* QUERY METHODS
-*
-**************************************************************************/
-
-void QATelco_MyText::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
-                             const Handle(Prs3d_Presentation)& aPresentation,
-                             const Standard_Integer aMode ) 
-{
-  aPresentation->Clear();
-  Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
-
-  asp->SetFont(myNameOfFont);
-  asp->SetColor(myNameOfColor);
-  asp->SetHeight(myHeight); // I am changing the myHeight value
-  Prs3d_Text::Draw(aPresentation, asp, myText, myPosition);
-}
-
-void QATelco_MyText::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
-                                      const Standard_Integer aMode)
-{
-  // This code is here to compute the selection, erase this code if you don't what selection.
-
-  Handle( SelectMgr_EntityOwner ) own = new SelectMgr_EntityOwner(this, 7);
-
-  Handle( Select3D_SensitiveBox ) box = new Select3D_SensitiveBox(own,
-    myPosition.X(), 
-    myPosition.Y(),
-    myPosition.Z(), 
-    myPosition.X() + 20,
-    myPosition.Y() + 20,
-    myPosition.Z() + 20);
-  aSelection->Add(box);
-}
-
-
-Standard_Integer QATelco_MyText::NbPossibleSelection() const
-{
-  return 1;
-}
-
diff --git a/src/QAUsinor/QAUsinor.cdl b/src/QAUsinor/QAUsinor.cdl
deleted file mode 100755 (executable)
index 4496aea..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-03-19
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAUsinor
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAUsinor/QAUsinor.cxx b/src/QAUsinor/QAUsinor.cxx
deleted file mode 100755 (executable)
index 921bf97..0000000
+++ /dev/null
@@ -1,445 +0,0 @@
-// Created on: 2002-03-19
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-#if defined(WOKC40)
-#define V2D
-#define Viewer2dTest QAViewer2dTest
-#endif
-
-#include <QAUsinor.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <ViewerTest_Tool.hxx>
-#include <V3d_Viewer.hxx>
-#include <V3d_View.hxx>
-
-#include <ViewerTest_Tool.hxx>
-#include <V3d_Viewer.hxx>
-#include <V3d_View.hxx>
-#include <PCollection_HExtendedString.hxx>
-
-#include <TDocStd_Application.hxx>
-#include <TDocStd_Document.hxx>
-#include <DDocStd.hxx>
-#include <CDF.hxx>
-
-#include <Resource_Manager.hxx>
-
-#if defined(WOKC40)
-#include <QAViewer2dTest.hxx>
-#else
-#include <Viewer2dTest.hxx>
-#endif
-
-#include <V2d_View.hxx>
-#include <AIS2D_InteractiveObject.hxx>
-#include <Graphic2d_SetOfMarkers.hxx>
-#include <AIS2D.hxx>
-#include <AIS2D_InteractiveContext.hxx>
-#include <V2d_Viewer.hxx>
-
-#include <TopoDS_Wire.hxx>
-#include <BRepTools_WireExplorer.hxx>
-#include <TopoDS_Vertex.hxx>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-#include <TopExp.hxx>
-#include <Geom_Curve.hxx>
-#include <GCPnts_UniformAbscissa.hxx>
-#include <GeomAdaptor_Curve.hxx>
-#include <Standard_Assert.hxx>
-
-#define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
-
-static Quantity_NameOfColor GetColorFromName( const char *name, Standard_Boolean& Found) 
-{ 
-  Quantity_NameOfColor ret = DEFAULT_COLOR;
-  
-  Found = Standard_False;
-  Standard_CString colstring;
-  for(Standard_Integer i=0;i<=514 && !Found;i++)
-    {
-      colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
-      if (!strcasecmp(name,colstring)) {
-       ret = (Quantity_NameOfColor)i;
-       Found = Standard_True;
-       break;
-      }
-    }
-  
-  return ret;
-}
-
-
-static Standard_Integer BUC60851 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  Handle(AIS_InteractiveContext)   context= ViewerTest_Tool::MakeContext ("buc60851");
-  ViewerTest_Tool::InitViewerTest (context);
-  Handle(V3d_Viewer)  aV3dViewer= context->CurrentViewer();
-  Handle(V3d_View) aV3d_View = aV3dViewer->ActiveView();
-  for (Standard_Integer i=0;i<1000;++i) {
-    aV3d_View->TriedronDisplay();
-    aV3d_View->TriedronErase();
-  }
-  aV3d_View->TriedronDisplay();
-
-  return 0;
-}
-
-static Standard_Integer OCC216 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  Handle(PCollection_HExtendedString) HExtendedString = new PCollection_HExtendedString("");
-  HExtendedString.Nullify();
-  di << "OCC216: Deleting PCollection_HExtendedString initialized by empty string : OK" <<"\n";
-
-  return 0;
-}
-
-static Standard_Integer OCC267 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 3) {
-    di << "ERROR OCC267: Usage : " << argv[0] << " DOC path" << "\n";
-    return 1;
-  }
-
-  Handle(TDocStd_Document) D;
-  if (!DDocStd::GetDocument(argv[1],D)) return 1;
-  TCollection_ExtendedString path (argv[2]);
-  Handle(TDocStd_Application) A;
-  if (!DDocStd::Find(A)) return 1;
-
-  PCDM_StoreStatus theStatus = A->SaveAs(D,path);
-  if (theStatus == PCDM_SS_OK ) {
-    di << "OCC267 : PCDM_StoreStatus = PCDM_SS_OK" << "\n";
-  } else {
-    di << "OCC267 : PCDM_StoreStatus = Bad_Store_Status" << "\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC181 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 5) {
-    di << "ERROR OCC181: Usage : " << argv[0] << " FileName path1 path2 verbose=0/1" << "\n";
-    return 1;
-  }
-  Standard_CString aFileName = argv[1];
-  Standard_CString aDir1 = argv[2];
-  Standard_CString aDir2 = argv[3];
-  Standard_Integer verboseInt = atoi(argv[4]);
-
-  Standard_Boolean verboseBool = Standard_False;
-  if (verboseInt != 0) {
-   verboseBool = Standard_True;
-  }
-
-  TCollection_AsciiString Env1, Env2, CSF_ = "set env(CSF_";
-  Env1 = CSF_ + aFileName + "UserDefaults) " + aDir1;
-  Env2 = CSF_ + aFileName + "UserDefaults) " + aDir2;
-
-  di.Eval(Env1.ToCString());
-
-  Resource_Manager aManager(aFileName, verboseBool);
-
-  di.Eval(Env2.ToCString());
-
-  Standard_Boolean aStatus = aManager.Save();
-
-  if (aStatus) {
-    di << "\nOCC181 : Status = TRUE" << "\n";
-  } else {
-    di << "\nOCC181 : Status = FALSE" << "\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC402bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  if(aContext.IsNull()) { 
-    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  if ( !(argc == 7 || argc == 8) ) {
-    di << "ERROR : Usage : " << argv[0] << " IndexMarker>0 TypeOfDetection=0/1/2/3/4 X Y Width Height [Angle=0.0]" << "\n";
-    return 1;
-  }
-
-  Standard_Integer IndexMarker = atoi(argv[1]);
-  if (IndexMarker <= 0) { 
-    di << "ERROR : IndexMarker>0" << "\n";
-    return 1;
-  }
-
-  Standard_Integer TypeOfDetectionInteger = atoi(argv[2]);
-  AIS2D_TypeOfDetection TypeOfDetection;
-  switch (TypeOfDetectionInteger) {
-  case 0:
-  case 1:
-  case 2:
-  case 3:
-  case 4:
-    TypeOfDetection = (AIS2D_TypeOfDetection) TypeOfDetectionInteger;
-    break;
-  default:
-    di << "ERROR : TypeOfDetection=0/1/2/3/4" << "\n";
-    return 1;
-  }
-
-  Quantity_Length X = atof(argv[3]);
-  Quantity_Length Y = atof(argv[4]);
-  Quantity_Length Width  = atof(argv[5]);
-  Quantity_Length Height = atof(argv[6]);
-  Quantity_PlaneAngle  PlaneAngle;
-  if ( argc == 7) {
-    PlaneAngle = 0.0;
-  } else {
-    PlaneAngle = atof(argv[7]);
-  }
-
-  Handle(V2d_View) View = Viewer2dTest::CurrentView();
-  //Handle(V2d_Viewer) aViewer = ViewerTest::GetViewerFromContext();
-
-  Handle(AIS2D_InteractiveObject) obj = new AIS2D_InteractiveObject();
-  Handle(Graphic2d_SetOfMarkers) markers = new Graphic2d_SetOfMarkers( obj );
-
-  markers->Add(IndexMarker, X, Y, Width, Height, PlaneAngle);
-
-  aContext->Display( obj, Standard_False );
-  obj->SetHighlightMode( TypeOfDetection );
-  //aContext->SetDetectionMode( TypeOfDetection );
-
-  View->Fitall();
-
-  return 0;
-}
-
-static Standard_Real delta_percent (Standard_Real a, Standard_Real b)
-{
-  Standard_Real result;
-  if (b != 0.) {
-    result = fabs( (a - b) / b ) * 100.;
-  } else if (a != 0.) {
-    result = fabs( (a - b) / a ) * 100.;
-  } else {
-    result = 0.;
-  }
-  return result;
-}
-
-static Standard_Integer OCC367 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 7) {
-    di << "ERROR : Usage : " << argv[0] << " shape step goodX goodY goodZ percent_tolerance" << "\n";
-    return 1;
-  }
-
-  TopoDS_Wire myTopoDSWire = TopoDS::Wire(DBRep::Get(argv[1]));
-  Standard_Real l = atof(argv[2]);
-  Standard_Real goodX = atof(argv[3]);
-  Standard_Real goodY = atof(argv[4]);
-  Standard_Real goodZ = atof(argv[5]);
-  Standard_Real percent = atof(argv[6]);
-  Standard_Boolean Status = Standard_False;
-
-  // Find the first vertex of the wire
-  BRepTools_WireExplorer wire_exp(myTopoDSWire);
-  TopoDS_Vertex vlast;
-  {
-    TopoDS_Vertex vw1, vw2;
-    TopExp::Vertices(myTopoDSWire,vw1,vw2);
-    TopoDS_Vertex ve1, ve2;
-    TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
-    TopExp::Vertices(edge,ve1,ve2);
-    if (vw1.IsSame(ve1) || vw1.IsSame(ve2))
-      vlast = vw1;
-    else {
-      Standard_ASSERT_RAISE(vw2.IsSame(ve1) || vw2.IsSame(ve2), "Disconnected vertices");
-      vlast = vw2;
-    }
-  }
-  Standard_Integer EdgeIndex = 0;
-  Standard_Real FirstEdgeX, FirstEdgeY, FirstEdgeZ, deltaX, deltaY, deltaZ;
-  FirstEdgeX = FirstEdgeY = FirstEdgeZ = deltaX = deltaY = deltaZ = 0.;
-  for ( ; wire_exp.More(); wire_exp.Next())
-    {
-      EdgeIndex++;
-      di << "\n\n New Edge \n"   << "\n";
-      Standard_Real newufirst, newulast;
-      TopoDS_Edge edge = TopoDS::Edge(wire_exp.Current());
-      Standard_Real ufirst, ulast;
-      Handle(Geom_Curve) acurve;
-      TopoDS_Vertex ve1, ve2;
-      TopExp::Vertices(edge,ve1,ve2);
-      if (ve1.IsSame(vlast))
-       {
-          acurve = BRep_Tool::Curve(edge, ufirst, ulast);
-          newufirst = ufirst;
-          newulast  = ulast;
-          vlast = ve2;
-       }
-      else
-       {
-          Standard_ASSERT_RAISE(ve2.IsSame(vlast), "Not the same vertex");
-          Standard_ASSERT_RAISE(wire_exp.Orientation() == TopAbs_REVERSED, "Wire should be REVERSED");
-          acurve = BRep_Tool::Curve( edge, ufirst, ulast );
-          newufirst = acurve->ReversedParameter( ufirst );
-          newulast  = acurve->ReversedParameter( ulast );
-          acurve = acurve->Reversed( );
-          vlast = ve1;
-       }
-      
-      GeomAdaptor_Curve   curve;
-      GCPnts_UniformAbscissa  algo;
-      curve.Load(acurve);
-      algo.Initialize( curve, l, newufirst, newulast );
-      if (!algo.IsDone())
-        di << "Not Done!!!"   << "\n";
-      Standard_Integer maxIndex =algo.NbPoints();
-      for (Standard_Integer Index = 1; Index<=maxIndex;Index++) {
-        Standard_Real t = algo.Parameter(Index);
-        gp_Pnt      pt3 = curve.Value(t);
-        di << "Parameter t = " << t   << "\n";
-        di << "Value Pnt = " << pt3.X()<<" " <<pt3.Y()<<" " << pt3.Z()  << "\n";
-       if (EdgeIndex == 1 && Index == maxIndex) {
-         FirstEdgeX = pt3.X();
-         FirstEdgeY = pt3.Y();
-         FirstEdgeZ = pt3.Z();
-         deltaX = delta_percent(FirstEdgeX, goodX);
-         deltaY = delta_percent(FirstEdgeY, goodY);
-         deltaZ = delta_percent(FirstEdgeZ, goodZ);
-         if (deltaX <= percent && deltaY <= percent && deltaZ <= percent) {
-           Status = Standard_True;
-         }
-       }
-      }
-    }
-  di << "\n\nFirstEdge = " << FirstEdgeX <<" " << FirstEdgeY <<" " << FirstEdgeZ << "\n";
-  di << "deltaX = " << deltaX << " deltaY = " << deltaY << " deltaZ = " << deltaZ << "\n";
-  if (Status) {
-    di << argv[0] << " : OK" << "\n";
-  } else {
-    di << argv[0] << " : ERROR" << "\n";
-  }
-
-  return 0;
-}
-
-static Standard_Integer OCC71bug (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** argv)
-{
-  Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
-  if(aContext.IsNull()) { 
-    di << argv[0] << "ERROR : use 'vinit' command before " << "\n";
-    return 1;
-  }
-
-  Handle(V3d_View) V3dView = ViewerTest::CurrentView();
-  V3dView->EnableGLLight( Standard_False );  
-  V3dView->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_WHITE, 0.07);
-  aContext->UpdateCurrentViewer();
-  return 0;
-}
-
-static Standard_Integer OCC403bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  if(aContext.IsNull()) { 
-    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-
-  if ( argc != 3) {
-    di << "ERROR : Usage : " << argv[0] << " ColorName1 ColorName2" << "\n";
-    return 1;
-  }
-
-  Standard_Boolean Found;
-  Quantity_NameOfColor NameOfColor1 = GetColorFromName(argv[1] ,Found);
-  if ( !Found ) {
-    di << "ERROR: " << argv[1] << " - color not found" << "\n";
-    return 1;
-  }
-  Quantity_NameOfColor NameOfColor2 = GetColorFromName(argv[2] ,Found);
-  if ( !Found ) {
-    di << "ERROR: " << argv[2] << " - color not found" << "\n";
-    return 1;
-  }
-
-  Quantity_Color Color1(NameOfColor1);
-  Quantity_Color Color2(NameOfColor2);
-
-  Handle(V2d_View) View = Viewer2dTest::CurrentView();
-  Handle(V2d_Viewer) Viewer = View->Viewer();
-  Viewer->SetGridColor(Color1, Color2);
-
-  return 0;
-}
-
-static Standard_Integer OCC404bug (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  Handle(AIS2D_InteractiveContext) aContext = Viewer2dTest::GetAIS2DContext();
-  if(aContext.IsNull()) { 
-    di << "ERROR: Use 'v2dinit' command before " << argv[0] << "\n";
-    return 1;
-  }
-  if ( argc != 4) {
-    di << "ERROR : Usage : " << argv[0] << " R G B" << "\n";
-    return 1;
-  }
-
-  Quantity_Parameter R1 = (Quantity_Parameter) atof(argv[1]);
-  Quantity_Parameter R2 = (Quantity_Parameter) atof(argv[2]);
-  Quantity_Parameter R3 = (Quantity_Parameter) atof(argv[3]);
-
-  Quantity_Color Color;
-  Color.SetValues(R1, R2, R3, Quantity_TOC_RGB);
-
-  Handle(V2d_View) View = Viewer2dTest::CurrentView();
-  View->SetBackground(Color);
-  View->Update();
-
-  return 0;
-}
-
-void QAUsinor::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAUsinor";
-
-  theCommands.Add("BUC60851", "BUC60851", __FILE__, BUC60851, group);
-  theCommands.Add("OCC216", "OCC216", __FILE__, OCC216, group);
-  theCommands.Add("OCC267", "OCC267 DOC path", __FILE__, OCC267, group);
-  theCommands.Add("OCC181", "OCC181 FileName path1 path2 verbose=0/1", __FILE__, OCC181, group);
-  theCommands.Add("OCC402", "OCC402 TypeOfDetection=0/1/2/3/4 X Y Width Height [Angle=0.0]", __FILE__, OCC402bug, group);
-  theCommands.Add("OCC367", "OCC367 shape step goodX goodY goodZ percent_tolerance", __FILE__, OCC367, group);
-  theCommands.Add("OCC71", "OCC71", __FILE__, OCC71bug, group);
-  theCommands.Add("OCC403", "OCC403 ColorName1 ColorName2", __FILE__, OCC403bug, group);
-  theCommands.Add("OCC404", "OCC404 R G B; Set Background Color", __FILE__, OCC404bug, group);
-
-  return;
-}
diff --git a/src/QAYasaki/QAYasaki.cdl b/src/QAYasaki/QAYasaki.cdl
deleted file mode 100755 (executable)
index 9cdf73a..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
--- Created on: 2002-05-21
--- Created by: QA Admin
--- Copyright (c) 2002-2012 OPEN CASCADE SAS
---
--- The content of this file is subject to the Open CASCADE Technology Public
--- License Version 6.5 (the "License"). You may not use the content of this file
--- except in compliance with the License. Please obtain a copy of the License
--- at http://www.opencascade.org and read it completely before using this file.
---
--- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
--- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
---
--- The Original Code and all software distributed under the License is
--- distributed on an "AS IS" basis, without warranty of any kind, and the
--- Initial Developer hereby disclaims all such warranties, including without
--- limitation, any warranties of merchantability, fitness for a particular
--- purpose or non-infringement. Please see the License for the specific terms
--- and conditions governing the rights and limitations under the License.
-
-
-package QAYasaki
-     uses Draw
-is
-    Commands(DI : in out Interpretor from Draw);
-end;
diff --git a/src/QAYasaki/QAYasaki.cxx b/src/QAYasaki/QAYasaki.cxx
deleted file mode 100755 (executable)
index 44dc409..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-// Created on: 2002-05-21
-// Created by: QA Admin
-// Copyright (c) 2002-2012 OPEN CASCADE SAS
-//
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
-//
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-//
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
-
-
-
-#include <QAYasaki.hxx>
-
-#include <Draw_Interpretor.hxx>
-#include <DBRep.hxx>
-#include <DrawTrSurf.hxx>
-#include <AIS_InteractiveContext.hxx>
-#include <ViewerTest.hxx>
-#include <AIS_Shape.hxx>
-#include <TopoDS_Shape.hxx>
-
-#include <gp_Pnt2d.hxx>
-#include <GCE2d_MakeSegment.hxx>
-#include <Geom2d_TrimmedCurve.hxx>
-#include <DrawTrSurf.hxx>
-
-#include <PCollection_HAsciiString.hxx>
-
-//static Standard_Integer OCC230 (Draw_Interpretor& /*di*/, Standard_Integer /*argc*/, const char ** /*argv*/)
-static Standard_Integer OCC230 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
-{
-  if ( argc != 4) {
-    di << "ERROR OCC230: Usage : " << argv[0] << " TrimmedCurve Pnt2d Pnt2d" << "\n";
-    return 1;
-  }
-
-  gp_Pnt2d P1, P2;
-  if ( !DrawTrSurf::GetPoint2d(argv[2],P1)) {
-    di << "ERROR OCC230: " << argv[2] << " is not Pnt2d" << "\n";
-    return 1;
-  }
-  if ( !DrawTrSurf::GetPoint2d(argv[3],P2)) {
-    di << "ERROR OCC230: " << argv[3] << " is not Pnt2d" << "\n";
-    return 1;
-  }
-
-  GCE2d_MakeSegment MakeSegment(P1,P2);
-  Handle(Geom2d_TrimmedCurve) TrimmedCurve = MakeSegment.Value();
-  DrawTrSurf::Set(argv[1], TrimmedCurve);
-  return 0;
-}
-
-static Standard_Integer OCC142 (Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
-{
-  for(Standard_Integer i= 0;i <= 20;i++){
-    Handle(PCollection_HAsciiString) pstr = new PCollection_HAsciiString("TEST");
-    pstr->Clear();
-  }
-  di << "OCC142: OK" << "\n";
-  return 0;
-}
-
-void QAYasaki::Commands(Draw_Interpretor& theCommands) {
-  char *group = "QAYasaki";
-
-  theCommands.Add ("OCC230", "OCC230 TrimmedCurve Pnt2d Pnt2d", __FILE__, OCC230, group);
-  theCommands.Add ("OCC142", "OCC142", __FILE__, OCC142, group);
-
-  return;
-}
index a6781e6c0f10cb98632130aedb316dbbf53df74f..3b6271d2e8aa25bc70b38ec5fe781a413a4ebd23 100755 (executable)
@@ -1,28 +1,8 @@
 DebugTools
-QAAMINO
-QAAlcatel
-QABRGM
-QABUC
-QACADCAM
-QACEADRT
+QABugs
 QADNaming
 QADraw
-QAInsynchro
-QAMARTEC
-QAMitutoyoUK
-QAMitutoyoUS
 QANCollection
-QANIC
 QANewBRepNaming
 QANewDBRepNaming
 QANewModTopOpe
-QAOCC
-QAQuickPen
-QARicardo
-QARina
-QARoutelous
-QASamtech
-QATelco
-QAUsinor
-QAViewer2dTest
-QAYasaki