0031189: Draw Harness, ViewerTest - send messages to Message::DefaultMessenger()
[occt.git] / src / ViewerTest / ViewerTest.cxx
index fb43b30..a3ae0d7 100644 (file)
 #include <TopExp_Explorer.hxx>
 #include <BRepAdaptor_Curve.hxx>
 #include <StdSelect_ShapeTypeFilter.hxx>
-#include <AIS.hxx>
 #include <AIS_ColoredShape.hxx>
 #include <AIS_InteractiveObject.hxx>
 #include <AIS_Trihedron.hxx>
 #include <AIS_Axis.hxx>
-#include <AIS_Relation.hxx>
+#include <PrsDim.hxx>
+#include <PrsDim_Relation.hxx>
 #include <AIS_TypeFilter.hxx>
 #include <AIS_SignatureFilter.hxx>
 #include <AIS_ListOfInteractive.hxx>
@@ -52,6 +52,7 @@
 #include <Graphic3d_GraphicDriver.hxx>
 #include <Graphic3d_MediaTextureSet.hxx>
 #include <Image_AlienPixMap.hxx>
+#include <Message.hxx>
 #include <OSD_File.hxx>
 #include <Prs3d_Drawer.hxx>
 #include <Prs3d_ShadingAspect.hxx>
@@ -202,23 +203,18 @@ namespace
   {
     const Standard_Integer THE_COLOR_COMPONENT_NOT_PARSED = -1;
     Graphic3d_Vec4i        anIntegerColor (THE_COLOR_COMPONENT_NOT_PARSED);
-    if (!parseNumericalColor (theNumberOfColorComponents, theColorComponentStrings, anIntegerColor))
+    if (!parseNumericalColor (theNumberOfColorComponents, theColorComponentStrings, anIntegerColor)
+      || anIntegerColor.maxComp() <= 1)
     {
       return false;
     }
-
-    const bool hasColorComponentGreaterThanOne = (anIntegerColor.maxComp() > 1);
     if (anIntegerColor.a() == THE_COLOR_COMPONENT_NOT_PARSED)
     {
       anIntegerColor.a() = THE_MAX_INTEGER_COLOR_COMPONENT;
     }
 
-    Graphic3d_Vec4 aRealColor (anIntegerColor);
-    if (hasColorComponentGreaterThanOne)
-    {
-      aRealColor /= static_cast<Standard_ShortReal> (THE_MAX_INTEGER_COLOR_COMPONENT);
-    }
-    theColor = Quantity_ColorRGBA (aRealColor);
+    const Graphic3d_Vec4 aRealColor = Graphic3d_Vec4 (anIntegerColor) / static_cast<Standard_ShortReal> (THE_MAX_INTEGER_COLOR_COMPONENT);
+    theColor = Quantity_ColorRGBA (Quantity_ColorRGBA::Convert_sRGB_To_LinearRGB (aRealColor));
     return true;
   }
 
@@ -284,11 +280,12 @@ Standard_Integer ViewerTest::parseColor (const Standard_Integer   theArgNb,
   if (theArgNb >= 3)
   {
     const Standard_Integer aNumberOfColorComponentsToParse = Min (theArgNb, theToParseAlpha ? 4 : 3);
-    Standard_Integer       aNumberOfColorComponentsParsed  = aNumberOfColorComponentsToParse;
+    Standard_Integer aNumberOfColorComponentsParsed = aNumberOfColorComponentsToParse;
     if (parseIntegerColor (aNumberOfColorComponentsParsed, theArgVec, theColor))
     {
       return aNumberOfColorComponentsParsed;
     }
+    aNumberOfColorComponentsParsed = aNumberOfColorComponentsToParse;
     if (parseRealColor (aNumberOfColorComponentsParsed, theArgVec, theColor))
     {
       return aNumberOfColorComponentsParsed;
@@ -342,43 +339,74 @@ void ViewerTest::GetSelectedShapes (TopTools_ListOfShape& theSelectedShapes)
 //function : ParseLineType
 //purpose  :
 //=======================================================================
-Standard_Boolean ViewerTest::ParseLineType (Standard_CString   theArg,
-                                            Aspect_TypeOfLine& theType)
+Standard_Boolean ViewerTest::ParseLineType (Standard_CString theArg,
+                                            Aspect_TypeOfLine& theType,
+                                            uint16_t& thePattern)
 {
   TCollection_AsciiString aTypeStr (theArg);
   aTypeStr.LowerCase();
-  if (aTypeStr == "empty")
+  if (aTypeStr == "empty"
+   || aTypeStr == "-1")
   {
     theType = Aspect_TOL_EMPTY;
+    thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
   }
-  else if (aTypeStr == "solid")
+  else if (aTypeStr == "solid"
+        || aTypeStr == "0")
   {
     theType = Aspect_TOL_SOLID;
+    thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
   }
-  else if (aTypeStr == "dot")
+  else if (aTypeStr == "dot"
+        || aTypeStr == "2")
   {
     theType = Aspect_TOL_DOT;
+    thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
   }
-  else if (aTypeStr == "dash")
+  else if (aTypeStr == "dash"
+        || aTypeStr == "1")
   {
     theType = Aspect_TOL_DASH;
+    thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
   }
-  else if (aTypeStr == "dotdash")
+  else if (aTypeStr == "dotdash"
+        || aTypeStr == "3")
   {
     theType = Aspect_TOL_DOTDASH;
+    thePattern = Graphic3d_Aspects::DefaultLinePatternForType (theType);
   }
-  else if (aTypeStr.IsIntegerValue())
+  else
   {
-    const int aTypeInt = aTypeStr.IntegerValue();
-    if (aTypeInt < -1 || aTypeInt >= Aspect_TOL_USERDEFINED)
+    if (aTypeStr.StartsWith ("0x"))
+    {
+      aTypeStr = aTypeStr.SubString (3, aTypeStr.Length());
+    }
+
+    if (aTypeStr.Length() != 4
+    || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (1)))
+    || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (2)))
+    || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (3)))
+    || !std::isxdigit (static_cast<unsigned char> (aTypeStr.Value (4))))
     {
       return Standard_False;
     }
-    theType = (Aspect_TypeOfLine )aTypeInt;
-  }
-  else
-  {
-    return Standard_False;
+
+    std::stringstream aStream;
+    aStream << std::setbase (16) << aTypeStr.ToCString();
+    if (aStream.fail())
+    {
+      return Standard_False;
+    }
+
+    Standard_Integer aNumber = -1;
+    aStream >> aNumber;
+    if (aStream.fail())
+    {
+      return Standard_False;
+    }
+
+    thePattern = (uint16_t )aNumber;
+    theType = Graphic3d_Aspects::DefaultLineTypeForPattern (thePattern);
   }
   return Standard_True;
 }
