0024181: Text to BRep functionality
[occt.git] / src / ViewerTest / ViewerTest.cxx
index bfcfaa3..ac8fda7 100755 (executable)
@@ -43,6 +43,7 @@
 #include <BRepAdaptor_Curve.hxx>
 #include <StdSelect_ShapeTypeFilter.hxx>
 #include <AIS.hxx>
+#include <AIS_Drawer.hxx>
 #include <AIS_InteractiveObject.hxx>
 #include <AIS_Trihedron.hxx>
 #include <AIS_Axis.hxx>
 #include <AIS_SignatureFilter.hxx>
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
-#include <Image_PixMap.hxx>
+#include <Aspect_InteriorStyle.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_TextureRoot.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Image_AlienPixMap.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_IsoAspect.hxx>
 
 #ifdef HAVE_CONFIG_H
 # include <config.h>
@@ -65,7 +72,6 @@
 #include <TCollection_AsciiString.hxx>
 #include <Draw_PluginMacro.hxx>
 #include <ViewerTest.hxx>
-#include <Viewer2dTest.hxx>
 
 // avoid warnings on 'extern "C"' functions returning C++ classes
 #ifdef WNT
 #include <NIS_Triangulated.hxx>
 extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
 
-//=======================================================================
-//function : GetColorFromName
-//purpose  : get the Quantity_NameOfColor from a string
-//=======================================================================
-
-#include <Quantity_NameOfColor.hxx>
 #include <Quantity_Color.hxx>
 #include <Quantity_NameOfColor.hxx>
 
@@ -92,22 +92,24 @@ extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
 #define DEFAULT_COLOR    Quantity_NOC_GOLDENROD
 #define DEFAULT_MATERIAL Graphic3d_NOM_BRASS
 
-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++)
+//=======================================================================
+//function : GetColorFromName
+//purpose  : get the Quantity_NameOfColor from a string
+//=======================================================================
+
+Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theName)
+{
+  for (Standard_Integer anIter = Quantity_NOC_BLACK; anIter <= Quantity_NOC_WHITE; ++anIter)
+  {
+    Standard_CString aColorName = Quantity_Color::StringName (Quantity_NameOfColor (anIter));
+    if (strcasecmp (theName, aColorName) == 0)
     {
-      colstring = Quantity_Color::StringName(Quantity_NameOfColor(i));
-      if (!strcasecmp(name,colstring)) {
-       ret = (Quantity_NameOfColor)i;
-       Found = Standard_True;
-      }
+      return Quantity_NameOfColor (anIter);
     }
+  }
 
-  return ret;
+  return DEFAULT_COLOR;
 }
 
 //=======================================================================
@@ -130,7 +132,6 @@ static Graphic3d_NameOfMaterial GetMaterialFromName( const char *name )
   else if ( !strcasecmp(name,"STONE" ) )        mat = Graphic3d_NOM_STONE;
   else if ( !strcasecmp(name,"CHROME" ) )       mat = Graphic3d_NOM_CHROME;
   else if ( !strcasecmp(name,"ALUMINIUM" ) )     mat = Graphic3d_NOM_ALUMINIUM;
-  else if ( !strcasecmp(name,"STONE" ) )        mat = Graphic3d_NOM_STONE;
   else if ( !strcasecmp(name,"NEON_PHC" ) )     mat = Graphic3d_NOM_NEON_PHC;
   else if ( !strcasecmp(name,"NEON_GNC" ) )     mat = Graphic3d_NOM_NEON_GNC;
   else if ( !strcasecmp(name,"PLASTER" ) )      mat = Graphic3d_NOM_PLASTER;
@@ -236,30 +237,6 @@ void GetTypeAndSignfromString (const char* name,AIS_KindOfInteractive& TheType,S
 #include <BRepOffsetAPI_MakeThickSolid.hxx>
 #include <BRepOffset.hxx>
 
-
-//==============================================================================
-//function : GetTypeNameFromShape
-//purpose  : get the shape type as a string from a shape
-//==============================================================================
-
-static const char* GetTypeNameFromShape( const TopoDS_Shape& aShape )
-{ const char *ret = "????";
-
-  if ( aShape.IsNull() ) ret = "Null Shape";
-
-           switch ( aShape.ShapeType() ) {
-             case TopAbs_COMPOUND  : ret = "COMPOUND" ; break;
-             case TopAbs_COMPSOLID : ret = "COMPSOLID" ; break;
-             case TopAbs_SOLID     : ret = "SOLID" ; break;
-             case TopAbs_SHELL     : ret = "SHELL" ; break;
-             case TopAbs_FACE      : ret = "FACE" ; break;
-             case TopAbs_WIRE      : ret = "WIRE" ; break;
-             case TopAbs_EDGE      : ret = "EDGE" ; break;
-             case TopAbs_VERTEX    : ret = "VERTEX" ; break;
-             case TopAbs_SHAPE     : ret = "SHAPE" ; break;
-           }
-  return ret;
-}
 //==============================================================================
 //  VIEWER OBJECT MANAGEMENT GLOBAL VARIABLES
 //==============================================================================
@@ -310,6 +287,12 @@ Standard_EXPORT Standard_Boolean VDisplayAISObject (const TCollection_AsciiStrin
     aMap.UnBind2 (theName);
   }
 
+  if (theAISObj.IsNull())
+  {
+    // object with specified name already unbound
+    return Standard_True;
+  }
+
   // unbind AIS object if was bound with another name
   aMap.UnBind1 (theAISObj);
 
@@ -329,17 +312,19 @@ static void VwrTst_InitEventMgr(const Handle(NIS_View)& aView,
   theEventMgrs.Prepend(new ViewerTest_EventManager(aView, Ctx));
 }
 
-static Handle(V3d_View)&  a3DView(){
+static Handle(V3d_View)&  a3DView()
+{
   static Handle(V3d_View) Viou;
   return Viou;
 }
 
+
 Standard_EXPORT Handle(AIS_InteractiveContext)& TheAISContext(){
   static Handle(AIS_InteractiveContext) aContext;
   return aContext;
 }
 
-Handle(V3d_View) ViewerTest::CurrentView()
+const Handle(V3d_View)& ViewerTest::CurrentView()
 {
   return a3DView();
 }
@@ -358,7 +343,7 @@ Standard_EXPORT const Handle(NIS_InteractiveContext)& TheNISContext()
   return aContext;
 }
 
-Handle(AIS_InteractiveContext) ViewerTest::GetAISContext()
+const Handle(AIS_InteractiveContext)& ViewerTest::GetAISContext()
 {
   return TheAISContext();
 }
@@ -441,18 +426,7 @@ static TopoDS_Shape GetShapeFromName(const char* name)
 
   return S;
 }
-//==============================================================================
-//function : GetShapeFromName
-//purpose  : Compute an Shape from a draw variable or a file name
-//==============================================================================
-// Unused :
-#ifdef DEB
-static TopoDS_Shape GetShapeFromAIS(const AIS_InteractiveObject & TheAisIO )
-{
-  TopoDS_Shape TheShape=((*(Handle(AIS_Shape)*)&TheAisIO))->Shape();
-  return TheShape;
-}
-#endif
+
 //==============================================================================
 //function : GetAISShapeFromName
 //purpose  : Compute an AIS_Shape from a draw variable or a file name
@@ -465,13 +439,14 @@ Handle(AIS_Shape) GetAISShapeFromName(const char* name)
     const Handle(AIS_InteractiveObject) IO =
       Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
     if (!IO.IsNull()) {
-      if(IO->Type()==AIS_KOI_Shape)
+      if(IO->Type()==AIS_KOI_Shape) {
         if(IO->Signature()==0){
           retsh = *((Handle(AIS_Shape)*)&IO);
         }
         else
           cout << "an Object which is not an AIS_Shape "
             "already has this name!!!"<<endl;
+      }
     }
     return retsh;
   }
@@ -553,7 +528,8 @@ void ViewerTest::StandardModeActivation(const Standard_Integer mode )
     case 4: cmode = "Face"; break;
     case 5: cmode = "Shell"; break;
     case 6: cmode = "Solid"; break;
-    case 7: cmode = "Compound"; break;
+    case 7: cmode = "Compsolid"; break;
+    case 8: cmode = "Compound"; break;
     }
 
     if(theactivatedmodes.Contains(mode))
@@ -572,126 +548,120 @@ void ViewerTest::StandardModeActivation(const Standard_Integer mode )
 }
 
 //==============================================================================
-//function : SelectFromContext
-//purpose  : pick / select an object from the last MoveTo() on a
-//            ButtonPress event
+//function : CopyIsoAspect
+//purpose  : Returns copy Prs3d_IsoAspect with new number of isolines.
 //==============================================================================
