0028661: BRepOffsetAPI_MakePipeShell throws an exception Standard_NoSuchObject: NColl...
[occt.git] / src / BRepTest / BRepTest_FilletCommands.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 0f6f035..1f4d76f
@@ -1,22 +1,25 @@
-// File:       DBRep_9.cxx
-// Created:    Mon Jun 20 12:32:34 1994
-// Author:     Modeling
-//             <modeling@phylox>
+// Created on: 1994-06-20
+// Created by: Modeling
+// Copyright (c) 1994-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <string.h>
 #include <BRepTest.hxx>
 #include <TColgp_Array1OfPnt2d.hxx>
 #include <DBRep.hxx>
 #include <Draw_Interpretor.hxx>
 #include <Draw_Appli.hxx>
 #include <BRepFilletAPI_MakeFillet.hxx>
-#include <BRepAlgo_BooleanOperation.hxx>
-#include <BRepAlgo_Fuse.hxx>
-#include <BRepAlgo_Cut.hxx>
 #include <BiTgte_Blend.hxx>
 #include <TopOpeBRepBuild_HBuilder.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
@@ -29,7 +32,8 @@
 #include <TopExp.hxx>
 #include <TopExp_Explorer.hxx>
 
-#include <BOPTools_DSFiller.hxx>
+#include <BOPAlgo_PaveFiller.hxx>
+
 #include <BRepAlgoAPI_BooleanOperation.hxx>
 #include <BRepAlgoAPI_Fuse.hxx>
 #include <BRepAlgoAPI_Cut.hxx>
 #include <FilletSurf_Builder.hxx>
 #include <ChFi3d_FilletShape.hxx>
 #include <Geom_TrimmedCurve.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom2d_Curve.hxx>
 #include <TopTools_ListOfShape.hxx>
 #include <FilletSurf_StatusType.hxx>
 #include <FilletSurf_ErrorTypeStatus.hxx>
 #include <TopAbs.hxx>
 #include <DrawTrSurf.hxx>
 
-#ifdef WNT
-//#define strcasecmp strcmp Already defined
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
 #include <stdio.h>
-//#endif
 
 
 static Standard_Real t3d = 1.e-4;