@@ -521,6 +549,14 @@ Standard_Boolean ViewerTest::ParseShadingModel (Standard_CString              th
   {
     theModel = Graphic3d_TOSM_FRAGMENT;
   }
+  else if (aTypeStr == "pbr")
+  {
+    theModel = Graphic3d_TOSM_PBR;
+  }
+  else if (aTypeStr == "pbr_facet")
+  {
+    theModel = Graphic3d_TOSM_PBR_FACET;
+  }
   else if (aTypeStr == "default"
         || aTypeStr == "def")
   {
@@ -723,7 +759,7 @@ Standard_Boolean ViewerTest::Display (const TCollection_AsciiString&       theNa
   Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
   if (aCtx.IsNull())
   {
-    std::cout << "Error: AIS context is not available.\n";
+    Message::SendFail ("Error: AIS context is not available.");
     return Standard_False;
   }
 
@@ -731,8 +767,8 @@ Standard_Boolean ViewerTest::Display (const TCollection_AsciiString&       theNa
   {
     if (!theReplaceIfExists)
     {
-      std::cout << "Error: other interactive object has been already registered with name: " << theName << ".\n"
-                << "Please use another name.\n";
+      Message::SendFail() << "Error: other interactive object has been already registered with name: " << theName << ".\n"
+                          << "Please use another name.";
       return Standard_False;
     }
 
@@ -846,7 +882,7 @@ static Standard_Boolean getCtxAndView (Handle(AIS_InteractiveContext)& theCtx,
   if (theCtx.IsNull()
    || theView.IsNull())
   {
-    std::cout << "Error: cannot find an active view!\n";
+    Message::SendFail ("Error: cannot find an active view!");
     return Standard_False;
   }
   return Standard_True;
@@ -872,7 +908,7 @@ void ViewerTest::Clear()
       continue;
     }
 
-    std::cout << "Remove " << anObjIter.Key2() << std::endl;
+    Message::SendInfo() << "Remove " << anObjIter.Key2();
     TheAISContext()->Remove (anObj, Standard_False);
     aListRemoved.Append (anObj);
   }
@@ -976,7 +1012,7 @@ static int visos (Draw_Interpretor& di, Standard_Integer argc, const char** argv
     GetMapOfAIS().Find2(name, aShape);
     if (aShape.IsNull())
     {
-      std::cout << "Syntax error: object '" << name << "' is not found\n";
+      Message::SendFail() << "Syntax error: object '" << name << "' is not found";
       return 1;
     }
 
@@ -1010,7 +1046,7 @@ static Standard_Integer VDispSensi (Draw_Interpretor& ,
 {
   if (theArgNb > 1)
   {
-    std::cout << "Error: wrong syntax!\n";
+    Message::SendFail ("Error: wrong syntax!");
     return 1;
   }
 
@@ -1032,7 +1068,7 @@ static Standard_Integer VClearSensi (Draw_Interpretor& ,
 {
   if (theArgNb > 1)
   {
-    std::cout << "Error: wrong syntax!\n";
+    Message::SendFail ("Error: wrong syntax!");
     return 1;
   }
 
@@ -1071,7 +1107,7 @@ static int VDir (Draw_Interpretor& theDI,
     }
     else
     {
-      std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+      Message::SendFail() << "Syntax error at '" << theArgVec[anArgIter] << "'";
       return 1;
     }
   }
@@ -1121,7 +1157,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
 {
   if (theArgNb < 2)
   {
-    std::cout << "Error: wrong number of arguments! Image file name should be specified at least.\n";
+    Message::SendFail ("Error: wrong number of arguments! Image file name should be specified at least.");
     return 1;
   }
 
@@ -1139,7 +1175,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+        Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
         return 1;
       }
 
@@ -1153,13 +1189,17 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
       {
         aParams.BufferType = Graphic3d_BT_RGB;
       }
+      else if (aBufArg == "red")
+      {
+        aParams.BufferType = Graphic3d_BT_Red;
+      }
       else if (aBufArg == "depth")
       {
         aParams.BufferType = Graphic3d_BT_Depth;
       }
       else
       {
-        std::cout << "Error: unknown buffer '" << aBufArg << "'\n";
+        Message::SendFail() << "Error: unknown buffer '" << aBufArg << "'";
         return 1;
       }
     }
@@ -1167,7 +1207,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at '" << anArg << "'\n";
+        Message::SendFail() << "Error: wrong syntax at '" << anArg << "'";
         return 1;
       }
 
@@ -1205,7 +1245,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
       }
       else
       {
-        std::cout << "Error: unknown stereo format '" << aStereoArg << "'\n";
+        Message::SendFail() << "Error: unknown stereo format '" << aStereoArg << "'";
         return 1;
       }
     }
@@ -1219,6 +1259,11 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       aParams.BufferType = Graphic3d_BT_RGB;
     }
+    else if (anArg == "-red"
+          || anArg ==  "red")
+    {
+      aParams.BufferType = Graphic3d_BT_Red;
+    }
     else if (anArg == "-depth"
           || anArg ==  "depth")
     {
@@ -1230,12 +1275,12 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       if (aParams.Width != 0)
       {
-        std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
         return 1;
       }
       else if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: integer value is expected right after 'width'\n";
+        Message::SendFail() << "Error: integer value is expected right after 'width'";
         return 1;
       }
       aParams.Width = Draw::Atoi (theArgVec[anArgIter]);
@@ -1246,12 +1291,12 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       if (aParams.Height != 0)
       {
-        std::cout << "Error: wrong syntax at " << theArgVec[anArgIter] << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << theArgVec[anArgIter];
         return 1;
       }
       else if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: integer value is expected right after 'height'\n";
+        Message::SendFail() << "Error: integer value is expected right after 'height'";
         return 1;
       }
       aParams.Height = Draw::Atoi (theArgVec[anArgIter]);
@@ -1261,28 +1306,28 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: integer value is expected right after 'tileSize'\n";
+        Message::SendFail() << "Error: integer value is expected right after 'tileSize'";
         return 1;
       }
       aParams.TileSize = Draw::Atoi (theArgVec[anArgIter]);
     }
     else
     {
-      std::cout << "Error: unknown argument '" << theArgVec[anArgIter] << "'\n";
+      Message::SendFail() << "Error: unknown argument '" << theArgVec[anArgIter] << "'";
       return 1;
     }
   }
   if ((aParams.Width <= 0 && aParams.Height >  0)
    || (aParams.Width >  0 && aParams.Height <= 0))
   {
-    std::cout << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect\n";
+    Message::SendFail() << "Error: dimensions " << aParams.Width << "x" << aParams.Height << " are incorrect";
     return 1;
   }
 
   Handle(V3d_View) aView = ViewerTest::CurrentView();
   if (aView.IsNull())
   {
-    std::cout << "Error: cannot find an active view!\n";
+    Message::SendFail() << "Error: cannot find an active view!";
     return 1;
   }
 
@@ -1299,6 +1344,7 @@ static Standard_Integer VDump (Draw_Interpretor& theDI,
     case Graphic3d_BT_RGBA:                aFormat = Image_Format_RGBA;  break;
     case Graphic3d_BT_Depth:               aFormat = Image_Format_GrayF; break;
     case Graphic3d_BT_RGB_RayTraceHdrLeft: aFormat = Image_Format_RGBF;  break;
+    case Graphic3d_BT_Red:                 aFormat = Image_Format_Gray;  break;
   }
 
   switch (aStereoPair)