+static Handle(Prs3d_IsoAspect) CopyIsoAspect
+      (const Handle(Prs3d_IsoAspect) &theIsoAspect,
+       const Standard_Integer theNbIsos)
+{
+  Quantity_Color    aColor;
+  Aspect_TypeOfLine aType;
+  Standard_Real     aWidth;
+
+  theIsoAspect->Aspect()->Values(aColor, aType, aWidth);
 
-Handle(AIS_InteractiveObject) Select(Standard_Integer argc,
-                                    const char** argv,
-                                    Standard_Boolean shift,
-                                    Standard_Boolean pick )
+  Handle(Prs3d_IsoAspect) aResult =
+    new Prs3d_IsoAspect(aColor, aType, aWidth, theNbIsos);
+
+  return aResult;
+}
+
+//==============================================================================
+//function : visos
+//purpose  : Returns or sets the number of U- and V- isos and isIsoOnPlane flag
+//Draw arg : [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]
+//==============================================================================
+static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
-  Handle(AIS_InteractiveObject) ret;
-  Handle (ViewerTest_EventManager) EM = ViewerTest::CurrentEventManager();
-  if ( shift ) {
-    EM->ShiftSelect();
+  if (TheAISContext().IsNull()) {
+    di << argv[0] << " Call 'vinit' before!\n";
+    return 1;
   }
-  else {
-    EM->Select();
-  }
-  const Handle(AIS_InteractiveContext) aContext = EM->Context();
-
-  if ( !aContext->HasOpenedContext() ) {
-    aContext->InitCurrent();
-    while ( aContext->MoreCurrent() ) {
-      Handle(AIS_InteractiveObject) aisPickedShape =
-       Handle(AIS_InteractiveObject)::DownCast(aContext->Current());
-
-//JR/Hp
-      const char *name = (GetMapOfAIS().IsBound1(aisPickedShape))?
-//      const char *name = (GetMapOfAIS().IsBound1(aisPickedShape))?
-       GetMapOfAIS().Find1(aisPickedShape).ToCString() :
-         "????";
-      Handle(AIS_Shape) TheRealSh = Handle(AIS_Shape)::DownCast(aisPickedShape);
-      if(!TheRealSh.IsNull()){
-       cout << "Current is " << name
-         << " (" << GetTypeNameFromShape(TheRealSh->Shape())
-           << ")" << endl;
-      }
-      ret = aisPickedShape;
-      if(!TheRealSh.IsNull()){
-       if ( pick && argc > 4 ) {
-         DBRep::Set(argv[4], TheRealSh->Shape());
-       }
+
+  if (argc <= 1) {
+    di << "Current number of isos : " <<
+      TheAISContext()->IsoNumber(AIS_TOI_IsoU) << " " <<
+      TheAISContext()->IsoNumber(AIS_TOI_IsoV) << "\n";
+    di << "IsoOnPlane mode is " <<
+      (TheAISContext()->IsoOnPlane() ? "ON" : "OFF") << "\n";
+
+    return 0;
+  }
+
+  Standard_Integer aLastInd = argc - 1;
+  Standard_Boolean isChanged = Standard_False;
+  Standard_Integer aNbUIsos = 0;
+  Standard_Integer aNbVIsos = 0;
+
+  if (aLastInd >= 3) {
+    Standard_Boolean isIsoOnPlane = Standard_False;
+
+    if (strcmp(argv[aLastInd], "1") == 0) {
+      isIsoOnPlane = Standard_True;
+      isChanged    = Standard_True;
+    } else if (strcmp(argv[aLastInd], "0") == 0) {
+      isIsoOnPlane = Standard_False;
+      isChanged    = Standard_True;
+    }
+
+    if (isChanged) {
+      aNbVIsos = Draw::Atoi(argv[aLastInd - 1]);
+      aNbUIsos = Draw::Atoi(argv[aLastInd - 2]);
+      aLastInd -= 3;
+
+      di << "New number of isos : " << aNbUIsos << " " << aNbVIsos << "\n";
+      di << "New IsoOnPlane mode is " << (isIsoOnPlane ? "ON" : "OFF") << "\n";
+
+      TheAISContext()->IsoOnPlane(isIsoOnPlane);
+
+      if (aLastInd == 0) {
+        // If there are no shapes provided set the default numbers.
+        TheAISContext()->SetIsoNumber(aNbUIsos, AIS_TOI_IsoU);
+        TheAISContext()->SetIsoNumber(aNbVIsos, AIS_TOI_IsoV);
       }
-      aContext->NextCurrent();
     }
   }
-  else {
-    // A LocalContext is opened, the use xxxxSelected()
-    // to select an object and its SubShape
-    aContext->InitSelected();
-    while ( aContext->MoreSelected() ) {
-      if ( !aContext->HasSelectedShape() ) {
-      }
-      else {
-        TopoDS_Shape PickedShape = aContext->SelectedShape();
-       if ( pick && argc > 5 ) {
-         DBRep::Set(argv[5], PickedShape);
-       }
-      }
 
-      if ( aContext->Interactive().IsNull() ) {
-        cout << "??? (No InteractiveObject selected)" << endl;
-      }
-      else {
-        Handle(AIS_InteractiveObject) aisPicked =
-          Handle(AIS_InteractiveObject)::DownCast(aContext->Interactive());
-        ret = aisPicked;
-       Handle(AIS_Shape) aisPickedShape = Handle(AIS_Shape)::DownCast(aisPicked);
-
-       // Get back its name
-//JR/Hp
-       const char *name = ( GetMapOfAIS().IsBound1(aisPicked) )?
-//     const char *name = ( GetMapOfAIS().IsBound1(aisPicked) )?
-         GetMapOfAIS().Find1(aisPicked).ToCString() :
-           "????";
-
-       if(!aisPickedShape.IsNull()){
-         if ( pick && argc > 4 ) {
-           // Create a draw variable to store the wohole shape
-           // for vpick command
-           DBRep::Set(argv[4], aisPickedShape->Shape());
-         }
+  Standard_Integer i;
 
-         cout << name << " (" << GetTypeNameFromShape(aisPickedShape->Shape())
-           << ")" << endl  ;
-       }
+  for (i = 1; i <= aLastInd; i++) {
+    TCollection_AsciiString name(argv[i]);
+    Standard_Boolean IsBound = GetMapOfAIS().IsBound2(name);
+
+    if (IsBound) {
+      const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
+      if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
+        const Handle(AIS_InteractiveObject) aShape =
+        Handle(AIS_InteractiveObject)::DownCast (anObj);
+        Handle(AIS_Drawer) CurDrawer = aShape->Attributes();
+        Handle(Prs3d_IsoAspect) aUIso = CurDrawer->UIsoAspect();
+        Handle(Prs3d_IsoAspect) aVIso = CurDrawer->VIsoAspect();
+
+        if (isChanged) {
+          CurDrawer->SetUIsoAspect(CopyIsoAspect(aUIso, aNbUIsos));
+          CurDrawer->SetVIsoAspect(CopyIsoAspect(aVIso, aNbVIsos));
+          TheAISContext()->SetLocalAttributes
+                  (aShape, CurDrawer, Standard_False);
+          TheAISContext()->Redisplay(aShape);
+        } else {
+          di << "Number of isos for " << argv[i] << " : "
+             << aUIso->Number() << " " << aVIso->Number() << "\n";
+        }
+      } else {
+        di << argv[i] << ": Not an AIS interactive object!\n";
       }
-      // Goto the next selected object
-      aContext->NextSelected();
+    } else {
+      di << argv[i] << ": Use 'vdisplay' before\n";
     }
   }
-  return ret;
-}
 
-//==============================================================================
-//function : DetectedFromContext
-//purpose  : hilight dynamicaly an object from the last MoveTo() on a
-//            MouseMove event
-//==============================================================================
-Handle(AIS_InteractiveObject) DetectedFromContext(
-       Handle(AIS_InteractiveContext) aContext )
-{
-  Handle(AIS_InteractiveObject) ret;
-  if ( aContext->HasDetected() ) {
-    if ( !aContext->HasDetectedShape() ) {
-      //No SubShape selected
-    }
-    else {
-      // Get the detected SubShape
-      TopoDS_Shape PickedShape = aContext->DetectedShape();
-    }
-    if ( !aContext->DetectedInteractive().IsNull() ) {
-      Handle(AIS_InteractiveObject) aisPickedShape =
-       Handle(AIS_InteractiveObject)::DownCast(aContext->DetectedInteractive());
-      ret = aisPickedShape;
-    }
+  if (isChanged) {
+    TheAISContext()->UpdateCurrentViewer();
   }
-  return ret;
-}
 
+  return 0;
+}
 
 //==============================================================================
 //function : VDispAreas,VDispSensitive,...
@@ -792,18 +762,18 @@ static int VSelPrecision(Draw_Interpretor& di, Standard_Integer argc, const char
   }
   else if( argc > 1 )
   {
-    StdSelect_SensitivityMode aMode = ( StdSelect_SensitivityMode )atoi( argv[1] );
+    StdSelect_SensitivityMode aMode = ( StdSelect_SensitivityMode )Draw::Atoi( argv[1] );
     aContext->SetSensitivityMode( aMode );
     if( argc > 2 )
     {
       if( aMode == StdSelect_SM_WINDOW )
       {
-        Standard_Integer aPixelTolerance = atoi( argv[2] );
+        Standard_Integer aPixelTolerance = Draw::Atoi( argv[2] );
         aContext->SetPixelTolerance( aPixelTolerance );
       }
       else if( aMode == StdSelect_SM_VIEW )
       {
-        Standard_Real aSensitivity = atof( argv[2] );
+        Standard_Real aSensitivity = Draw::Atof( argv[2] );
         aContext->SetSensitivity( aSensitivity );
       }
     }
@@ -824,47 +794,65 @@ static Standard_Integer VDump (Draw_Interpretor& di, Standard_Integer argc, cons
     return 1;
   }
 
-  Image_TypeOfImage aBufferType = Image_TOI_RGB;
-
+  Graphic3d_BufferType aBufferType = Graphic3d_BT_RGB;
   if (argc > 2)
   {
-    TCollection_AsciiString aBuffTypeStr (argv[2]);
-    if (TCollection_AsciiString::ISSIMILAR (aBuffTypeStr, TCollection_AsciiString ("rgb")))
+    const char* aBuffTypeStr = argv[2];
+    if ( strcasecmp( aBuffTypeStr, "rgb" ) == 0 ) // 4 is to compare '\0' as well
     {
-      aBufferType = Image_TOI_RGB;
+      aBufferType = Graphic3d_BT_RGB;
     }
-    else if (TCollection_AsciiString::ISSIMILAR (aBuffTypeStr, TCollection_AsciiString ("rgba")))
+    else if ( strcasecmp( aBuffTypeStr, "rgba" ) == 0 )
     {
-      aBufferType = Image_TOI_RGBA;
+      aBufferType = Graphic3d_BT_RGBA;
     }
-    else if (TCollection_AsciiString::ISSIMILAR (aBuffTypeStr, TCollection_AsciiString ("depth")))
+    else if ( strcasecmp( aBuffTypeStr, "depth" ) == 0 )
     {
-      aBufferType = Image_TOI_FLOAT;
+      aBufferType = Graphic3d_BT_Depth;
     }
   }
 
-  Standard_Integer aWidth  = (argc > 3) ? atoi (argv[3]) : 0;
-  Standard_Integer aHeight = (argc > 4) ? atoi (argv[4]) : 0;
+  Standard_Integer aWidth  = (argc > 3) ? Draw::Atoi (argv[3]) : 0;
+  Standard_Integer aHeight = (argc > 4) ? Draw::Atoi (argv[4]) : 0;
 
   Handle(AIS_InteractiveContext) IC;
   Handle(V3d_View) view;
   GetCtxAndView (IC, view);
-  if (!view.IsNull())
+  if (view.IsNull())
   {
-    if (aWidth > 0 && aHeight > 0)
-    {
-      return view->ToPixMap (aWidth, aHeight, aBufferType)->Dump (argv[1]) ? 0 : 1;
-    }
-    else
+    di << "Cannot find an active viewer/view\n";
+    return 1;
+  }
+
+  if (aWidth <= 0 || aHeight <= 0)
+  {
+    if (!view->Dump (argv[1], aBufferType))
     {
-      return view->Dump (argv[1], aBufferType) ? 0 : 1;
+      di << "Dumping failed!\n";
+      return 1;
     }
+    return 0;
   }
-  else
+
+  Image_AlienPixMap aPixMap;
+  if (!view->ToPixMap (aPixMap, aWidth, aHeight, aBufferType))
   {
-    di << "Cannot find an active viewer/view" << "\n";
+    di << "Dumping failed!\n";
     return 1;
   }
+
+  if (aPixMap.SizeX() != Standard_Size(aWidth)
+   || aPixMap.SizeY() != Standard_Size(aHeight))
+  {
+    std::cout << "Warning! Dumped dimensions " << aPixMap.SizeX() << "x" << aPixMap.SizeY()
+              << " are lesser than requested " << aWidth          << "x" << aHeight << "\n";
+  }
+  if (!aPixMap.Save (argv[1]))
+  {
+    di << "Saving image failed!\n";
+    return 1;
+  }
+  return 0;
 }
 
 
@@ -885,7 +873,7 @@ static int VwrTst_DispErase(const Handle(AIS_InteractiveObject)& IO,
     Ctx->Display(IO,Mode,Upd);
     break;
   case 2:{
-    Ctx->Erase(IO,Mode,Upd);
+    Ctx->Erase(IO,Upd);
     break;
   }
   case 3:{
@@ -952,7 +940,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
     }
   }
   else if(argc==2){
-    Standard_Integer Dmode = atoi(argv[1]);
+    Standard_Integer Dmode = Draw::Atoi(argv[1]);
     if(Ctx->NbCurrents()==0 && TypeOfOperation==3){
       Handle(AIS_InteractiveObject) IO;
       VwrTst_DispErase(IO,Dmode,TypeOfOperation,Standard_True);
@@ -975,7 +963,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
     if(GetMapOfAIS().IsBound2(name))
       IO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
     if (!IO.IsNull())
-      VwrTst_DispErase(IO,atoi(argv[2]),TypeOfOperation,Standard_True);
+      VwrTst_DispErase(IO,Draw::Atoi(argv[2]),TypeOfOperation,Standard_True);
   }
   return 0;
 }
@@ -988,7 +976,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
 static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
 {
   if(argc==1) return 1;
-  Standard_Integer On = atoi(argv[1]);
+  Standard_Integer On = Draw::Atoi(argv[1]);
   const Handle(AIS_InteractiveContext)& Ctx = ViewerTest::GetAISContext();
 
   if(argc==2){
@@ -1022,12 +1010,12 @@ static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** arg
     TCollection_AsciiString name = argv[2];
     if(GetMapOfAIS().IsBound2(name)){
       IO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
-      if (!IO.IsNull())
+      if (!IO.IsNull()) {
         if(On==1)
           Ctx->SubIntensityOn(IO);
         else
           Ctx->SubIntensityOff(IO);
-
+      }
     }
     else return 1;
   }
@@ -1080,20 +1068,20 @@ static int VColor2 (Draw_Interpretor& di, Standard_Integer argc, const char** ar
           Handle(AIS_InteractiveObject)::DownCast (anObj);
 #ifdef DEB
           if (HaveToSet)
-            di  << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
+            di  << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< ViewerTest::GetColorFromName(argv[2]) << "\n";
           else
             di  << "HaveToSet 0\n";
 #endif
 
         if(HaveToSet)
-          TheAISContext()->SetColor(ashape,GetColorFromName(argv[2]) );
+          TheAISContext()->SetColor(ashape,ViewerTest::GetColorFromName(argv[2]) );
         else
           TheAISContext()->UnsetColor(ashape);
       } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
         Handle(NIS_Triangulated) ashape =
           Handle(NIS_Triangulated)::DownCast (anObj);
         if (!ashape.IsNull())
-          ashape->SetColor (GetColorFromName(argv[2]));
+          ashape->SetColor (ViewerTest::GetColorFromName(argv[2]));
       }
     }
 
@@ -1112,12 +1100,12 @@ static int VColor2 (Draw_Interpretor& di, Standard_Integer argc, const char** ar
           continue;
 #ifdef DEB
         if (HaveToSet)
-          di  << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< GetColorFromName(argv[2]) << "\n";
+          di  << "HaveToSet "<< "1" <<" Color Given "<< argv[2] << " Color returned "<< ViewerTest::GetColorFromName(argv[2]) << "\n";
         else
           di  << "HaveToSet 0\n";
 #endif
         if(HaveToSet)
-          TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),Standard_False);
+          TheAISContext()->SetColor(ashape,ViewerTest::GetColorFromName(argv[1]),Standard_False);
         else
           TheAISContext()->UnsetColor(ashape,Standard_False);
       }
@@ -1134,11 +1122,12 @@ static int VColor2 (Draw_Interpretor& di, Standard_Integer argc, const char** ar
       while ( it.More() ) {
         const Handle(AIS_InteractiveObject) ashape =
           Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-        if (!ashape.IsNull())
+        if (!ashape.IsNull()) {
           if(HaveToSet)
-            TheAISContext()->SetColor(ashape,GetColorFromName(argv[1]),Standard_False);
+            TheAISContext()->SetColor(ashape,ViewerTest::GetColorFromName(argv[1]),Standard_False);
           else
             TheAISContext()->UnsetColor(ashape,Standard_False);
+        }
         it.Next();
       }
       TheAISContext()->UpdateCurrentViewer();
@@ -1192,14 +1181,14 @@ static int VTransparency  (Draw_Interpretor& di, Standard_Integer argc,
         const Handle(AIS_InteractiveObject) ashape =
           Handle(AIS_InteractiveObject)::DownCast(anObj);
         if(HaveToSet)
-          TheAISContext()->SetTransparency(ashape,atof(argv[2]) );
+          TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[2]) );
         else
           TheAISContext()->UnsetTransparency(ashape);
       } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
         const Handle(NIS_InteractiveObject) ashape =
           Handle(NIS_InteractiveObject)::DownCast(anObj);
         if(HaveToSet)
-          ashape->SetTransparency(atof(argv[2]) );
+          ashape->SetTransparency(Draw::Atof(argv[2]) );
         else
           ashape->UnsetTransparency();
       }