@@ -76,26 +76,24 @@ static Standard_Integer contblend(Draw_Interpretor& di, Standard_Integer narg, c
     switch (blend_cont) {
       case GeomAbs_C0:
          //cout << ""<<endl;
-         di << "C0"<<"\n";
+         di << "C0\n";
         break;
       case GeomAbs_C1:
          //cout << "C1"<<endl;
-         di << "C1"<<"\n";
+         di << "C1\n";
         break;
       case GeomAbs_C2:
          //cout << "C2"<<endl;
-         di << "C2"<<"\n";
+         di << "C2\n";
         break;
-#ifndef DEB
        default:
         break;
-#endif
        }
     return 0;
   }
   else {
     if (narg >3) return 1;
-    if (narg == 3) {  tapp_angle = Abs(atof(a[2])); }
+    if (narg == 3) {  tapp_angle = Abs(Draw::Atof(a[2])); }
     char c=a[1][1];
     switch (c) {
     case '0':
@@ -135,10 +133,10 @@ static Standard_Integer tolblend(Draw_Interpretor& di, Standard_Integer narg, co
     return 0;
   }
   else if(narg == 5){
-    ta = atof(a[1]);
-    t3d = atof(a[2]);
-    t2d = atof(a[3]);
-    fl = atof(a[4]);
+    ta = Draw::Atof(a[1]);
+    t3d = Draw::Atof(a[2]);
+    t2d = Draw::Atof(a[3]);
+    fl = Draw::Atof(a[4]);
     return 0;
   }
   return 1;
@@ -166,7 +164,7 @@ static Standard_Integer BLEND(Draw_Interpretor& di, Standard_Integer narg, const
   TopoDS_Edge E;
   Standard_Integer nbedge = 0;
   for (Standard_Integer ii = 1; ii < (narg-1)/2; ii++){
-    Rad = atof(a[2*ii + 1]);
+    Rad = Draw::Atof(a[2*ii + 1]);
     TopoDS_Shape aLocalEdge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE));
     E = TopoDS::Edge(aLocalEdge);
 //    E = TopoDS::Edge(DBRep::Get(a[(2*ii+2)],TopAbs_EDGE));
@@ -193,13 +191,13 @@ static void PrintHist(const TopoDS_Shape& S,
   B.Add(C,S);
   char localname[100];
   if(nbgen<10){
-    sprintf(localname,"generated_00%d", nbgen++);
+    Sprintf(localname,"generated_00%d", nbgen++);
   }
   else if(nbgen<100){
-    sprintf(localname,"generated_0%d", nbgen++);
+    Sprintf(localname,"generated_0%d", nbgen++);
   }
   else {
-    sprintf(localname,"generated_%d", nbgen++);
+    Sprintf(localname,"generated_%d", nbgen++);
   }
   for(; It.More(); It.Next()){
     B.Add(C,It.Value());
@@ -212,13 +210,13 @@ static Standard_Integer CheckHist(Draw_Interpretor& di,
                                  const char** )
 {
   if(Rakk == 0) {
-    //cout<<"Pas de Builder actif"<<endl;
-    di<<"Pas de Builder actif"<<"\n";
+    //cout<<"No active Builder"<<endl;
+    di<<"No active Builder\n";
     return 1;
   }
   if(!Rakk->IsDone()) {
-    //cout<<"Builder actif Not Done"<<endl;
-    di<<"Builder actif Not Done"<<"\n";
+    //cout<<"Active Builder Not Done"<<endl;
+    di<<"Active Builder Not Done\n";
     return 1;
   }
   Standard_Integer nbc = Rakk->NbContours();
@@ -240,7 +238,7 @@ static Standard_Integer CheckHist(Draw_Interpretor& di,
     PrintHist(curshape,It,nbgen);
   }
   //cout<<"foreach g [lsort [dir gen*]] { wclick; puts [dname $g]; donl $g; }"<<endl;
-  di<<"foreach g [lsort [dir gen*]] { wclick; puts [dname $g]; donl $g; }"<<"\n";
+  di<<"foreach g [lsort [dir gen*]] { wclick; puts [dname $g]; donl $g; }\n";
   return 0;
 }
 
@@ -274,8 +272,8 @@ static Standard_Integer UPDATEVOL(Draw_Interpretor& di,
                                  const char** a)
 {
   if(Rake == 0){
-    //cout << "MakeFillet non initialise"<<endl;
-    di << "MakeFillet non initialise"<<"\n";
+    //cout << "MakeFillet not initialized"<<endl;
+    di << "MakeFillet not initialized\n";
     return 1 ;
   }
   if(narg%2 != 0 || narg < 4) return 1;
@@ -285,8 +283,8 @@ static Standard_Integer UPDATEVOL(Draw_Interpretor& di,
   TopoDS_Edge E = TopoDS::Edge(aLocalEdge);
 //  TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[1],TopAbs_EDGE));
   for (Standard_Integer ii = 1; ii <= (narg/2)-1; ii++){
-    Par = atof(a[2*ii]);
-    Rad = atof(a[2*ii + 1]);
+    Par = Draw::Atof(a[2*ii]);
+    Rad = Draw::Atof(a[2*ii + 1]);
     uandr.ChangeValue(ii).SetCoord(Par,Rad);
   }
   Rake->Add(uandr,E);
@@ -298,8 +296,8 @@ static Standard_Integer BUILDEVOL(Draw_Interpretor& di,
                                  const char**)
 {
   if(Rake == 0){
-    //cout << "MakeFillet non initialise"<<endl;
-    di << "MakeFillet non initialise"<<"\n";
+    //cout << "MakeFillet not initialized"<<endl;
+    di << "MakeFillet not initialized\n";
     return 1 ;
   }
   Rake->Build();
@@ -316,62 +314,6 @@ static Standard_Integer BUILDEVOL(Draw_Interpretor& di,
 
 
 
-//**********************************************
-// commande  des fusions et coupes avec conges *
-//**********************************************
-
-Standard_Integer topoblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
-{
-  printtolblend(di);
-  if(narg != 5) return 1;
-  Standard_Boolean fuse  = !strcmp(a[0],"fubl");
-  TopoDS_Shape S1 = DBRep::Get(a[2]);
-  TopoDS_Shape S2 = DBRep::Get(a[3]);
-  Standard_Real Rad = atof(a[4]);
-  BRepAlgo_BooleanOperation* BC;
-  if(fuse){
-    BC = new BRepAlgo_Fuse(S1,S2);
-  }
-  else{
-    BC = new BRepAlgo_Cut(S1,S2);
-  }
-  TopoDS_Shape ShapeCut = BC->Shape();
-  
-  Handle(TopOpeBRepBuild_HBuilder) build = BC->Builder();
-  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);
-    its = build->Section();
-    while (its.More()) {
-      TopoDS_Edge E = TopoDS::Edge(its.Value());
-      fill.Add(Rad,E);
-      its.Next();
-    }
-    
-    fill.Build();
-    if(fill.IsDone()){
-      B.Add(result,fill.Shape());
-    }
-    else {
-      B.Add(result,cutsol);
-    }
-  }
-  
-  delete BC;
-  DBRep::Set(a[1],result);
-  return 0;
-}
-
 //**********************************************
 // bfuse or bcut and then blend the section
 //**********************************************
@@ -379,7 +321,11 @@ Standard_Integer topoblend(Draw_Interpretor& di, Standard_Integer narg, const ch
 Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const char** a)
 {
   printtolblend(di);
-  if(narg != 5) return 1;
+  if(narg < 5)
+  {
+    cout << "Use <command name> result shape1 shape2 radius [-d]" << endl;
+    return 1;
+  }
 
   Standard_Boolean fuse  = !strcmp(a[0],"bfuseblend");
   TopoDS_Shape S1 = DBRep::Get(a[2]);
@@ -388,17 +334,28 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
     printf(" Null shapes are not allowed \n");
     return 1;
   }
-  Standard_Real Rad = atof(a[4]);
+  Standard_Real Rad = Draw::Atof(a[4]);
+  Standard_Boolean isDebug = Standard_False;
 
-  BOPTools_DSFiller theDSFiller;
+  if(narg == 6)
+  {
+    if(!strcmp(a[5], "-d"))
+    {
+      isDebug = Standard_True;
+    }
+  }
 
-  theDSFiller.SetShapes( S1, S2 );
-  if (!theDSFiller.IsDone()) {
+  BOPAlgo_PaveFiller theDSFiller;
+  BOPCol_ListOfShape aLS;
+  aLS.Append(S1); 
+  aLS.Append(S2); 
+  theDSFiller.SetArguments(aLS);
+  //
+  theDSFiller.Perform();
+  if (theDSFiller.ErrorStatus()) {
     printf("Check types of the arguments, please\n");
     return 1;
   }
-  
-  theDSFiller.Perform();
 
   BRepAlgoAPI_BooleanOperation* pBuilder=NULL;
 
@@ -409,44 +366,67 @@ Standard_Integer boptopoblend(Draw_Interpretor& di, Standard_Integer narg, const
 
   Standard_Boolean anIsDone = pBuilder->IsDone();
   if (!anIsDone)
-    {
-      printf("boolean operation not done ErrorStatus()=%d\n", pBuilder->ErrorStatus());
-      return 1;
-    }
+  {
+    printf("boolean operation not done ErrorStatus()=%d\n", pBuilder->ErrorStatus());
+    return 1;
+  }
 
   TopoDS_Shape ResultOfBop = pBuilder->Shape();
   
   delete pBuilder;
+
+  const int aStrLen = 1000;
+  char aBuff[aStrLen];
+
+  if(isDebug)
+  {
+    strcpy(aBuff, a[1]);
+    DBRep::Set( strcat(aBuff, "_bop"), ResultOfBop );
+
+    di << "Intermediate result of BOP-operation is saved to \"" << aBuff << "\" variable\n";
+  }
+
   pBuilder = new BRepAlgoAPI_Section( S1, S2, theDSFiller );
   TopoDS_Shape theSection = pBuilder->Shape();
 
+  if(isDebug)
+  {
+    strcpy(aBuff, a[1]);
+    DBRep::Set( strcat(aBuff, "_sec"), theSection );
+     di << "Intermediate bopsection result is saved to \"" << aBuff << "\" variable\n";
+  }
+
   TopoDS_Compound result;
   BRep_Builder BB; 
   BB.MakeCompound(result);
   
   TopExp_Explorer Explo( ResultOfBop, TopAbs_SOLID );
   for (; Explo.More(); Explo.Next())
+  {
+    const TopoDS_Shape& aSolid = Explo.Current();
+
+    BRepFilletAPI_MakeFillet Blender(aSolid);
+    Blender.SetParams(ta,t3d,t2d,t3d,t2d,fl);
+    Blender.SetContinuity( blend_cont, tapp_angle );
+
+    TopExp_Explorer expsec( theSection, TopAbs_EDGE );
+    for (; expsec.More(); expsec.Next())
     {
-      const TopoDS_Shape& aSolid = Explo.Current();
-
-      BRepFilletAPI_MakeFillet Blender(aSolid);
-      Blender.SetParams(ta,t3d,t2d,t3d,t2d,fl);
-      Blender.SetContinuity( blend_cont, tapp_angle );
-
-      TopExp_Explorer expsec( theSection, TopAbs_EDGE );
-      for (; expsec.More(); expsec.Next())
-       {
-         TopoDS_Edge anEdge = TopoDS::Edge(expsec.Current());
-         Blender.Add( Rad, anEdge );
-       }
-
-      Blender.Build();
-      if (Blender.IsDone())
-       BB.Add( result, Blender.Shape() );
-      else
-       BB.Add( result, aSolid );
+      TopoDS_Edge anEdge = TopoDS::Edge(expsec.Current());
+      Blender.Add( Rad, anEdge );
     }
 
+    Blender.Build();
+    if (Blender.IsDone())
+      BB.Add( result, Blender.Shape() );
+    else
+    {
+      di << "Error: Cannot find the result of BLEND-operation."
+        " The result of BOP operation will be returned.\n";
+      BB.Add( result, aSolid );
+    }
+  }
+
   delete pBuilder;
   DBRep::Set( a[1], result );
   return 0;
@@ -462,7 +442,7 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
   Standard_Real Rad;
   Standard_Boolean simul=Standard_False;
   const char *ns0=(a[1]);
-  Rad = atof(a[3]);
+  Rad = Draw::Atof(a[3]);
   TopTools_ListOfShape E;
   for (i=4; i <=(narg-1) ; i++){
     TopoDS_Shape edge= DBRep::Get(a[i],TopAbs_EDGE);
@@ -470,9 +450,9 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
    if(edge.ShapeType()!=TopAbs_EDGE) return 1;
     E.Append(edge);
   } 
-  FilletSurf_Builder Rakk(V,E,Rad);
-  if (simul) Rakk.Simulate();
-  else  Rakk.Perform();
+  FilletSurf_Builder aRakk(V,E,Rad);
+  if (simul) aRakk.Simulate();
+  else  aRakk.Perform();
 
   //if (Rakk.IsDone()==FilletSurf_IsNotOk) 
   // { FilletSurf_ErrorTypeStatus err=Rakk.StatusError();
@@ -486,20 +466,20 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
   // }
   // else {
   //  if (Rakk.IsDone()==FilletSurf_IsPartial) cout <<"resultat partiel"<<endl; 
-  if (Rakk.IsDone()==FilletSurf_IsNotOk) 
-   { FilletSurf_ErrorTypeStatus err=Rakk.StatusError();
-     if (err==FilletSurf_EmptyList) di<< "StatusError=EmptyList"<<"\n";
-     else if (err==FilletSurf_EdgeNotG1) di<< "StatusError=NotG1"<<"\n";
-     else if (err==FilletSurf_FacesNotG1) di<< "StatusError=facesNotG1"<<"\n";   
-     else if (err==FilletSurf_EdgeNotOnShape) 
-     di<< "StatusError=edgenotonshape"<<"\n";
-     else if (err==FilletSurf_NotSharpEdge ) di<< "StatusError=notsharpedge"<<"\n";
-     else if (err==FilletSurf_PbFilletCompute) di <<"StatusError=PBFillet"<<"\n";
+  if (aRakk.IsDone()==FilletSurf_IsNotOk)
+   { FilletSurf_ErrorTypeStatus err=aRakk.StatusError();
+     if (err==FilletSurf_EmptyList) di<< "StatusError=EmptyList\n";
+     else if (err==FilletSurf_EdgeNotG1) di<< "StatusError=NotG1\n";
+     else if (err==FilletSurf_FacesNotG1) di<< "StatusError=facesNotG1\n";
+     else if (err==FilletSurf_EdgeNotOnShape)
+     di<< "StatusError=edgenotonshape\n";
+     else if (err==FilletSurf_NotSharpEdge ) di<< "StatusError=notsharpedge\n";
+     else if (err==FilletSurf_PbFilletCompute) di <<"StatusError=PBFillet\n";
    }
    else {
-    if (Rakk.IsDone()==FilletSurf_IsPartial) di <<"resultat partiel"<<"\n"; 
+    if (aRakk.IsDone()==FilletSurf_IsPartial) di <<"partial result\n";
  
-    nb=Rakk.NbSurface();
+    nb=aRakk.NbSurface();
     char localname [100];
     char *temp; 
     
@@ -507,18 +487,18 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
     
    if (!simul)
    { 
-    //if (Rakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge) 
+    //if (Rakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge)
     //  {cout<<" type deb conges = WLBLOUT"<<endl;}
-    //else if (Rakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge ) 
+    //else if (Rakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge )
     //  { cout<<" type deb conges = WLBLSTOP"<<endl;}
     //else if (Rakk.StartSectionStatus()==FilletSurf_TwoExtremityOnEdge)
     //  {cout<<" type deb conges = WLBLEND"<<endl;}
-    if (Rakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge) 
-      {di<<" type deb conges = WLBLOUT"<<"\n";}
-    else if (Rakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge ) 
-      { di<<" type deb conges = WLBLSTOP"<<"\n";}
-    else if (Rakk.StartSectionStatus()==FilletSurf_TwoExtremityOnEdge)
-      {di<<" type deb conges = WLBLEND"<<"\n";}
+    if (aRakk.StartSectionStatus()==FilletSurf_NoExtremityOnEdge)
+      {di<<" type start fillets = WLBLOUT\n";}
+    else if (aRakk.StartSectionStatus()==FilletSurf_OneExtremityOnEdge)
+      { di<<" type start fillets = WLBLSTOP\n";}
+    else if (aRakk.StartSectionStatus()==FilletSurf_TwoExtremityOnEdge)
+      {di<<" type start fillets = WLBLEND\n";}
     
     //if (Rakk.EndSectionStatus()==FilletSurf_NoExtremityOnEdge) 
     //  {cout<<" type fin  conges = WLBLOUT"<<endl;}
@@ -526,68 +506,68 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
     //  {cout<<" type fin  conges = WLBLSTOP"<<endl;}
     //else if (Rakk.EndSectionStatus()==FilletSurf_TwoExtremityOnEdge) 
     //  { cout<<" type fin  conges = WLBLEND"<<endl;}
-    if (Rakk.EndSectionStatus()==FilletSurf_NoExtremityOnEdge) 
-      {di<<" type fin  conges = WLBLOUT"<<"\n";}
-    else if (Rakk.EndSectionStatus()==FilletSurf_OneExtremityOnEdge) 
-      {di<<" type fin  conges = WLBLSTOP"<<"\n";}
-    else if (Rakk.EndSectionStatus()==FilletSurf_TwoExtremityOnEdge) 
-      { di<<" type fin  conges = WLBLEND"<<"\n";}
+    if (aRakk.EndSectionStatus()==FilletSurf_NoExtremityOnEdge)
+      {di<<" type end fillets = WLBLOUT\n";}
+    else if (aRakk.EndSectionStatus()==FilletSurf_OneExtremityOnEdge)
+      {di<<" type end fillets = WLBLSTOP\n";}
+    else if (aRakk.EndSectionStatus()==FilletSurf_TwoExtremityOnEdge)
+      { di<<" type end fillets = WLBLEND\n";}
     Standard_Real f,l;
-    f = Rakk.FirstParameter();
-    l = Rakk.LastParameter();
-    //cout<<"parametre sur edge debut : "<<f<<endl;
-    //cout<<"parametre sur edge fin   : "<<l<<endl;
-    di<<"parametre sur edge debut : "<<f<<"\n";
-    di<<"parametre sur edge fin   : "<<l<<"\n";
+    f = aRakk.FirstParameter();
+    l = aRakk.LastParameter();
+    //cout<<"parameter on edge start : "<<f<<endl;
+    //cout<<"parameter on edge end   : "<<l<<endl;
+    di<<"parametre on edge start : "<<f<<"\n";
+    di<<"parametre on edge end   : "<<l<<"\n";
     for (i=1;i<=nb;i++){
       //precision 
       //cout<<"precision "<< i << "= "<<Rakk.TolApp3d(i)<<endl;
-      di<<"precision "<< i << "= "<<Rakk.TolApp3d(i)<<"\n";
+      di<<"precision "<< i << "= "<<aRakk.TolApp3d(i)<<"\n";
       
-      // affichage des surfaces resultats 
-      sprintf(localname, "%s%d" ,ns0,i);
+      // display resulting surfaces  
+      Sprintf(localname, "%s%d" ,ns0,i);
       temp = localname;
-      DrawTrSurf::Set(temp,Rakk.SurfaceFillet(i));
+      DrawTrSurf::Set(temp,aRakk.SurfaceFillet(i));
       di << localname<< " ";
       
-      //affichage des courbes 3d 
-      sprintf(localname, "%s%d" ,"courb1",i);
+      // display curves 3d 
+      Sprintf(localname, "%s%d" ,"courb1",i);
       temp =localname; 
-      DrawTrSurf::Set(temp,Rakk.CurveOnFace1(i));
+      DrawTrSurf::Set(temp,aRakk.CurveOnFace1(i));
       di << localname<< " ";
-      sprintf(localname, "%s%d" ,"courb2",i);
+      Sprintf(localname, "%s%d" ,"courb2",i);
       temp =localname;
-      DrawTrSurf::Set(temp,Rakk.CurveOnFace2(i));
+      DrawTrSurf::Set(temp,aRakk.CurveOnFace2(i));
       di << localname<< " ";     
       
-      // affichage des supports 
-      sprintf(localname, "%s%d" ,"face1",i);
+      // display supports 
+      Sprintf(localname, "%s%d" ,"face1",i);
       temp =localname ;
-      DBRep::Set(temp,Rakk.SupportFace1(i));
+      DBRep::Set(temp,aRakk.SupportFace1(i));
       di << localname<< " ";
-      sprintf(localname, "%s%d" ,"face2",i);
+      Sprintf(localname, "%s%d" ,"face2",i);
       temp =localname; 
-      DBRep::Set(temp,Rakk.SupportFace2(i));
+      DBRep::Set(temp,aRakk.SupportFace2(i));
       di << localname<< " ";
       
-      // affichage des Pcurve sur les faces 
-      sprintf(localname, "%s%d" ,"pcurveonface1",i);
+      // display Pcurves on faces 
+      Sprintf(localname, "%s%d" ,"pcurveonface1",i);
       temp =localname ;
-      DrawTrSurf::Set(temp,Rakk.PCurveOnFace1(i));
+      DrawTrSurf::Set(temp,aRakk.PCurveOnFace1(i));
       di << localname<< " ";
-      sprintf(localname, "%s%d" ,"pcurveonface2",i);
+      Sprintf(localname, "%s%d" ,"pcurveonface2",i);
       temp =localname; 
-      DrawTrSurf::Set(temp,Rakk.PCurveOnFace2(i));
+      DrawTrSurf::Set(temp,aRakk.PCurveOnFace2(i));
       di << localname<< " ";
       
-      // affichage des Pcurve sur le conge
-      sprintf(localname, "%s%d" ,"pcurveonconge1",i);
+      // display Pcurves on the fillet
+      Sprintf(localname, "%s%d" ,"pcurveonconge1",i);
       temp =localname;
-      DrawTrSurf::Set(temp,Rakk.PCurve1OnFillet(i));
+      DrawTrSurf::Set(temp,aRakk.PCurve1OnFillet(i));
       di << localname<< " ";
-      sprintf(localname, "%s%d" ,"pcurveonconge2",i);
+      Sprintf(localname, "%s%d" ,"pcurveonconge2",i);
       temp =localname; 
-      DrawTrSurf::Set(temp,Rakk.PCurve2OnFillet(i));
+      DrawTrSurf::Set(temp,aRakk.PCurve2OnFillet(i));
       di << localname<< " ";
       
     } }
@@ -595,11 +575,11 @@ static Standard_Integer blend1(Draw_Interpretor& di, Standard_Integer narg, cons
    Standard_Integer j;
   
    for (i=1;i<=nb;i++)
-    {Standard_Integer s=Rakk.NbSection(i);
+    {Standard_Integer s=aRakk.NbSection(i);
     for (j=1;j<=s;j++)
-     {Handle(Geom_TrimmedCurve Sec);
-     Rakk.Section(i,j,Sec);
-    sprintf(localname, "%s%d%d" ,"sec",i,j);
+     {Handle(Geom_TrimmedCurve) Sec;
+     aRakk.Section(i,j,Sec);
+    Sprintf(localname, "%s%d%d" ,"sec",i,j);
      temp =localname;
     DrawTrSurf::Set (temp,Sec);
     di << localname<< " ";}
@@ -619,9 +599,9 @@ Standard_Integer rollingball(Draw_Interpretor& di, Standard_Integer n, const cha
 
   TopoDS_Shape S = DBRep::Get(a[2]);
   if ( S.IsNull()) return 1;
-  Standard_Real Rad = atof(a[3]);
+  Standard_Real Rad = Draw::Atof(a[3]);
   
-  Standard_Real Tol = t3d; //le meme que blend ! 1.e-7;
+  Standard_Real Tol = t3d; //the same as blend ! 1.e-7;
   
   BiTgte_Blend Roll;
   Roll.Init(S,Rad,Tol,Standard_False);
@@ -633,44 +613,44 @@ Standard_Integer rollingball(Draw_Interpretor& di, Standard_Integer n, const cha
       continue;
     }
 
-    if ( Nb == 0) { // on recupere les faces d'arret.
+    if ( Nb == 0) { // return stop faces.
       TopoDS_Shape aLocalFace(DBRep::Get(a[i],TopAbs_FACE));
       TopoDS_Face F1 = TopoDS::Face(aLocalFace);
 //      TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
       if ( F1.IsNull()) {
-       //cout << " Face d'arret non reperee." << endl;
-       di << " Face d'arret non reperee." << "\n";
+       //cout << " Stop face not referenced." << endl;
+       di << " Stop face not referenced.\n";
        return 1;
       }
       Roll.SetStoppingFace(F1);
     }
-    else if (Nb == 1) { // on recupere les faces sur lesquelles la bille roule
+    else if (Nb == 1) { // return faces on which the ball rotates
       TopoDS_Shape aLocalFace(DBRep::Get(a[i],TopAbs_FACE));
       TopoDS_Face F1 = TopoDS::Face(aLocalFace);
 //      TopoDS_Face F1 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
       i++;
       if ( !strcmp(a[i],"@")) {
-       //cout << " Il faut un nombre pair de faces d'appui de la bille" << endl;
-       di << " Il faut un nombre pair de faces d'appui de la bille" << "\n";
+       //cout << " Even number of ball support faces is required " << endl;
+       di << " Even number of ball support faces is required \n";
        return 1;
       }
       aLocalFace = DBRep::Get(a[i],TopAbs_FACE);
       TopoDS_Face F2 = TopoDS::Face(aLocalFace);
 //      TopoDS_Face F2 = TopoDS::Face(DBRep::Get(a[i],TopAbs_FACE));
       if ( F1.IsNull() || F2.IsNull()) {
-       //cout << " Face d'appui non reperee." << endl;
-       di << " Face d'appui non reperee." << "\n";
+       //cout << " Support face not referenced." << endl;
+       di << " Support face not referenced.\n";
        return 1;
       }
       Roll.SetFaces(F1,F2);
     }
-    else if (Nb == 2) { // on recupere l'arete sur laquelle la bille roule
+    else if (Nb == 2) { // return the edge on which the ball rotates
       TopoDS_Shape aLocalShape(DBRep::Get(a[i],TopAbs_EDGE));
       TopoDS_Edge E = TopoDS::Edge(aLocalShape);
 //      TopoDS_Edge E = TopoDS::Edge(DBRep::Get(a[i],TopAbs_EDGE));
       if ( E.IsNull()) {
-       //cout << " Edge non repere." << endl;
-       di << " Edge non repere." << "\n";
+       //cout << " Edge not referenced." << endl;
+       di << " Edge not referenced.\n";
        return 1;
       }
       Roll.SetEdge(E);
@@ -688,13 +668,13 @@ Standard_Integer rollingball(Draw_Interpretor& di, Standard_Integer n, const cha
     for (Standard_Integer i = 1; i <= NbBranches; i++) {
       Standard_Integer From,To;
       Roll.IndicesOfBranche(i,From,To);
-      //cout << " Indices de la " << i << "eme Branche : ";
+      //cout << " Indexes of the " << i << "th Branch : ";
       //cout << "   " << From << "     " << To << endl;
-      di << " Indices de la " << i << "eme Branche : ";
+      di << " Indexes of the " << i << "th Branch : ";
       di << "   " << From << "     " << To << "\n";
       for (Standard_Integer j = From; j <= To; j++) {
        const TopoDS_Shape& CurF = Roll.Face(j);
-       sprintf(localname,"%s_%d_%d",a[1],i,j);
+       Sprintf(localname,"%s_%d_%d",a[1],i,j);
        DBRep::Set(localname,CurF);
       }
     }
@@ -749,20 +729,12 @@ void  BRepTest::FilletCommands(Draw_Interpretor& theCommands)
                  "buildevol end of the evol fillet computation",__FILE__,
                  BUILDEVOL,g);
 
-  theCommands.Add("fubl",
-                 "fubl result shape1 shape2 radius",__FILE__,
-                 topoblend,g);
-  
-  theCommands.Add("cubl",
-                 "cubl result shape tool radius",__FILE__,
-                 topoblend,g);
-
   theCommands.Add("bfuseblend",
-                 "bfuseblend result shape1 shape2 radius",__FILE__,
+                 "bfuseblend result shape1 shape2 radius [-d]",__FILE__,
                  boptopoblend,g);
   
   theCommands.Add("bcutblend",
-                 "bcutblend result shape tool radius",__FILE__,
+                 "bcutblend result shape1 tool radius [-d]",__FILE__,
                  boptopoblend,g);
 
   theCommands.Add("blend1",