@@ -1428,7 +1474,7 @@ static int VDispMode (Draw_Interpretor& , Standard_Integer argc, const char** ar
   if (argc < 1
    || argc > 3)
   {
-    std::cout << "Syntax error: wrong number of arguments\n";
+    Message::SendFail() << "Syntax error: wrong number of arguments";
     return 1;
   }
 
@@ -1661,7 +1707,7 @@ private:
         {
           if (!GetMapOfAIS().IsBound2 (mySeqIter.Value()))
           {
-            std::cout << "Error: object " << mySeqIter.Value() << " is not displayed!\n";
+            Message::SendFail() << "Error: object " << mySeqIter.Value() << " is not displayed!";
             return;
           }
           myCurrentName = mySeqIter.Value();
@@ -1769,7 +1815,7 @@ struct ViewerTest_AspectsChangeSet
   Standard_Real                LineWidth;
 
   Standard_Integer             ToSetTypeOfLine;
-  Aspect_TypeOfLine            TypeOfLine;
+  uint16_t                     StippleLinePattern;
 
   Standard_Integer             ToSetTypeOfMarker;
   Aspect_TypeOfMarker          TypeOfMarker;
@@ -1855,7 +1901,7 @@ struct ViewerTest_AspectsChangeSet
     ToSetLineWidth    (0),
     LineWidth         (1.0),
     ToSetTypeOfLine   (0),
-    TypeOfLine        (Aspect_TOL_SOLID),
+    StippleLinePattern(0xFFFF),
     ToSetTypeOfMarker (0),
     TypeOfMarker      (Aspect_TOM_PLUS),
     ToSetMarkerSize   (0),
@@ -1943,58 +1989,52 @@ struct ViewerTest_AspectsChangeSet
     Standard_Boolean isOk = Standard_True;
     if (Visibility != 0 && Visibility != 1)
     {
-      std::cout << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")\n";
+      Message::SendFail() << "Error: the visibility should be equal to 0 or 1 (0 - invisible; 1 - visible) (specified " << Visibility << ")";
       isOk = Standard_False;
     }
     if (LineWidth <= 0.0
      || LineWidth >  10.0)
     {
-      std::cout << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")\n";
+      Message::SendFail() << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")";
       isOk = Standard_False;
     }
     if (Transparency < 0.0
      || Transparency > 1.0)
     {
-      std::cout << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")\n";
+      Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")";
       isOk = Standard_False;
     }
     if (ToSetAlphaMode == 1
      && (AlphaCutoff <= 0.0f || AlphaCutoff >= 1.0f))
     {
-      std::cout << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")\n";
-      isOk = Standard_False;
-    }
-    if (ToSetMaterial == 1
-     && Material == Graphic3d_NOM_DEFAULT)
-    {
-      std::cout << "Error: unknown material " << MatName << ".\n";
+      Message::SendFail() << "Error: alpha cutoff value should be within (0; 1) range (specified " << AlphaCutoff << ")";
       isOk = Standard_False;
     }
     if (FreeBoundaryWidth <= 0.0
      || FreeBoundaryWidth >  10.0)
     {
-      std::cout << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")\n";
+      Message::SendFail() << "Error: the free boundary width should be within [1; 10] range (specified " << FreeBoundaryWidth << ")";
       isOk = Standard_False;
     }
     if (MaxParamValue < 0.0)
     {
-      std::cout << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")\n";
+      Message::SendFail() << "Error: the max parameter value should be greater than zero (specified " << MaxParamValue << ")";
       isOk = Standard_False;
     }
     if (Sensitivity <= 0 && ToSetSensitivity)
     {
-      std::cout << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")\n";
+      Message::SendFail() << "Error: sensitivity parameter value should be positive (specified " << Sensitivity << ")";
       isOk = Standard_False;
     }
     if (ToSetHatch == 1 && StdHatchStyle < 0 && PathToHatchPattern == "")
     {
-      std::cout << "Error: hatch style must be specified\n";
+      Message::SendFail ("Error: hatch style must be specified");
       isOk = Standard_False;
     }
     if (ToSetShadingModel == 1
-    && (ShadingModel < Graphic3d_TOSM_DEFAULT || ShadingModel > Graphic3d_TOSM_FRAGMENT))
+    && (ShadingModel < Graphic3d_TOSM_DEFAULT || ShadingModel > Graphic3d_TOSM_PBR_FACET))
     {
-      std::cout << "Error: unknown shading model " << ShadingModelName << ".\n";
+      Message::SendFail() << "Error: unknown shading model " << ShadingModelName << ".";
       isOk = Standard_False;
     }
     return isOk;
@@ -2043,11 +2083,11 @@ struct ViewerTest_AspectsChangeSet
        || theDrawer->HasOwnSeenLineAspect())
       {
         toRecompute = theDrawer->SetOwnLineAspects() || toRecompute;
-        theDrawer->LineAspect()->SetTypeOfLine           (TypeOfLine);
-        theDrawer->WireAspect()->SetTypeOfLine           (TypeOfLine);
-        theDrawer->FreeBoundaryAspect()->SetTypeOfLine   (TypeOfLine);
-        theDrawer->UnFreeBoundaryAspect()->SetTypeOfLine (TypeOfLine);
-        theDrawer->SeenLineAspect()->SetTypeOfLine       (TypeOfLine);
+        theDrawer->LineAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+        theDrawer->WireAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+        theDrawer->FreeBoundaryAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+        theDrawer->UnFreeBoundaryAspect()->Aspect()->SetLinePattern (StippleLinePattern);
+        theDrawer->SeenLineAspect()->Aspect()->SetLinePattern (StippleLinePattern);
       }
     }
     if (ToSetTypeOfMarker != 0)
@@ -2189,7 +2229,7 @@ struct ViewerTest_AspectsChangeSet
             }
             else
             {
-              std::cout << "Error: cannot load the following image: " << PathToHatchPattern << "\n";
+              Message::SendFail() << "Error: cannot load the following image: " << PathToHatchPattern;
             }
           }
           else if (StdHatchStyle != -1)
@@ -2288,7 +2328,7 @@ struct ViewerTest_AspectsChangeSet
 //function : VAspects
 //purpose  :
 //==============================================================================
-static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
+static Standard_Integer VAspects (Draw_Interpretor& theDI,
                                   Standard_Integer  theArgNb,
                                   const char**      theArgVec)
 {
@@ -2297,7 +2337,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -2329,7 +2369,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
 
   if (!aNames.IsEmpty() && isDefaults)
   {
-    std::cout << "Error: wrong syntax. If -defaults is used there should not be any objects' names!\n";
+    Message::SendFail ("Error: wrong syntax. If -defaults is used there should not be any objects' names!");
     return 1;
   }
 
@@ -2339,12 +2379,15 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
 
   // parse syntax of legacy commands
   bool toParseAliasArgs = false;
+  Standard_Boolean toDump = 0;
+  Standard_Boolean toCompactDump = 0;
+  Standard_Integer aDumpDepth = -1;
   if (aCmdName == "vsetwidth")
   {
     if (aNames.IsEmpty()
     || !aNames.Last().IsRealValue())
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
     aChangeSet->ToSetLineWidth = 1;
@@ -2359,7 +2402,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
   {
     if (aNames.IsEmpty())
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
     aChangeSet->ToSetColor = 1;
@@ -2372,6 +2415,11 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       aNames.Remove (aNames.Length());
       isOk = Standard_True;
     }
+    else if (Quantity_Color::ColorFromHex (aNames.Last().ToCString(), aChangeSet->Color))
+    {
+      aNames.Remove (aNames.Length());
+      isOk = Standard_True;
+    }
     else if (aNames.Length() >= 3)
     {
       const char* anArgVec[3] =
@@ -2389,7 +2437,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     }
     if (!isOk)
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
   }
@@ -2402,7 +2450,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     if (aNames.IsEmpty()
     || !aNames.Last().IsRealValue())
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
     aChangeSet->ToSetTransparency = 1;
@@ -2417,13 +2465,17 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
   {
     if (aNames.IsEmpty())
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
     aChangeSet->ToSetMaterial = 1;
-    aChangeSet->MatName  = aNames.Last();
-    aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+    aChangeSet->MatName = aNames.Last();
     aNames.Remove (aNames.Length());
+    if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
+    {
+      Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
+      return 1;
+    }
   }
   else if (aCmdName == "vunsetmaterial")
   {
@@ -2434,13 +2486,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     if (aNames.IsEmpty()
     || !aNames.Last().IsRealValue())
     {
-      std::cout << "Error: not enough arguments!\n";
+      Message::SendFail ("Error: not enough arguments!");
       return 1;
     }
     aChangeSet->ToSetInterior = 1;
     if (!parseInteriorStyle (aNames.Last(), aChangeSet->InteriorStyle))
     {
-      std::cout << "Error: wrong syntax at " << aNames.Last() << "\n";
+      Message::SendFail() << "Error: wrong syntax at " << aNames.Last();
       return 1;
     }
     aNames.Remove (aNames.Length());
@@ -2488,7 +2540,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
         aChangeSet->FaceBoundaryColor = Quantity_Color (aNames.Value (3).IntegerValue() / 255.0,
                                                         aNames.Value (4).IntegerValue() / 255.0,
                                                         aNames.Value (5).IntegerValue() / 255.0,
-                                                        Quantity_TOC_RGB);
+                                                        Quantity_TOC_sRGB);
         aNames.Remove (5);
         aNames.Remove (4);
         aNames.Remove (3);
@@ -2503,7 +2555,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
   }
   else if (anArgIter >= theArgNb)
   {
-    std::cout << "Error: not enough arguments!\n";
+    Message::SendFail ("Error: not enough arguments!");
     return 1;
   }
 