@@ -1215,7 +1204,7 @@ static int VTransparency  (Draw_Interpretor& di, Standard_Integer argc,
       {
         Handle(AIS_InteractiveObject) ashape =  TheAISContext() -> Current();
         if(HaveToSet)
-          TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False);
+          TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False);
         else
           TheAISContext()->UnsetTransparency(ashape,Standard_False);
       }
@@ -1231,11 +1220,12 @@ static int VTransparency  (Draw_Interpretor& di, Standard_Integer argc,
       while ( it.More() ) {
         Handle(AIS_InteractiveObject) ashape =
           Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-        if (!ashape.IsNull())
+        if (!ashape.IsNull()) {
           if(HaveToSet)
-            TheAISContext()->SetTransparency(ashape,atof(argv[1]),Standard_False);
+            TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False);
           else
             TheAISContext()->UnsetTransparency(ashape,Standard_False);
+        }
         it.Next();
       }
       TheAISContext()->UpdateCurrentViewer();
@@ -1287,11 +1277,12 @@ static int VMaterial (Draw_Interpretor& di, Standard_Integer argc, const char**
     if ( ThereIsName && IsBound ) {
       Handle(AIS_InteractiveObject) ashape =
         Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(name));
-      if (!ashape.IsNull())
+      if (!ashape.IsNull()) {
         if (HaveToSet)
           TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[2]));
         else
           TheAISContext()->UnsetMaterial(ashape);