@@ -2531,7 +2583,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
 
@@ -2582,7 +2634,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetTransparency = 1;
@@ -2599,7 +2651,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetAlphaMode = 1;
@@ -2626,7 +2678,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
         }
         else
         {
-          std::cout << "Error: wrong syntax at " << aParam << "\n";
+          Message::SendFail() << "Error: wrong syntax at " << aParam;
           return 1;
         }
       }
@@ -2648,7 +2700,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
 
@@ -2660,7 +2712,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetTransparency = 1;
@@ -2668,7 +2720,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       if (aChangeSet->Transparency < 0.0
        || aChangeSet->Transparency > 1.0)
       {
-        std::cout << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")\n";
+        Message::SendFail() << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")";
         return 1;
       }
       aChangeSet->Transparency = 1.0 - aChangeSet->Transparency;
@@ -2704,7 +2756,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
                                                            aColor);
       if (aNbParsed == 0)
       {
-        std::cout << "Syntax error at '" << anArg << "'\n";
+        Message::SendFail() << "Syntax error at '" << anArg << "'";
         return 1;
       }
       anArgIter += aNbParsed;
@@ -2753,22 +2805,24 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       Aspect_TypeOfLine aLineType = Aspect_TOL_EMPTY;
-      if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aLineType))
+      uint16_t aLinePattern = 0xFFFF;
+      if (!ViewerTest::ParseLineType (theArgVec[anArgIter], aLineType, aLinePattern))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
+
       if (anArg == "-setedgetype"
        || anArg == "-setedgestype"
        || anArg == "-edgetype"
        || anArg == "-edgestype"
        || aCmdName == "vsetedgetype")
       {
-        aChangeSet->TypeOfEdge = aLineType;
+        aChangeSet->TypeOfEdge = Graphic3d_Aspects::DefaultLineTypeForPattern (aLinePattern);
         aChangeSet->ToSetTypeOfEdge = 1;
       }
       else if (anArg == "-setfaceboundarystyle"
@@ -2780,12 +2834,12 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
             || anArg == "-boundarytype"
             || aCmdName == "vshowfaceboundary")
       {
-        aChangeSet->TypeOfFaceBoundaryLine = aLineType;
+        aChangeSet->TypeOfFaceBoundaryLine = Graphic3d_Aspects::DefaultLineTypeForPattern (aLinePattern);
         aChangeSet->ToSetTypeOfFaceBoundaryLine = 1;
       }
       else
       {
-        aChangeSet->TypeOfLine = aLineType;
+        aChangeSet->StippleLinePattern = aLinePattern;
         aChangeSet->ToSetTypeOfLine = 1;
       }
     }
@@ -2810,12 +2864,12 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       if (!ViewerTest::ParseMarkerType (theArgVec[anArgIter], aChangeSet->TypeOfMarker, aChangeSet->MarkerImage))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
 
@@ -2833,7 +2887,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetMarkerSize = 1;
@@ -2857,12 +2911,16 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetMaterial = 1;
-      aChangeSet->MatName  = theArgVec[anArgIter];
-      aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+      aChangeSet->MatName = theArgVec[anArgIter];
+      if (!Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString(), aChangeSet->Material))
+      {
+        Message::SendFail() << "Syntax error: unknown material '" << aChangeSet->MatName << "'.";
+        return 1;
+      }
     }
     else if (anArg == "-unsetmat"
           || anArg == "-unsetmaterial")
@@ -2875,13 +2933,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (isDefaults)
       {
-        std::cout << "Error: wrong syntax. -subshapes can not be used together with -defaults call!\n";
+        Message::SendFail() << "Error: wrong syntax. -subshapes can not be used together with -defaults call!";
         return 1;
       }
 
       if (aNames.IsEmpty())
       {
-        std::cout << "Error: main objects should specified explicitly when -subshapes is used!\n";
+        Message::SendFail() << "Error: main objects should specified explicitly when -subshapes is used!";
         return 1;
       }
 
@@ -2900,7 +2958,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
         TopoDS_Shape aSubShape = DBRep::Get (aSubShapeName);
         if (aSubShape.IsNull())
         {
-          std::cerr << "Error: shape " << aSubShapeName << " doesn't found!\n";
+          Message::SendFail() << "Error: shape " << aSubShapeName << " doesn't found!";
           return 1;
         }
         aChangeSet->SubShapes.Append (aSubShape);
@@ -2908,7 +2966,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
 
       if (aChangeSet->SubShapes.IsEmpty())
       {
-        std::cerr << "Error: empty list is specified after -subshapes!\n";
+        Message::SendFail() << "Error: empty list is specified after -subshapes!";
         return 1;
       }
     }
@@ -2920,7 +2978,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       bool toEnable = true;
       if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       ++anArgIter;
@@ -2933,7 +2991,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetFreeBoundaryWidth = 1;
@@ -2955,7 +3013,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
                                                            aChangeSet->FreeBoundaryColor);
       if (aNbParsed == 0)
       {
-        std::cout << "Syntax error at '" << anArg << "'\n";
+        Message::SendFail() << "Syntax error at '" << anArg << "'";
         return 1;
       }
       anArgIter += aNbParsed;
@@ -2975,7 +3033,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       bool toEnable = true;
       if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       ++anArgIter;
@@ -3000,7 +3058,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       bool toEnable = true;
       if (!ViewerTest::ParseOnOff (anArgIter + 1 < theArgNb ? theArgVec[anArgIter + 1] : "", toEnable))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       ++anArgIter;
@@ -3045,7 +3103,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       }
       else
       {
-        std::cout << "Syntax error at '" << anArg << "'\n";
+        Message::SendFail() << "Syntax error at '" << anArg << "'";
         return 1;
       }
 
@@ -3058,7 +3116,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetMaxParamValue = 1;
@@ -3069,19 +3127,19 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (isDefaults)
       {
-        std::cout << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!\n";
+        Message::SendFail() << "Error: wrong syntax. -setSensitivity can not be used together with -defaults call!";
         return 1;
       }
 
       if (aNames.IsEmpty())
       {
-        std::cout << "Error: object and selection mode should specified explicitly when -setSensitivity is used!\n";
+        Message::SendFail() << "Error: object and selection mode should specified explicitly when -setSensitivity is used!";
         return 1;
       }
 
       if (anArgIter + 2 >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetSensitivity = 1;
@@ -3093,13 +3151,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (isDefaults)
       {
-        std::cout << "Error: wrong syntax. -setHatch can not be used together with -defaults call!\n";
+        Message::SendFail() << "Error: wrong syntax. -setHatch can not be used together with -defaults call!";
         return 1;
       }
 
       if (aNames.IsEmpty())
       {
-        std::cout << "Error: object should be specified explicitly when -setHatch is used!\n";
+        Message::SendFail() << "Error: object should be specified explicitly when -setHatch is used!";
         return 1;
       }
 
@@ -3111,7 +3169,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
         if (anIntStyle < 0
          || anIntStyle >= Aspect_HS_NB)
         {
-          std::cout << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!\n";
+          Message::SendFail() << "Error: hatch style is out of range [0, " << (Aspect_HS_NB - 1) << "]!";
           return 1;
         }
         aChangeSet->StdHatchStyle = anIntStyle;
@@ -3128,14 +3186,14 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetShadingModel = 1;
       aChangeSet->ShadingModelName  = theArgVec[anArgIter];
       if (!ViewerTest::ParseShadingModel (theArgVec[anArgIter], aChangeSet->ShadingModel))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
     }
@@ -3151,13 +3209,13 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aChangeSet->ToSetInterior = 1;
       if (!parseInteriorStyle (theArgVec[anArgIter], aChangeSet->InteriorStyle))
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
     }
@@ -3219,7 +3277,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
                                                            aChangeSet->EdgeColor);
       if (aNbParsed == 0)
       {
-        std::cout << "Syntax error at '" << anArg << "'\n";
+        Message::SendFail() << "Syntax error at '" << anArg << "'";
         return 1;
       }
       anArgIter += aNbParsed;
@@ -3232,7 +3290,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       aChangeSet->ToSetLineWidth = -1;
       aChangeSet->LineWidth = 1.0;
       aChangeSet->ToSetTypeOfLine = -1;
-      aChangeSet->TypeOfLine = Aspect_TOL_SOLID;
+      aChangeSet->StippleLinePattern = 0xFFFF;
       aChangeSet->ToSetTypeOfMarker = -1;
       aChangeSet->TypeOfMarker = Aspect_TOM_PLUS;
       aChangeSet->ToSetMarkerSize = -1;
@@ -3282,9 +3340,28 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       aChangeSet->ToSetTypeOfEdge = -1;
       aChangeSet->TypeOfEdge = Aspect_TOL_SOLID;
     }
+    else if (anArg == "-dumpjson")
+    {
+      toDump = Standard_True;
+    }
+    else if (anArg == "-dumpcompact")
+    {
+      toCompactDump = Standard_False;
+      if (++anArgIter >= theArgNb && ViewerTest::ParseOnOff (theArgVec[anArgIter + 1], toCompactDump))
+        ++anArgIter;
+    }
+    else if (anArg == "-dumpdepth")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
+        return 1;
+      }
+      aDumpDepth = Draw::Atoi (theArgVec[anArgIter]);
+    }
     else
     {
-      std::cout << "Error: wrong syntax at " << anArg << "\n";
+      Message::SendFail() << "Error: wrong syntax at " << anArg;
       return 1;
     }
   }
@@ -3342,6 +3419,16 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
         aCtx->Redisplay (aPrs, Standard_False);
       }
     }
+    if (toDump)
+    {
+      Standard_SStream aStream;
+      aDrawer->DumpJson (aStream, aDumpDepth);
+
+      if (toCompactDump)
+        theDI << Standard_Dump::Text (aStream);
+      else
+        theDI << Standard_Dump::FormatJson (aStream);
+    }
     return 0;
   }
 
@@ -3363,7 +3450,7 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast (aPrs);
       if (aShapePrs.IsNull())
       {
-        std::cout << "Error: an object " << aName << " is not an AIS_Shape presentation!\n";
+        Message::SendFail() << "Error: an object " << aName << " is not an AIS_Shape presentation!";
         return 1;
       }
       aColoredPrs = Handle(AIS_ColoredShape)::DownCast (aShapePrs);
@@ -3495,6 +3582,16 @@ static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
       {
         aPrs->SynchronizeAspects();
       }
+
+      if (toDump)
+      {
+        Standard_SStream aStream;
+        aDrawer->DumpJson (aStream);
+
+        theDI << aName << ": \n";
+        theDI << Standard_Dump::FormatJson (aStream);
+        theDI << "\n";
+      }
     }
   }
   return 0;
@@ -3514,7 +3611,7 @@ static int VDonly2 (Draw_Interpretor& ,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -3589,7 +3686,7 @@ int VRemove (Draw_Interpretor& theDI,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -3632,7 +3729,7 @@ int VRemove (Draw_Interpretor& theDI,
   if (toRemoveAll
    && anArgIter < theArgNb)
   {
-    std::cerr << "Error: wrong syntax!\n";
+    Message::SendFail ("Error: wrong syntax!");
     return 1;
   }
 
@@ -3674,7 +3771,7 @@ int VRemove (Draw_Interpretor& theDI,
       {
         if (toFailOnError)
         {
-          std::cout << "Syntax error: '" << aName << "' was not bound to some object.\n";
+          Message::SendFail() << "Syntax error: '" << aName << "' was not bound to some object.";
           return 1;
         }
       }
@@ -3682,8 +3779,8 @@ int VRemove (Draw_Interpretor& theDI,
       {
         if (toFailOnError)
         {
-          std::cout << "Syntax error: '" << aName << "' was not displayed in current context.\n"
-                    << "Please activate view with this object displayed and try again.\n";
+          Message::SendFail() << "Syntax error: '" << aName << "' was not displayed in current context.\n"
+                              << "Please activate view with this object displayed and try again.";
           return 1;
         }
       }
@@ -3740,7 +3837,7 @@ int VErase (Draw_Interpretor& theDI,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, aView);
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -3776,7 +3873,7 @@ int VErase (Draw_Interpretor& theDI,
 
   if (!aNamesOfEraseIO.IsEmpty() && toEraseAll)
   {
-    std::cerr << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.\n";
+    Message::SendFail() << "Error: wrong syntax, " << theArgVec[0] << " too much arguments.";
     return 1;
   }
 
@@ -3807,7 +3904,7 @@ int VErase (Draw_Interpretor& theDI,
         {
           if (toFailOnError)
           {
-            std::cout << "Syntax error: '" << aName << "' is not found\n";
+            Message::SendFail() << "Syntax error: '" << aName << "' is not found";
             return 1;
           }
         }
@@ -3891,7 +3988,7 @@ static int VDisplayAll (Draw_Interpretor& ,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -3911,7 +4008,7 @@ static int VDisplayAll (Draw_Interpretor& ,
   }
   if (anArgIter < theArgNb)
   {
-    std::cout << theArgVec[0] << "Error: wrong syntax\n";
+    Message::SendFail() << theArgVec[0] << "Error: wrong syntax";
     return 1;
   }
 
@@ -4018,7 +4115,7 @@ int VBounding (Draw_Interpretor& theDI,
   ViewerTest_AutoUpdater anUpdateTool (aCtx, ViewerTest::CurrentView());
   if (aCtx.IsNull())
   {
-    std::cout << "Error: no active view!\n";
+    Message::SendFail ("Error: no active view!");
     return 1;
   }
 
@@ -4048,7 +4145,7 @@ int VBounding (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        Message::SendFail() << "Error: wrong syntax at " << anArg;
         return 1;
       }
       aMode = Draw::Atoi (theArgVec[anArgIter]);
@@ -4076,14 +4173,14 @@ int VBounding (Draw_Interpretor& theDI,
       Handle(AIS_InteractiveObject) anIO;
       if (!GetMapOfAIS().Find2 (aName, anIO))
       {
-        std::cout << "Error: presentation " << aName << " does not exist\n";
+        Message::SendFail() << "Error: presentation " << aName << " does not exist";
         return 1;
       }
 
       aHighlightedMode = checkMode (aCtx, anIO, aMode);
       if (aHighlightedMode == -1)
       {
-        std::cout << "Error: object " << aName << " has no presentation with mode " << aMode << std::endl;
+        Message::SendFail() << "Error: object " << aName << " has no presentation with mode " << aMode;
         return 1;
       }
       bndPresentation (theDI, aCtx->MainPrsMgr(), anIO, aHighlightedMode, aName, anAction, aStyle);
@@ -4129,7 +4226,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
   const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
   if (aCtx.IsNull())
   {
-    std::cout << "Error: no active view!\n";
+    Message::SendFail() << "Error: no active view!";
     return 1;
   }
 
@@ -4178,7 +4275,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
       }
       if (aTexturedIO.IsNull())
       {
-        std::cout << "Syntax error: shape " << aName << " does not exists in the viewer.\n";
+        Message::SendFail() << "Syntax error: shape " << aName << " does not exists in the viewer.";
         return 1;
       }
 
@@ -4219,7 +4316,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
           }
         }
       }
-      std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+      Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
       return 1;
     }
     else if (!aTexturedShape.IsNull()
@@ -4254,7 +4351,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
           }
         }
       }
-      std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+      Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
       return 1;
     }
     else if (!aTexturedShape.IsNull()
@@ -4289,7 +4386,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
           }
         }
       }