+      }
     }
     //=======================================================================
     // Il n'y a pas de nom de shape
@@ -1321,11 +1312,12 @@ static int VMaterial (Draw_Interpretor& di, Standard_Integer argc, const char**
       while ( it.More() ) {
         Handle(AIS_InteractiveObject) ashape =
           Handle(AIS_InteractiveObject)::DownCast (it.Key1());
-        if (!ashape.IsNull())
+        if (!ashape.IsNull()) {
           if (HaveToSet)
             TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),Standard_False);
           else
             TheAISContext()->UnsetMaterial(ashape,Standard_False);
+        }
         it.Next();
       }
       TheAISContext()->UpdateCurrentViewer();
@@ -1378,14 +1370,14 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg
         const Handle(AIS_InteractiveObject) ashape =
           Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
         if (HaveToSet)
-          TheAISContext()->SetWidth ( ashape,atof (argv[2]) );
+          TheAISContext()->SetWidth ( ashape,Draw::Atof (argv[2]) );
         else
           TheAISContext()->UnsetWidth (ashape);
       } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
         const Handle(NIS_Triangulated) ashape =
           Handle(NIS_Triangulated)::DownCast(GetMapOfAIS().Find2(name));
         if (HaveToSet && !ashape.IsNull())
-          ashape->SetLineWidth ( atof (argv[2]) );
+          ashape->SetLineWidth ( Draw::Atof (argv[2]) );
       }
     }
 
@@ -1400,7 +1392,7 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg
       {
         Handle(AIS_InteractiveObject) ashape =  TheAISContext() -> Current();
         if (HaveToSet)
-          TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False);
+          TheAISContext()->SetWidth(ashape,Draw::Atof(argv[1]),Standard_False);
         else
           TheAISContext()->UnsetWidth(ashape,Standard_False);
       }
@@ -1412,21 +1404,114 @@ static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** arg
     else if (!ThereIsCurrent && !ThereIsArgument){
      ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
        it(GetMapOfAIS());
-     while ( it.More() ) {
-       Handle(AIS_InteractiveObject) ashape =
-         Handle(AIS_InteractiveObject)::DownCast (it.Key1());
-       if (!ashape.IsNull())
-         if (HaveToSet)
-           TheAISContext()->SetWidth(ashape,atof(argv[1]),Standard_False);
-         else
-           TheAISContext()->UnsetWidth(ashape,Standard_False);
-       it.Next();
+      while ( it.More() ) {
+        Handle(AIS_InteractiveObject) ashape =
+          Handle(AIS_InteractiveObject)::DownCast (it.Key1());
+        if (!ashape.IsNull()) {
+          if (HaveToSet)
+            TheAISContext()->SetWidth(ashape,Draw::Atof(argv[1]),Standard_False);
+          else
+            TheAISContext()->UnsetWidth(ashape,Standard_False);
+        }
+        it.Next();
      }
      TheAISContext()->UpdateCurrentViewer();
    }
   }
   return 0;
 }
+
+//==============================================================================
+//function : VInteriorStyle
+//purpose  : sets interior style of the a selected or named or displayed shape
+//Draw arg : vsetinteriorstyle [shape] style
+//==============================================================================
+static void SetInteriorStyle (const Handle(AIS_InteractiveObject)& theIAO,
+                              const Standard_Integer theStyle,
+                              Draw_Interpretor& di)
+{
+  if (theStyle < Aspect_IS_EMPTY || theStyle > Aspect_IS_HIDDENLINE) {
+    di << "Style must be within a range [0 (Aspect_IS_EMPTY), " << Aspect_IS_HIDDENLINE <<
+      " (Aspect_IS_HIDDENLINE)]\n";
+    return;
+  }
+  const Handle(Prs3d_Drawer)& aDrawer = theIAO->Attributes();
+  Handle(Prs3d_ShadingAspect) aShadingAspect = aDrawer->ShadingAspect();
+  Handle(Graphic3d_AspectFillArea3d) aFillAspect = aShadingAspect->Aspect();
+  Aspect_InteriorStyle aStyle = (Aspect_InteriorStyle) (theStyle);
+  aFillAspect->SetInteriorStyle (aStyle);
+  TheAISContext()->RecomputePrsOnly (theIAO, Standard_False /*update*/, Standard_True /*all modes*/);
+}
+
+static int VInteriorStyle (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+  if (argc < 2 || argc > 3) {
+    di << argv[0] << " requires 2 or 3 arguments\n";
+    di << "Usage : " << argv[0] << " [shape] Style : Set interior style" << "\n";
+    di << "Style must match Aspect_InteriorStyle and be one of:\n";
+    di << "         0 = EMPTY, 1 = HOLLOW, 2 = HATCH, 3 = SOLID, 4 = HIDDENLINE\n";
+    return 1;
+  }
+
+  Standard_Boolean    ThereIsCurrent;
+  Standard_Boolean    ThereIsArgument;
+  Standard_Boolean    IsBound = Standard_False ;
+
+  ThereIsArgument = (argc > 2);
+  if ( !a3DView().IsNull() ) {
+    TCollection_AsciiString name;
+    if (ThereIsArgument) {
+      name = argv[1];
+      IsBound= GetMapOfAIS().IsBound2(name);
+    }
+    if (TheAISContext()->HasOpenedContext())
+      TheAISContext()->CloseLocalContext();
+
+    if (TheAISContext() -> NbCurrents() > 0  )
+      ThereIsCurrent =Standard_True;
+    else
+      ThereIsCurrent =Standard_False;
+
+    if ( ThereIsArgument && IsBound ) {
+      const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
+      if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
+        const Handle(AIS_InteractiveObject) ashape =
+          Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(name));
+        SetInteriorStyle (ashape, Draw::Atoi (argv[2]), di);
+      }
+    }
+    //=======================================================================
+    // No arguments specified
+    // But there are one or more selected objects
+    //=======================================================================
+    if (ThereIsCurrent && !ThereIsArgument) {
+      for (TheAISContext() -> InitCurrent() ;
+           TheAISContext() -> MoreCurrent() ;
+           TheAISContext() ->NextCurrent() )
+      {
+        Handle(AIS_InteractiveObject) ashape =  TheAISContext() -> Current();
+        SetInteriorStyle (ashape, Draw::Atoi (argv[1]), di);
+      }
+    }
+    //=======================================================================
+    // No arguments specified and there are no selected objects
+    //=======================================================================
+    else if (!ThereIsCurrent && !ThereIsArgument){
+      ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
+       it(GetMapOfAIS());
+      while ( it.More() ) {
+        Handle(AIS_InteractiveObject) ashape =
+          Handle(AIS_InteractiveObject)::DownCast (it.Key1());
+        if (!ashape.IsNull())
+          SetInteriorStyle (ashape, Draw::Atoi (argv[1]), di);
+        it.Next();
+      }
+    }
+    TheAISContext()->UpdateCurrentViewer();
+  }
+  return 0;
+}
+
 //==============================================================================
 //function : VDonly2
 //author   : ege
@@ -1506,126 +1591,100 @@ static int VDonly2(Draw_Interpretor& , Standard_Integer argc, const char** argv)
 }
 
 //==============================================================================
-//function : VErase2
-//author   : ege
-//purpose  : Erase some  selected or named  objects
+//function : VErase
+//purpose  : Erase some selected or named objects
 //           if there is no selected or named objects, the whole viewer is erased
-//Draw arg : verase2 [name1] ... [name n]
 //==============================================================================