-      std::cout << "Syntax error: unexpected argument '" << aName << "'\n";
+      Message::SendFail() << "Syntax error: unexpected argument '" << aName << "'";
       return 1;
     }
     else if (aNameCase == "-modulate")
@@ -4324,7 +4421,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
       }
       else
       {
-        std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+        Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
         return 1;
       }
     }
@@ -4357,7 +4454,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
       }
       else
       {
-        std::cout << "Syntax error: unexpected argument '" << aValue << "'\n";
+        Message::SendFail() << "Syntax error: unexpected argument '" << aValue << "'";
         return 1;
       }
     }
@@ -4439,14 +4536,14 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
         if (anArgIter + 1 >= theArgsNb
          || aNameCase.Length() < 5)
         {
-          std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+          Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
           return 1;
         }
 
         TCollection_AsciiString aTexIndexStr = aNameCase.SubString (5, aNameCase.Length());
         if (!aTexIndexStr.IsIntegerValue())
         {
-          std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+          Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
           return 1;
         }
 
@@ -4457,7 +4554,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
       if (aTexIndex >= Graphic3d_TextureUnit_NB
        || aTexIndex >= aCtx->CurrentViewer()->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxCombinedTextureUnits))
       {
-        std::cout << "Error: too many textures specified\n";
+        Message::SendFail ("Error: too many textures specified");
         return 1;
       }
 
@@ -4467,7 +4564,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
         const Standard_Integer aValue = aTexName.IntegerValue();
         if (aValue < 0 || aValue >= Graphic3d_Texture2D::NumberOfTextures())
         {
-          std::cout << "Syntax error: texture with ID " << aValue << " is undefined!\n";
+          Message::SendFail() << "Syntax error: texture with ID " << aValue << " is undefined!";
           return 1;
         }
         aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (Graphic3d_NameOfTexture2D (aValue)));
@@ -4491,7 +4588,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
       {
         if (!OSD_File (aTexName).Exists())
         {
-          std::cout << "Syntax error: non-existing image file has been specified '" << aTexName << "'.\n";
+          Message::SendFail() << "Syntax error: non-existing image file has been specified '" << aTexName << "'.";
           return 1;
         }
         aTextureVecNew.SetValue (aTexIndex, new Graphic3d_Texture2Dmanual (aTexName));
@@ -4508,7 +4605,7 @@ Standard_Integer VTexture (Draw_Interpretor& theDi, Standard_Integer theArgsNb,
     }
     else
     {
-      std::cout << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'\n";
+      Message::SendFail() << "Syntax error: invalid argument '" << theArgVec[anArgIter] << "'";
       return 1;
     }
   }
@@ -4802,7 +4899,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
 {
   if (theArgNb < 2)
   {
-    std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+    Message::SendFail ("Syntax error: wrong number of arguments.");
     return 1;
   }
   if (theArgNb == 2
@@ -4884,7 +4981,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
 
@@ -4896,7 +4993,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       if (++anArgIter >= theArgNb)
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
 
@@ -4942,7 +5039,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       if (++anArgIter >= theArgNb
        || !aTrsfPers.IsNull())
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
 
@@ -4952,7 +5049,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       aPersFlags.LowerCase();
       if (!parseTrsfPersFlag (aPersFlags, aTrsfPersFlags))
       {
-        std::cerr << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".\n";
+        Message::SendFail() << "Error: wrong transform persistence flags " << theArgVec [anArgIter] << ".";
         return 1;
       }
 
@@ -4971,7 +5068,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       if (anArgIter + 2 >= theArgNb
        || aTrsfPers.IsNull())
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
 
@@ -4981,7 +5078,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       if (!aX.IsRealValue()
        || !aY.IsRealValue())
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
       if (anArgIter + 1 < theArgNb)
@@ -5012,7 +5109,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       || !ViewerTest::ParseZLayer (theArgVec[anArgIter], aZLayer)
       ||  aZLayer == Graphic3d_ZLayerId_UNKNOWN)
       {
-        std::cerr << "Error: wrong syntax at " << aName << ".\n";
+        Message::SendFail() << "Error: wrong syntax at " << aName << ".";
         return 1;
       }
     }
@@ -5038,7 +5135,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
 
   if (aNamesOfDisplayIO.IsEmpty())
   {
-    std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+    Message::SendFail ("Syntax error: wrong number of arguments.");
     return 1;
   }
 
@@ -5074,7 +5171,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
           }
           if (!aShape->AcceptDisplayMode (anObjDispMode))
           {
-            std::cout << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjDispMode << " display mode\n";
+            Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjDispMode << " display mode";
             return 1;
           }
           else
@@ -5087,7 +5184,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
           if (anObjHighMode != -1
           && !aShape->AcceptDisplayMode (anObjHighMode))
           {
-            std::cout << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjHighMode << " display mode\n";
+            Message::SendFail() << "Syntax error: " << aShape->DynamicType()->Name() << " rejects " << anObjHighMode << " display mode";
             return 1;
           }
           aShape->SetHilightMode (anObjHighMode);
@@ -5117,7 +5214,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
       }
       else
       {
-        std::cerr << "Error: object with name '" << aName << "' does not exist!\n";
+        Message::SendFail() << "Error: object with name '" << aName << "' does not exist!";
       }
       continue;
     }