-static int VErase2(Draw_Interpretor& ,         Standard_Integer argc,  const char** argv)
-
+int VErase (Draw_Interpretor& theDI,
+            Standard_Integer  theArgNb,
+            const char**      theArgVec)
 {
-  if ( a3DView().IsNull() )
+  if (a3DView().IsNull())
+  {
     return 1;
+  }
 
-  Standard_Boolean ThereIsCurrent = TheAISContext() -> NbCurrents() > 0;
-  Standard_Boolean ThereIsArgument= argc>1;
-  if(TheAISContext()->HasOpenedContext())
-    TheAISContext()->CloseLocalContext();
-
-  //===============================================================
-  // Il n'y a pas d'arguments mais des objets selectionnes(current)
-  // dans le viewer
-  //===============================================================
-  if (!ThereIsArgument && ThereIsCurrent) {
-    ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
-      it (GetMapOfAIS());
-    while ( it.More() ) {
-      if (it.Key1()->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
-        const Handle(AIS_InteractiveObject) aShape =
-          Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-        if (TheAISContext()->IsCurrent(aShape))
-          TheAISContext()->Erase(aShape,Standard_False);
-      }
-      it.Next();
+  TheAISContext()->CloseAllContexts (Standard_False);
+  const Standard_Boolean isEraseAll = TCollection_AsciiString (theArgNb > 0 ? theArgVec[0] : "").IsEqual ("veraseall");
+  if (theArgNb > 1)
+  {
+    if (isEraseAll)
+    {
+      std::cerr << " Syntax error: " << theArgVec[0] << " too much arguments.\n";
+      return 1;
     }
 
-    TheAISContext() ->UpdateCurrentViewer();
-  }
-
-  //===============================================================
-  // Il n'y a pas d'arguments et aucuns objets selectionnes
-  // dans le viewer:
-  // On erase tout le viewer
-  //===============================================================
+    // has a list of names
+    for (Standard_Integer anArgIter = 1; anArgIter < theArgNb; ++anArgIter)
+    {
+      TCollection_AsciiString aName = theArgVec[anArgIter];
+      if (!GetMapOfAIS().IsBound2 (aName))
+      {
+        continue;
+      }
 
-  if (!ThereIsArgument && !ThereIsCurrent) {
-    ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it (GetMapOfAIS());
-    while ( it.More() ) {
-      if (it.Key1()->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
-        const Handle(AIS_InteractiveObject) aShape =
-          Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-        TheAISContext()->Erase(aShape,Standard_False);
-      } else if (it.Key1()->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
-        const Handle(NIS_InteractiveObject) aShape =
-          Handle(NIS_InteractiveObject)::DownCast(it.Key1());
-        TheNISContext()->Erase(aShape);
+      const Handle(Standard_Transient)    anObj = GetMapOfAIS().Find2 (aName);
+      const Handle(AIS_InteractiveObject) anIO  = Handle(AIS_InteractiveObject)::DownCast (anObj);
+      theDI << aName.ToCString() << " ";
+      if (!anIO.IsNull())
+      {
+        TheAISContext()->Erase (anIO, Standard_False);
+      }
+      else
+      {
+        const Handle(NIS_InteractiveObject) aNisIO = Handle(NIS_InteractiveObject)::DownCast (anObj);
+        if (!aNisIO.IsNull())
+        {
+          TheNISContext()->Erase (aNisIO);
+        }
       }
-      it.Next();
     }
-    TheAISContext() ->UpdateCurrentViewer();
-//    TheNISContext()->UpdateViews();
+    TheAISContext()->UpdateCurrentViewer();
+    return 0;
   }
 
-  //===============================================================
-  // Il y a des arguments
-  //===============================================================
-  if (ThereIsArgument) {
-    for (int i=1; i<argc ; i++) {
-      TCollection_AsciiString name=argv[i];
-      Standard_Boolean IsBound= GetMapOfAIS().IsBound2(name);
-      if (IsBound) {
-        const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
-        if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
-          const Handle(AIS_InteractiveObject) aShape =
-            Handle(AIS_InteractiveObject)::DownCast (anObj);
-          TheAISContext()->Erase(aShape,Standard_False);
-        } else if (anObj->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
-          const Handle(NIS_InteractiveObject) aShape =
-            Handle(NIS_InteractiveObject)::DownCast (anObj);
-          TheNISContext()->Erase(aShape);
-        }
+  if (!isEraseAll
+   && TheAISContext()->NbCurrents() > 0)
+  {
+    // remove all currently selected objects
+    for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
+         anIter.More(); anIter.Next())
+    {
+      const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
+      if (!anIO.IsNull()
+       && TheAISContext()->IsCurrent (anIO))
+      {
+        theDI << anIter.Key2().ToCString() << " ";
+        TheAISContext()->Erase (anIO, Standard_False);
       }
     }
-    TheAISContext() ->UpdateCurrentViewer();
-//    TheNISContext() ->UpdateViews();
-  }
-  return 0;
-}
 
-//==============================================================================
-//function : VEraseAll
-//author   : ege
-//purpose  : Erase all the objects displayed in the viewer
-//Draw arg : veraseall
-//==============================================================================
-static int VEraseAll(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+    TheAISContext()->UpdateCurrentViewer();
+    return 0;
+  }
 
-{
-  // Verification des arguments
-  if (argc>1){ di<<" Syntaxe error: "<<argv[0]<<" too much arguments."<<"\n";return 1;}
-  if (a3DView().IsNull() ) {di<<" Error: vinit hasn't been called."<<"\n";return 1;}
-  TheAISContext()->CloseAllContexts(Standard_False);
-  ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
-    it(GetMapOfAIS());
-  while ( it.More() ) {
-    if (it.Key1()->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
-      const Handle(AIS_InteractiveObject) aShape =
-        Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-      TheAISContext()->Erase(aShape,Standard_False);
-    } else if (it.Key1()->IsKind(STANDARD_TYPE(NIS_InteractiveObject))) {
-      const Handle(NIS_InteractiveObject) aShape =
-        Handle(NIS_InteractiveObject)::DownCast(it.Key1());
-      TheNISContext()->Erase(aShape);
+  // erase entire viewer
+  for (ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName anIter (GetMapOfAIS());
+       anIter.More(); anIter.Next())
+  {
+    const Handle(AIS_InteractiveObject) anIO = Handle(AIS_InteractiveObject)::DownCast (anIter.Key1());
+    if (!anIO.IsNull())
+    {
+      TheAISContext()->Erase (anIO, Standard_False);
+    }
+    else
+    {
+      const Handle(NIS_InteractiveObject) aNisIO = Handle(NIS_InteractiveObject)::DownCast (anIter.Key1());
+      if (!aNisIO.IsNull())
+      {
+        TheNISContext()->Erase (aNisIO);
+      }
     }
-    it.Next();
   }
-  TheAISContext() ->UpdateCurrentViewer();
-//  TheNISContext() ->UpdateViews();
+  TheAISContext()->UpdateCurrentViewer();
   return 0;
 }
 
-
 //==============================================================================
 //function : VDisplayAll
 //author   : ege
@@ -1672,61 +1731,6 @@ static int VDisplayAll(  Draw_Interpretor& di, Standard_Integer argc, const char*
   return 0;
 }
 
-
-//#######################################################################################################
-
-
-static TCollection_AsciiString GetEnvir (Draw_Interpretor& di) {
-
-  static Standard_Boolean IsDefined=Standard_False ;
-  static TCollection_AsciiString VarName;
-  if ( !IsDefined ) {
-    const char *envir, *casroot ;
-    envir = getenv("CSF_MDTVTexturesDirectory") ;
-
-    Standard_Boolean HasDefinition = Standard_False ;
-    if ( !envir ) {
-      casroot  = getenv("CASROOT");
-      if ( casroot ) {
-       VarName = TCollection_AsciiString  (casroot);
-       VarName += "/src/Textures" ;
-       HasDefinition = Standard_True ;
-      }
-    } else {
-      VarName = TCollection_AsciiString  (envir);
-      HasDefinition = Standard_True ;
-    }
-    if ( HasDefinition ) {
-      OSD_Path aPath ( VarName );
-      OSD_Directory aDir(aPath);
-      if ( aDir.Exists () ) {
-       TCollection_AsciiString aTexture = VarName + "/2d_MatraDatavision.rgb" ;
-       OSD_File TextureFile ( aTexture );
-       if ( !TextureFile.Exists() ) {
-         di << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << "\n";
-         di << " not all files are found in : "<<VarName.ToCString() << "\n";
-         Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory or CASROOT not correctly setted " );
-       }
-      } else {
-       di << " CSF_MDTVTexturesDirectory or CASROOT not correctly setted " << "\n";
-       di << " Directory : "<< VarName.ToCString() << " not exist " << "\n";
-       Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory or CASROOT not correctly setted " );
-      }
-      return VarName ;
-    } else {
-      di << " CSF_MDTVTexturesDirectory and CASROOT not setted " << "\n";
-      di << " one of these variable are mandatory to use this fonctionnality" << "\n";
-      Standard_Failure::Raise ( "CSF_MDTVTexturesDirectory and CASROOT not setted " );
-    }
-    IsDefined = Standard_True ;
-  }
-  return VarName ;
-
-}
-
-//#######################################################################################################
-
-
 //#######################################################################################################
 
 //##     VTexture
@@ -1795,8 +1799,7 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha
        {
          if(strcasecmp(argv[2],"?")==0)
            {
-             TCollection_AsciiString monPath = GetEnvir (di) ;
-
+             TCollection_AsciiString monPath = Graphic3d_TextureRoot::TexturesFolder();
              di<<"\n Files in current directory : \n"<<"\n";
              TCollection_AsciiString Cmnd ("glob -nocomplain *");
              di.Eval(Cmnd.ToCString());
@@ -1834,8 +1837,8 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha
        }
 
       myShape->SetTextureScale (( argv[2] ? Standard_True    : Standard_False ),
-                               ( argv[2] ? atof(argv[2])    : 1.0 ),
-                               ( argv[2] ? atof(argv[argc-1]) : 1.0 ) );
+                               ( argv[2] ? Draw::Atof(argv[2])    : 1.0 ),
+                               ( argv[2] ? Draw::Atof(argv[argc-1]) : 1.0 ) );
       break;
 
     case 3: // vtexorigin : we change the origin of the texture on the shape
@@ -1845,8 +1848,8 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha
          return 1;
        }
       myShape->SetTextureOrigin (( argv[2] ? Standard_True    : Standard_False ),
-                                ( argv[2] ? atof(argv[2])    : 0.0 ),
-                                ( argv[2] ? atof(argv[argc-1]) : 0.0 ));
+                                ( argv[2] ? Draw::Atof(argv[2])    : 0.0 ),
+                                ( argv[2] ? Draw::Atof(argv[argc-1]) : 0.0 ));
       break;
 
     case 4: // vtexrepeat : we change the number of occurences of the texture on the shape
@@ -1858,7 +1861,7 @@ Standard_Integer VTexture (Draw_Interpretor& di,Standard_Integer argc, const cha
       if (argc>2 && argv[2])
        {
          di <<"Texture repeat enabled"<<"\n";
-         myShape->SetTextureRepeat(Standard_True, atof(argv[2]), atof(argv[argc-1]) );
+         myShape->SetTextureRepeat(Standard_True, Draw::Atof(argv[2]), Draw::Atof(argv[argc-1]) );
        }
       else
        {
@@ -1969,112 +1972,6 @@ static int VDisplay2 (Draw_Interpretor& di, Standard_Integer argc, const char**
   return 0;
 }
 
-//==============================================================================
-//function : VMoveA
-//purpose  : Test the annimation of an object along a
-//           predifined trajectory
-//Draw arg : vmove ShapeName
-//==============================================================================
-
-#ifdef DEB
-static int VMoveA (Draw_Interpretor& di, Standard_Integer argc, const char** argv) {
-
-  OSD_Timer myTimer;
-  myTimer.Start();
-
-  if (TheAISContext()->HasOpenedContext())
-    TheAISContext()->CloseLocalContext();
-
-  Standard_Real Step=2*M_PI/180;
-  Standard_Real Angle=0;
-  // R est le rayon de l'hellicoide
-  Standard_Real R=50;
-  // D est la distance parcourue en translation en 1 tour
-  Standard_Real D=50;
-
-  Handle(AIS_InteractiveObject) aIO;
-
-  if (GetMapOfAIS().IsBound2(argv[1]))
-    aIO = Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[1]));
-
-  if (aIO.IsNull()) {
-    di<<" Syntaxe error: "<<argv[1]<<" doesn't exist"<<"\n";
-    return 1;
-  }
-  TheAISContext()->Deactivate(aIO);
-
-  // boucle generant le mouvement
-  if(argc==3) {
-    di<<" Transformations"<<"\n";
-    for (Standard_Real myAngle=0;Angle<5*2*M_PI; myAngle++) {
-
-      Angle=Step*myAngle;
-      gp_Ax3 newBase(gp_Pnt(R*cos(Angle), R*sin(Angle), D*Angle/(2*M_PI) ), gp_Vec(0,0,1), gp_Vec(1,0,0)  );
-      gp_Trsf myTransfo;
-      myTransfo.SetTransformation(newBase.Rotated(gp_Ax1(gp_Pnt(R*cos(Angle),R*sin(Angle),0), gp_Dir(0,0,1)  ),Angle ) );
-      TheAISContext()->SetLocation(aIO,myTransfo);
-
-      TheAISContext() ->UpdateCurrentViewer();
-
-    }
-  }
-  else {
-    di<<" Locations"<<"\n";
-    gp_Trsf myAngleTrsf;
-    myAngleTrsf.SetRotation(gp_Ax1(gp_Pnt(0,0,0),gp_Dir(0,0,1) ), Step  );
-    TopLoc_Location myDeltaAngle (myAngleTrsf);
-    gp_Trsf myDistTrsf;
-    myDistTrsf.SetTranslation(gp_Dir(0,0,1) );
-    TopLoc_Location myDeltaDist (myDistTrsf);
-    TopLoc_Location myTrueLoc;
-
-    for (Standard_Real myAngle=0;Angle<5*2*M_PI; myAngle++) {
-
-      Angle=Step*myAngle;
-      myTrueLoc=myTrueLoc*myDeltaAngle*myDeltaDist;
-      TheAISContext()->SetLocation(aIO,myTrueLoc );
-      TheAISContext() ->UpdateCurrentViewer();
-    }
-  }
-
-
-  TopoDS_Shape ShapeBis=((*(Handle(AIS_Shape)*)&aIO)->Shape()).Located( aIO->Location() );
-
-  //TopLoc_Location Tempo=aIO->Location();
-  //TopoDS_Shape ShapeBis=((*(Handle(AIS_Shape)*)&aIO)->Shape());
-  //ShapeBis.Located(Tempo);
-
-
-  // On reset la location (origine) contenue dans l'AISInteractiveObject
-  TheAISContext() ->ResetLocation(aIO);
-
-  // On force aShape a devenir l'AIS IO propre a ShapeBis
-
-  // Pour cela on force aShape(AIS IO) a devenir une AISShape
-  // ->Set() est une methode de AIS_Shape
-  (*(Handle(AIS_Shape)*)& aIO)->Set(ShapeBis);
-
-  // On donne a ShapeBis le nom de l'AIS IO
-  //Rep::Set(argv[1],ShapeBis);
-
-
-  TheAISContext()->Redisplay(aIO,Standard_False);
-
-  // On reactive la selection des primitives sensibles
-  TheAISContext()->Activate(aIO,0);
-
-  TheAISContext() ->UpdateCurrentViewer();
-  a3DView() -> Redraw();
-
-  myTimer.Stop();
-  di<<" Temps ecoule "<<"\n";
-  myTimer.Show();
-
-  return 0;
-}
-#endif
-
-
 //==============================================================================
 //function : VPerf
 //purpose  : Test the annimation of an object along a
@@ -2101,7 +1998,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) {
 
   myTimer.Start();
 
-  if (atoi(argv[3])==1 ) {
+  if (Draw::Atoi(argv[3])==1 ) {
     di<<" Primitives sensibles OFF"<<"\n";
     TheAISContext()->Deactivate(aIO);
   }
@@ -2109,7 +2006,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) {
     di<<" Primitives sensibles ON"<<"\n";
   }
   // Movement par transformation
-  if(atoi(argv[2]) ==1) {
+  if(Draw::Atoi(argv[2]) ==1) {
     di<<" Calcul par Transformation"<<"\n";
     for (Standard_Real myAngle=0;Angle<10*2*M_PI; myAngle++) {
 
@@ -2136,7 +2033,7 @@ static int VPerf(Draw_Interpretor& di, Standard_Integer , const char** argv) {
       TheAISContext() ->UpdateCurrentViewer();
     }
   }
-  if (atoi(argv[3])==1 ){
+  if (Draw::Atoi(argv[3])==1 ){
     // On reactive la selection des primitives sensibles
     TheAISContext()->Activate(aIO,0);
   }
@@ -2280,7 +2177,7 @@ static int VShading(Draw_Interpretor& ,Standard_Integer argc, const char** argv)
   if (argc < 3) {
     myDevCoef  = 0.0008;
   } else {
-    myDevCoef  =atof(argv[2]);
+    myDevCoef  =Draw::Atof(argv[2]);
   }
 
   TCollection_AsciiString name=argv[1];
@@ -2355,7 +2252,7 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch
 
     // IL n'y a aps de nom de shape passe en argument
     if (HaveToSet && !ThereIsName){
-      Standard_Integer aMode=atoi(argv [1]);
+      Standard_Integer aMode=Draw::Atoi(argv [1]);
 
       const char *cmode="???";
       switch (aMode) {
@@ -2467,7 +2364,7 @@ static int VActivatedMode (Draw_Interpretor& di, Standard_Integer argc, const ch
       }
     }
     else if (HaveToSet && ThereIsName){
-      Standard_Integer aMode=atoi(argv [2]);
+      Standard_Integer aMode=Draw::Atoi(argv [2]);
       Handle(AIS_InteractiveObject) aIO =
         Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(argv[1]));
 
@@ -2952,90 +2849,7 @@ static int VPickShape( Draw_Interpretor& di, Standard_Integer argc, const char**
     }
   }
   return 0;
-
-}
-
-
-//=======================================================================
-//function : VPickObject
-//purpose  : filters can be set (type of Object to pick....
-//
-//=======================================================================
-// Unused :
-#ifdef DEB
-static int VPickObject( Draw_Interpretor& , Standard_Integer /*argc*/, const char** /*argv*/)
-{
-  // preparation de la nomination automatique
-  static TCollection_AsciiString ObjType[] ={"None","Datum","Shape","Object","Relation"};
-//  static char* DatumSig [8] ={"Point","Axis","Trih","PlTri","Line","Circle","Plane","UnK"};
-
-/*  TCollection_AsciiString name;
-
-  Standard_Integer NbToPick = argc>2 ? argc-2 : 1;
-  if(NbToPick==1){
-    PickSh = ViewerTest::PickObject(theType);
-
-    if(PickSh.IsNull())
-      return 1;
-    if(argc>2){
-      name += argv[2];
-    }
-    else{
-
-      if(!PickSh.IsNull()){
-       nbOfSub[Standard_Integer(theType)]++;
-       name += "Picked_";
-       name += nameType[Standard_Integer(theType)];
-       TCollection_AsciiString indxstring(nbOfSub[Standard_Integer(theType)]);
-       name +="_";
-       name+=indxstring;
-      }
-    }
-    // si on avait une petite methode pour voir si la shape
-    // est deja dans la Double map, ca eviterait de creer....
-    DBRep::Set(name.ToCString(),PickSh);
-
-    Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
-    GetMapOfAIS().Bind(newsh, name);
-    TheAISContext()->Display(newsh);
-    cout<<"Nom de la shape pickee : "<<name<<endl;
-  }
-
-  // Plusieurs objets a picker, vite vite vite....
-  //
-  else{
-    Standard_Boolean autonaming = !strcasecmp(argv[2],".");
-    Handle(TopTools_HArray1OfShape) arr = new TopTools_HArray1OfShape(1,NbToPick);
-    if(ViewerTest::PickShapes(theType,arr)){
-      for(Standard_Integer i=1;i<=NbToPick;i++){
-       PickSh = arr->Value(i);
-       if(!PickSh.IsNull()){
-         if(autonaming){
-           nbOfSub[Standard_Integer(theType)]++;
-           name.Clear();
-           name += "Picked_";
-           name += nameType[Standard_Integer(theType)];
-           TCollection_AsciiString indxstring(nbOfSub[Standard_Integer(theType)]);
-           name +="_";
-           name+=indxstring;
-         }
-       }
-       else
-         name = argv[1+i];
-
-       DBRep::Set(name.ToCString(),PickSh);
-       Handle(AIS_Shape) newsh = new AIS_Shape(PickSh);
-       GetMapOfAIS().Bind(newsh, name);
-       cout<<"display of picke shape #"<<i<<" - nom : "<<name<<endl;
-       TheAISContext()->Display(newsh);
-
-      }
-    }
-  }
-  */
-  return 0;
 }
-#endif
 
 //=======================================================================
 //function : list of known objects
@@ -3234,20 +3048,20 @@ static int VSetTransMode ( Draw_Interpretor& di, Standard_Integer argc, const ch
 
   TCollection_AsciiString shapeName;
   shapeName = argv[1];
-  Standard_Integer persFlag1 = atoi(argv[2]);
+  Standard_Integer persFlag1 = Draw::Atoi(argv[2]);
   Standard_Integer persFlag2 = 0;
   Standard_Integer persFlag3 = 0;
   gp_Pnt origin = gp_Pnt( 0.0, 0.0, 0.0 );
   if ( argc == 4 || argc == 5 || argc == 7 || argc == 8 ) {
-    persFlag2 = atoi(argv[3]);
+    persFlag2 = Draw::Atoi(argv[3]);
   }
   if ( argc == 5 || argc == 8 ) {
-    persFlag3 = atoi(argv[4]);
+    persFlag3 = Draw::Atoi(argv[4]);
   }
   if ( argc >= 6 ) {
-    origin.SetX( atof(argv[argc - 3]) );
-    origin.SetY( atof(argv[argc - 2]) );
-    origin.SetZ( atof(argv[argc - 1]) );
+    origin.SetX( Draw::Atof(argv[argc - 3]) );
+    origin.SetY( Draw::Atof(argv[argc - 2]) );
+    origin.SetZ( Draw::Atof(argv[argc - 1]) );
   }
 
   Standard_Boolean IsBound = GetMapOfAIS().IsBound2(shapeName);
@@ -3293,132 +3107,6 @@ static Standard_Integer vr(Draw_Interpretor& , Standard_Integer , const char** a
   Ctx->Display(ais);
   return 0;
 }
-//============================================================================
-#include <AIS2D_InteractiveContext.hxx>
-#include <HLRAlgo_Projector.hxx>
-#include <Prs3d_Projector.hxx>
-#include <AIS2D_ProjShape.hxx>
-#include <gp_Ax2.hxx>
-#include <gp.hxx>
-Standard_Integer hlrtest(Draw_Interpretor&,   Standard_Integer n,   const char** a)
-{
-
-  Handle(AIS2D_InteractiveContext) aContext2D = Viewer2dTest::GetAIS2DContext();
-  /////////////////////
-  TopoDS_Shape aShape =  DBRep::Get(a[1]);
-  aContext2D->EraseAll(Standard_True);
-  //Standard_Integer aPolyAlgo = 0;
-  Standard_Boolean IsPoly = Standard_False;
-  gp_Ax2 anAx2 = gp::XOY();
-
-  //if(n > 2) aPolyAlgo = atoi(a[2]);
-
-  //IsPoly = aPolyAlgo > 0;
-
-  TopoDS_Shape aResult = aShape;
-
-
-  if (n == 11)
-  {
-    Standard_Real x = atof(a[2]);
-    Standard_Real y = atof(a[3]);
-    Standard_Real z = atof(a[4]);
-
-    Standard_Real dx = atof(a[5]);
-    Standard_Real dy = atof(a[6]);
-    Standard_Real dz = atof(a[7]);
-
-    Standard_Real dx1 = atof(a[8]);
-    Standard_Real dy1 = atof(a[9]);
-    Standard_Real dz1 = atof(a[10]);
-
-    gp_Pnt anOrigin (x, y, z);
-    gp_Dir aNormal  (dx, dy, dz);
-    gp_Dir aDX      (dx1, dy1, dz1);
-    anAx2 = gp_Ax2(anOrigin, aNormal, aDX);
-  }
-
-
-  HLRAlgo_Projector aProjector(anAx2);
-
-  //Prs3d_Projector aProjector_t(Standard_False,1, 0,0,1,0,0,1000,0,1,0);
-
-  //aProjector =  aProjector_t.Projector();
-
-  Handle(AIS2D_ProjShape) myDisplayableShape =
-    new AIS2D_ProjShape(aProjector,0,IsPoly, Standard_False);
-
-  myDisplayableShape->ShowEdges(Standard_True, Standard_False,
-                               Standard_False, Standard_True, Standard_False);
-
-  myDisplayableShape->Add( aResult );
-
-
-  aContext2D->Display( myDisplayableShape,Standard_True );
-  aContext2D->UpdateCurrentViewer();
-
-  return 0;
-}
-
-Standard_Integer phlrtest(Draw_Interpretor&,   Standard_Integer n,   const char** a)
-{
-
-  Handle(AIS2D_InteractiveContext) aContext2D = Viewer2dTest::GetAIS2DContext();
-  /////////////////////
-  TopoDS_Shape aShape =  DBRep::Get(a[1]);
-  aContext2D->EraseAll(Standard_True);
-  //Standard_Integer aPolyAlgo = 0;
-  Standard_Boolean IsPoly = Standard_True;
-  gp_Ax2 anAx2 = gp::XOY();
-
-  //if(n > 2) aPolyAlgo = atoi(a[2]);
-
-  //IsPoly = aPolyAlgo > 0;
-
-  TopoDS_Shape aResult = aShape;
-
-
-  if (n == 11)
-  {
-    Standard_Real x = atof(a[2]);
-    Standard_Real y = atof(a[3]);
-    Standard_Real z = atof(a[4]);
-
-    Standard_Real dx = atof(a[5]);
-    Standard_Real dy = atof(a[6]);
-    Standard_Real dz = atof(a[7]);
-
-    Standard_Real dx1 = atof(a[8]);
-    Standard_Real dy1 = atof(a[9]);
-    Standard_Real dz1 = atof(a[10]);
-
-    gp_Pnt anOrigin (x, y, z);
-    gp_Dir aNormal  (dx, dy, dz);
-    gp_Dir aDX      (dx1, dy1, dz1);
-    anAx2 = gp_Ax2(anOrigin, aNormal, aDX);
-  }
-
-
-  HLRAlgo_Projector aProjector(anAx2);
-
-  //Prs3d_Projector aProjector_t(Standard_False,1, 0,0,1,0,0,1000,0,1,0);
-
-  //aProjector =  aProjector_t.Projector();
-
-  Handle(AIS2D_ProjShape) myDisplayableShape =
-    new AIS2D_ProjShape(aProjector,0,IsPoly, Standard_False);
-
-  myDisplayableShape->ShowEdges(Standard_True, Standard_False,
-                               Standard_False, Standard_True, Standard_False);
-
-  myDisplayableShape->Add( aResult );
-
-
-  aContext2D->Display( myDisplayableShape,Standard_True );
-  aContext2D->UpdateCurrentViewer();
-
-  return 0;
-}
 
 //==============================================================================
 //function : ViewerTest::Commands
@@ -3432,33 +3120,43 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
   ViewerTest::ObjectCommands(theCommands);
   ViewerTest::FilletCommands(theCommands);
   ViewerTest::VoxelCommands(theCommands);
+  ViewerTest::OpenGlCommands(theCommands);
 
   const char *group = "AIS_Display";
 
   // display
+  theCommands.Add("visos",
+                  "visos [name1 ...] [nbUIsos nbVIsos IsoOnPlane(0|1)]\n"
+                  "\tIf last 3 optional parameters are not set prints numbers of U-, V- isolines and IsoOnPlane.\n",
+                 __FILE__, visos, group);
 
   theCommands.Add("vdisplay",
-                 "vdisplay         : vdisplay2 name1 [name2] ... [name n] ",
+                 "vdisplay name1 [name2] ... [name n]"
+      "\n\t\t: Displays named objects",
                  __FILE__,VDisplay2,group);
 
   theCommands.Add("verase",
-                 "verase      : verase2 [name1] ...  [name n] ",
-                 __FILE__,VErase2,group);
+      "verase [name1] ...  [name n]"
+      "\n\t\t: Erases selected or named objects."
+      "\n\t\t: If there are no selected or named objects the whole viewer is erased.",
+                 __FILE__, VErase, group);
 
   theCommands.Add("vdonly",
-                 "vdonly         : vdonly2 [name1] ...  [name n]",
+                 "vdonly [name1] ...  [name n]"
+      "\n\t\t: Displays only selected or named objects",
                  __FILE__,VDonly2,group);
 
   theCommands.Add("vdisplayall",
-                 "vdisplayall         : vdisplayall",
+                 "Displays all erased interactive objects (see vdir and vstate)",
                  __FILE__,VDisplayAll,group);
 
   theCommands.Add("veraseall",
-                 "veraseall        : veraseall ",
-                 __FILE__,VEraseAll,group);
+                 "Erases all objects displayed in the viewer",
+                 __FILE__, VErase, group);
 
   theCommands.Add("verasetype",
-                 "verasetype        : verasetype <Type>  \n\t erase all the displayed objects of one given kind (see vtypes)",
+                 "verasetype <Type>"
+      "\n\t\t: Erase all the displayed objects of one given kind (see vtypes)",
                  __FILE__,VEraseType,group);
 
   theCommands.Add("vdisplaytype",
@@ -3474,38 +3172,51 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
                  __FILE__,VDispMode,group);
 
   theCommands.Add("vsetdispmode",
-                 "vsetdispmode    : vsetdispmode [name] mode(1,2,..): no name -> on selected objects ",
+                 "vsetdispmode [name] mode(1,2,..)"
+      "\n\t\t: Sets display mode for all, selected or named objects.",
                  __FILE__,VDispMode,group);
 
   theCommands.Add("vunsetdispmode",
-                 "vunsetdispmode : vunsetdispmode [name] mode(1,2,..): no name -> on selected objects",
+                 "vunsetdispmode [name]"
+      "\n\t\t: Unsets custom display mode for selected or named objects.",
                  __FILE__,VDispMode,group);
 
   theCommands.Add("vdir",
-                 "vdir",
+                 "Lists all objects displayed in 3D viewer",
                  __FILE__,VDebug,group);
 
   theCommands.Add("vdump",
-                  "<filename>.{png|bmp|jpg|gif} [buffer={rgb|rgba|depth}] [width height]\n\t\t: Dump contents of viewer window to PNG, BMP, JPEG or GIF file",
+    #ifdef HAVE_FREEIMAGE
+      "<filename>.{png|bmp|jpg|gif} [buffer={rgb|rgba|depth}] [width height]"
+      "\n\t\t: Dumps contents of viewer window to PNG, BMP, JPEG or GIF file",
+    #else
+      "<filename>.{ppm} [buffer={rgb|rgba|depth}] [width height]"
+      "\n\t\t: Dumps contents of viewer window to PPM image file",
+    #endif
                  __FILE__,VDump,group);
 
   theCommands.Add("vsub",      "vsub 0/1 (off/on) [obj]        : Subintensity(on/off) of selected objects",
                  __FILE__,VSubInt,group);
 
   theCommands.Add("vsetcolor",
-                 "vsetcolor         : vsetcolor [name of shape] ColorName",
+                 "vsetcolor [name] ColorName"
+      "\n\t\t: Sets color for all, selected or named objects.",
                  __FILE__,VColor2,group);
 
   theCommands.Add("vunsetcolor",
-                 "vunsetcolor     : vunsetcolor   [name of shape] ",
+                 "vunsetcolor [name]"
+      "\n\t\t: Resets color for all, selected or named objects.",
                  __FILE__,VColor2,group);
 
   theCommands.Add("vsettransparency",
-                 "vsettransparency          : vtransparency [name of shape] TransparenctCoef (0 -> 1)",
+                 "vsettransparency [name] Coefficient"
+      "\n\t\t: Sets transparency for all, selected or named objects."
+      "\n\t\t: The Coefficient may be between 0.0 (opaque) and 1.0 (fully transparent).",
                  __FILE__,VTransparency,group);
 
   theCommands.Add("vunsettransparency",
-                 "vunsettransparency          : vtransparency [name of shape]",
+                 "vunsettransparency [name]"
+      "\n\t\t: Resets transparency for all, selected or named objects.",
                  __FILE__,VTransparency,group);
 
   theCommands.Add("vsetmaterial",
@@ -3524,6 +3235,10 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
                  "vunsetwidth          : vwidth  [name of shape]",
                  __FILE__,VWidth,group);
 
+  theCommands.Add("vsetinteriorstyle",
+                 "vsetinteriorstyle    : vsetinteriorstyle [name of shape] style",
+                 __FILE__,VInteriorStyle,group);
+
   theCommands.Add("vardis",
                  "vardis          : display activeareas",
                  __FILE__,VDispAreas,group);
@@ -3596,7 +3311,9 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
                  "vunsetActivatedModes:   vunsetam  ",
                  __FILE__,VActivatedMode,group);
 
-  theCommands.Add("vstate",   "vstate [Name1] ... [NameN] :No arg, select currents; no currrent select all  ",
+  theCommands.Add("vstate",
+      "vstate [name1] ... [nameN]"
+      "\n\t\t: Reports show/hidden state for selected or named objects",
                  __FILE__,VState,group);
 
   theCommands.Add("vpickshapes",
@@ -3614,9 +3331,6 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
   theCommands.Add("vr", "vr : reading of the shape",
                  __FILE__,vr, group);
 
-  theCommands.Add("hlrtest"       , "Usage: hlrtest s1 s2 ...", __FILE__, hlrtest, group);
-  theCommands.Add("phlrtest"       , "Usage: hlrtest s1 s2 ...", __FILE__, phlrtest, group);
-
 }
 
 //=====================================================================
@@ -3682,7 +3396,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
 // argv[4] - Standard_Real Angle
 // argv[5] - Standard_Integer Reverse
 
-//  sprintf(prefix, argv[1]);
+//  Sprintf(prefix, argv[1]);
   Standard_Real anAngle = 0;
   Standard_Boolean Rev = Standard_False;
   Standard_Integer rev = 0;
@@ -3694,7 +3408,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
     di << "TEST : Plane is NULL" << "\n";
     return 1;
   }
-  anAngle = atof(argv[4]);
+  anAngle = Draw::Atof(argv[4]);
   anAngle = 2*M_PI * anAngle / 360.0;
   gp_Pln aPln;
   Handle( Geom_Surface )aSurf;
@@ -3702,7 +3416,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
   Standard_Real Offset;
   gp_Dir aDir;
   if(argc > 4) { // == 5
-    rev = atoi(argv[5]);
+    rev = Draw::Atoi(argv[5]);
     Rev = (rev)? Standard_True : Standard_False;
   }
 
@@ -3789,9 +3503,9 @@ void ViewerTest::MyCommands( Draw_Interpretor& theCommands)
 void ViewerTest::Factory(Draw_Interpretor& theDI)
 {
   // definition of Viewer Command
-      ViewerTest::Commands(theDI);
-      ViewerTest::AviCommands(theDI);
-      Viewer2dTest::Commands(theDI);
+  ViewerTest::Commands(theDI);
+  ViewerTest::AviCommands(theDI);
+
 #ifdef DEB
       theDI << "Draw Plugin : OCC V2d & V3d commands are loaded" << "\n";
 #endif