@@ -5209,7 +5306,7 @@ static Standard_Integer VNbDisplayed (Draw_Interpretor& theDi,
   Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
   if (aContextAIS.IsNull())
   {
-    std::cout << theArgVec[0] << "AIS context is not available.\n";
+    Message::SendFail ("Syntax error: AIS context is not available.");
     return 1;
   }
 
@@ -5236,13 +5333,13 @@ static int VUpdate (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb, con
   Handle(AIS_InteractiveContext) aContextAIS = ViewerTest::GetAISContext();
   if (aContextAIS.IsNull())
   {
-    std::cout << theArgVec[0] << "AIS context is not available.\n";
+    Message::SendFail ("Syntax error: AIS context is not available.");
     return 1;
   }
 
   if (theArgsNb < 2)
   {
-    std::cout << theArgVec[0] << ": insufficient arguments. Type help for more information.\n";
+    Message::SendFail ("Syntax error: insufficient arguments. Type help for more information.");
     return 1;
   }
 
@@ -5255,7 +5352,7 @@ static int VUpdate (Draw_Interpretor& /*theDi*/, Standard_Integer theArgsNb, con
     GetMapOfAIS().Find2 (aName, anAISObj);
     if (anAISObj.IsNull())
     {
-      std::cout << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".\n";
+      Message::SendFail() << theArgVec[0] << ": no AIS interactive object named \"" << aName << "\".";
       return 1;
     }
 
@@ -5345,17 +5442,17 @@ static void objInfo (const NCollection_Map<Handle(AIS_InteractiveObject)>& theDe
   }
   else if (theObj->Type() == AIS_KOI_Relation)
   {
-    // AIS_Dimention and AIS_Relation
-    Handle(AIS_Relation) aRelation = Handle(AIS_Relation)::DownCast (theObj);
+    // PrsDim_Dimention and AIS_Relation
+    Handle(PrsDim_Relation) aRelation = Handle(PrsDim_Relation)::DownCast (theObj);
     switch (aRelation->KindOfDimension())
     {
-      case AIS_KOD_PLANEANGLE:     theDI << " AIS_AngleDimension"; break;
-      case AIS_KOD_LENGTH:         theDI << " AIS_Chamf2/3dDimension/AIS_LengthDimension"; break;
-      case AIS_KOD_DIAMETER:       theDI << " AIS_DiameterDimension"; break;
-      case AIS_KOD_ELLIPSERADIUS:  theDI << " AIS_EllipseRadiusDimension"; break;
-      //case AIS_KOD_FILLETRADIUS:   theDI << " AIS_FilletRadiusDimension "; break;
-      case AIS_KOD_OFFSET:         theDI << " AIS_OffsetDimension"; break;
-      case AIS_KOD_RADIUS:         theDI << " AIS_RadiusDimension"; break;
+      case PrsDim_KOD_PLANEANGLE:     theDI << " PrsDim_AngleDimension"; break;
+      case PrsDim_KOD_LENGTH:         theDI << " PrsDim_Chamf2/3dDimension/PrsDim_LengthDimension"; break;
+      case PrsDim_KOD_DIAMETER:       theDI << " PrsDim_DiameterDimension"; break;
+      case PrsDim_KOD_ELLIPSERADIUS:  theDI << " PrsDim_EllipseRadiusDimension"; break;
+      //case PrsDim_KOD_FILLETRADIUS:   theDI << " PrsDim_FilletRadiusDimension "; break;
+      case PrsDim_KOD_OFFSET:         theDI << " PrsDim_OffsetDimension"; break;
+      case PrsDim_KOD_RADIUS:         theDI << " PrsDim_RadiusDimension"; break;
       default:                     theDI << " UNKNOWN dimension"; break;
     }
   }
@@ -5446,7 +5543,7 @@ static Standard_Integer VState (Draw_Interpretor& theDI,
   Handle(AIS_InteractiveContext) aCtx = TheAISContext();
   if (aCtx.IsNull())
   {
-    std::cerr << "Error: No opened viewer!\n";
+    Message::SendFail ("Error: No opened viewer!");
     return 1;
   }
 
@@ -5630,7 +5727,7 @@ Standard_Boolean ViewerTest::PickShapes (const TopAbs_ShapeEnum theShapeType,
   const Standard_Integer aNbToReach = theResArray->Length();
   if (aNbToReach > 1)
   {
-    std::cout << " WARNING : Pick with Shift+ MB1 for Selection of more than 1 object\n";
+    Message::SendWarning ("WARNING : Pick with Shift+ MB1 for Selection of more than 1 object");
   }
 
   // step 1: prepare the data
@@ -5673,7 +5770,7 @@ Standard_Boolean ViewerTest::PickShapes (const TopAbs_ShapeEnum theShapeType,
     {
       ++aNbPickFail;
     }
-    std::cout << "NbPicked =  " << aNbPickGood << " |  Nb Pick Fail :" << aNbPickFail << "\n";
+    Message::SendInfo() << "NbPicked =  " << aNbPickGood << " |  Nb Pick Fail :" << aNbPickFail;
   }
 
   // step3 get result.
@@ -5735,7 +5832,7 @@ static int VPickShape( Draw_Interpretor& di, Standard_Integer argc, const char**
     else if (aShapeArg == "solid")  aShapeType = TopAbs_SOLID;
     else
     {
-      std::cout << "Syntax error at '" << argv[1] << "'\n";
+      Message::SendFail() << "Syntax error at '" << argv[1] << "'";
       return 1;
     }
   }
@@ -5812,7 +5909,7 @@ static int VSelFilter(Draw_Interpretor& , Standard_Integer theArgc,
   Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
   if (aContext.IsNull())
   {
-    std::cout << "Error: AIS context is not available.\n";
+    Message::SendFail ("Error: AIS context is not available.");
     return 1;
   }
 
@@ -5831,7 +5928,7 @@ static int VSelFilter(Draw_Interpretor& , Standard_Integer theArgc,
       TopAbs_ShapeEnum aShapeType = TopAbs_COMPOUND;
       if (!TopAbs::ShapeTypeFromString (aVal.ToCString(), aShapeType))
       {
-        std::cout << "Syntax error: wrong command attribute value '" << aVal << "'\n";
+        Message::SendFail() << "Syntax error: wrong command attribute value '" << aVal << "'";
         return 1;
       }
 
@@ -5848,7 +5945,7 @@ static int VSelFilter(Draw_Interpretor& , Standard_Integer theArgc,
     }
     else
     {
-      std::cout << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'\n";
+      Message::SendFail() << "Syntax error: unknown argument '" << theArgv[anArgIter] << "'";
       return 1;
     }
   }
@@ -6037,9 +6134,9 @@ static int VEraseType( Draw_Interpretor& , Standard_Integer argc, const char** a
     if(dimension_status == -1)
       TheAISContext()->Erase(curio,Standard_False);
     else {
-      AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension();
-      if ((dimension_status==0 && KOD == AIS_KOD_NONE)||
-         (dimension_status==1 && KOD != AIS_KOD_NONE))
+      PrsDim_KindOfDimension KOD = Handle(PrsDim_Relation)::DownCast (curio)->KindOfDimension();
+      if ((dimension_status==0 && KOD == PrsDim_KOD_NONE)||
+         (dimension_status==1 && KOD != PrsDim_KOD_NONE))
        TheAISContext()->Erase(curio,Standard_False);
     }
   }
@@ -6070,9 +6167,9 @@ static int VDisplayType(Draw_Interpretor& , Standard_Integer argc, const char**
     if(dimension_status == -1)
       TheAISContext()->Display(curio,Standard_False);
     else {
-      AIS_KindOfDimension KOD = Handle(AIS_Relation)::DownCast (curio)->KindOfDimension();
-      if ((dimension_status==0 && KOD == AIS_KOD_NONE)||
-         (dimension_status==1 && KOD != AIS_KOD_NONE))
+      PrsDim_KindOfDimension KOD = Handle(PrsDim_Relation)::DownCast (curio)->KindOfDimension();
+      if ((dimension_status==0 && KOD == PrsDim_KOD_NONE)||
+         (dimension_status==1 && KOD != PrsDim_KOD_NONE))
        TheAISContext()->Display(curio,Standard_False);
     }
 
@@ -6084,7 +6181,7 @@ static int VDisplayType(Draw_Interpretor& , Standard_Integer argc, const char**
 
 static Standard_Integer vr(Draw_Interpretor& , Standard_Integer , const char** a)
 {
-  ifstream s(a[1]);
+  std::ifstream s(a[1]);
   BRep_Builder builder;
   TopoDS_Shape shape;
   BRepTools::Read(shape, s, builder);
@@ -6108,7 +6205,7 @@ static int VBsdf (Draw_Interpretor& theDI,
   if (aView.IsNull()
    || aViewer.IsNull())
   {
-    std::cerr << "No active viewer!\n";
+    Message::SendFail ("Error: No active viewer!");
     return 1;
   }
 
@@ -6160,7 +6257,7 @@ static int VBsdf (Draw_Interpretor& theDI,
   Handle(AIS_InteractiveObject) anIObj;
   if (!GetMapOfAIS().Find2 (aName, anIObj))
   {
-    std::cerr << "Use 'vdisplay' before\n";
+    Message::SendFail ("Error: no active viewer");
     return 1;
   }
 
@@ -6394,7 +6491,7 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
 {
   if (theArgNb < 2)
   {
-    std::cerr << theArgVec[0] << "Error: wrong number of arguments.\n";
+    Message::SendFail ("Syntax error: wrong number of arguments.");
     return 1;
   }
 
@@ -6421,7 +6518,7 @@ static Standard_Integer VLoadSelection (Draw_Interpretor& /*theDi*/,
     }
     if (aShape.IsNull())
     {
-      std::cout << "Syntax error: presentation '" << aName << "' not found\n";
+      Message::SendFail() << "Syntax error: presentation '" << aName << "' not found";
       return 1;
     }
 
@@ -6597,7 +6694,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:          [-setMaterial MatName] [-unsetMaterial]"
       "\n\t\t:          [-setTransparency Transp] [-unsetTransparency]"
       "\n\t\t:          [-setWidth LineWidth] [-unsetWidth]"
-      "\n\t\t:          [-setLineType {solid|dash|dot|dotDash}] [-unsetLineType]"
+      "\n\t\t:          [-setLineType {solid|dash|dot|dotDash|0xHexPattern}] [-unsetLineType]"
       "\n\t\t:          [-setMarkerType {.|+|x|O|xcircle|pointcircle|ring1|ring2|ring3|ball|ImagePath}]"
       "\n\t\t:          [-unsetMarkerType]"
       "\n\t\t:          [-setMarkerSize Scale] [-unsetMarkerSize]"
@@ -6608,7 +6705,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:          [-isoontriangulation 0|1]"
       "\n\t\t:          [-setMaxParamValue {value}]"
       "\n\t\t:          [-setSensitivity {selection_mode} {value}]"
-      "\n\t\t:          [-setShadingModel {color|flat|gouraud|phong}]"
+      "\n\t\t:          [-setShadingModel {unlit|flat|gouraud|phong}]"
       "\n\t\t:          [-unsetShadingModel]"
       "\n\t\t:          [-setInterior {solid|hatch|hidenline|point}]"
       "\n\t\t:          [-unsetInterior] [-setHatch HatchStyle]"
@@ -6617,13 +6714,19 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:          [-setDrawEdges {0|1}] [-setEdgeType LineType] [-setEdgeColor R G B] [-setQuadEdges {0|1}]"
       "\n\t\t:          [-setDrawSilhouette {0|1}]"
       "\n\t\t:          [-setAlphaMode {opaque|mask|blend|blendauto} [alphaCutOff=0.5]]"
+      "\n\t\t:          [-dumpJson]"
+      "\n\t\t:          [-dumpCompact {0|1}]"
+      "\n\t\t:          [-dumpDepth depth]"
+      "\n\t\t:          [-freeBoundary {off/on | 0/1}]"
       "\n\t\t: Manage presentation properties of all, selected or named objects."
       "\n\t\t: When -subshapes is specified than following properties will be"
       "\n\t\t: assigned to specified sub-shapes."
       "\n\t\t: When -defaults is specified than presentation properties will be"
       "\n\t\t: assigned to all objects that have not their own specified properties"
       "\n\t\t: and to all objects to be displayed in the future."
-      "\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier.",
+      "\n\t\t: If -defaults is used there should not be any objects' names and -subshapes specifier."
+      "\n\t\t: See also vlistcolors and vlistmaterials to list named colors and materials"
+      "\n\t\t: accepted by arguments -setMaterial and -setColor",
                  __FILE__,VAspects,group);
 
   theCommands.Add("vsetcolor",
@@ -6826,17 +6929,11 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
 #include <DBRep.hxx>
 #include <TopoDS_Face.hxx>
 #include <gp_Pln.hxx>
-#include <AIS_KindOfSurface.hxx>
 #include <BRepOffsetAPI_DraftAngle.hxx>
 #include <Precision.hxx>
 #include <BRepAlgo.hxx>
 #include <OSD_Environment.hxx>
 #include <DrawTrSurf.hxx>
-//#include <DbgTools.hxx>
-//#include <FeatAlgo_MakeLinearForm.hxx>
-
-
-
 
 //=======================================================================
 //function : IsValid
@@ -6852,14 +6949,14 @@ static Standard_Boolean IsValid(const TopTools_ListOfShape& theArgs,
   Standard_Boolean ToCheck = Standard_True;
   if (!checkValid.IsEmpty()) {
 #ifdef OCCT_DEBUG
-    cout <<"DONT_SWITCH_IS_VALID positionnee a :"<<checkValid.ToCString()<<"\n";
+    std::cout <<"DONT_SWITCH_IS_VALID positionnee a :"<<checkValid.ToCString()<<"\n";
 #endif
     if ( checkValid=="true" || checkValid=="TRUE" ) {
       ToCheck= Standard_False;
     }
   } else {
 #ifdef OCCT_DEBUG
-    cout <<"DONT_SWITCH_IS_VALID non positionne\n";
+    std::cout <<"DONT_SWITCH_IS_VALID non positionne\n";
 #endif
   }
   Standard_Boolean IsValid = Standard_True;
@@ -6898,7 +6995,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
   anAngle = 2*M_PI * anAngle / 360.0;
   gp_Pln aPln;
   Handle( Geom_Surface )aSurf;
-  AIS_KindOfSurface aSurfType;
+  PrsDim_KindOfSurface aSurfType;
   Standard_Real Offset;
   gp_Dir aDir;
   if(argc > 4) { // == 5
@@ -6907,7 +7004,7 @@ static Standard_Integer TDraft(Draw_Interpretor& di, Standard_Integer argc, cons
   }
 
   TopoDS_Face face2 = TopoDS::Face(Plane);
-  if(!AIS::GetPlaneFromFace(face2, aPln, aSurf, aSurfType, Offset))
+  if(!PrsDim::GetPlaneFromFace(face2, aPln, aSurf, aSurfType, Offset))
     {
       di << "TEST : Can't find plane\n";
       return 1;