diff --git a/src/AIS/AIS.cdl b/src/AIS/AIS.cdl
index f772d4e8ab..75098fd7d4 100644
--- a/src/AIS/AIS.cdl
+++ b/src/AIS/AIS.cdl
@@ -325,6 +325,7 @@ is
 
     class Triangulation;
 
+    imported ColoredShape;
     imported TexturedShape;
 
     class Drawer;
diff --git a/src/AIS/AIS_ColoredShape.cxx b/src/AIS/AIS_ColoredShape.cxx
new file mode 100644
index 0000000000..d6784a74b6
--- /dev/null
+++ b/src/AIS/AIS_ColoredShape.cxx
@@ -0,0 +1,460 @@
+// Created on: 2014-04-24
+// Created by: Kirill Gavrilov
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <AIS_ColoredShape.hxx>
+
+#include <AIS_InteractiveContext.hxx>
+#include <BRep_Builder.hxx>
+#include <BRepTools.hxx>
+#include <gp_Pnt2d.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
+#include <Graphic3d_AspectLine3d.hxx>
+#include <Graphic3d_Group.hxx>
+#include <Graphic3d_StructureManager.hxx>
+#include <Graphic3d_Texture2Dmanual.hxx>
+#include <Precision.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_IsoAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_ShadingAspect.hxx>
+#include <Prs3d_Root.hxx>
+#include <PrsMgr_PresentationManager3d.hxx>
+#include <Standard_ErrorHandler.hxx>
+#include <StdPrs_ShadedShape.hxx>
+#include <StdPrs_ToolShadedShape.hxx>
+#include <StdPrs_WFDeflectionShape.hxx>
+#include <StdPrs_WFShape.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+
+IMPLEMENT_STANDARD_HANDLE (AIS_ColoredDrawer, AIS_Drawer)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredDrawer, AIS_Drawer)
+
+IMPLEMENT_STANDARD_HANDLE (AIS_ColoredShape, AIS_Shape)
+IMPLEMENT_STANDARD_RTTIEXT(AIS_ColoredShape, AIS_Shape)
+
+//=======================================================================
+//function : AIS_ColoredShape
+//purpose  :
+//=======================================================================
+AIS_ColoredShape::AIS_ColoredShape (const TopoDS_Shape& theShape)
+: AIS_Shape (theShape)
+{
+  // disable dedicated line aspects
+  myDrawer->SetFreeBoundaryAspect  (myDrawer->LineAspect());
+  myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
+  myDrawer->SetSeenLineAspect      (myDrawer->LineAspect());
+}
+
+//=======================================================================
+//function : AIS_ColoredShape
+//purpose  :
+//=======================================================================
+AIS_ColoredShape::AIS_ColoredShape (const Handle(AIS_Shape)& theShape)
+: AIS_Shape (theShape->Shape())
+{
+  // disable dedicated line aspects
+  myDrawer->SetFreeBoundaryAspect  (myDrawer->LineAspect());
+  myDrawer->SetUnFreeBoundaryAspect(myDrawer->LineAspect());
+  myDrawer->SetSeenLineAspect      (myDrawer->LineAspect());
+  if (theShape->HasMaterial())
+  {
+    SetMaterial (theShape->Material());
+  }
+  if (theShape->HasColor())
+  {
+    SetColor (theShape->Color());
+  }
+  if (theShape->HasWidth())
+  {
+    SetWidth (theShape->Width());
+  }
+  if (theShape->IsTransparent())
+  {
+    SetTransparency (theShape->Transparency());
+  }
+}
+
+//=======================================================================
+//function : CustomAspects
+//purpose  :
+//=======================================================================
+Handle(AIS_ColoredDrawer) AIS_ColoredShape::CustomAspects (const TopoDS_Shape& theShape)
+{
+  Handle(AIS_ColoredDrawer) aDrawer;
+  myShapeColors.Find (theShape, aDrawer);
+  if (aDrawer.IsNull())
+  {
+    aDrawer = new AIS_ColoredDrawer (myDrawer);
+    myShapeColors.Bind (theShape, aDrawer);
+    LoadRecomputable (AIS_WireFrame);
+    LoadRecomputable (AIS_Shaded);
+  }
+  return aDrawer;
+}
+
+//=======================================================================
+//function : ClearCustomAspects
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::ClearCustomAspects()
+{
+  if (myShapeColors.IsEmpty())
+  {
+    return;
+  }
+  myShapeColors.Clear();
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+}
+
+//=======================================================================
+//function : UnsetCustomAspects
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::UnsetCustomAspects (const TopoDS_Shape&    theShape,
+                                           const Standard_Boolean theToUnregister)
+{
+  if (!myShapeColors.IsBound (theShape))
+  {
+    return;
+  }
+
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+  if (theToUnregister)
+  {
+    myShapeColors.UnBind (theShape);
+    return;
+  }
+
+  myShapeColors.ChangeFind (theShape) = new AIS_ColoredDrawer (myDrawer);
+}
+
+//=======================================================================
+//function : SetCustomColor
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::SetCustomColor (const TopoDS_Shape&   theShape,
+                                       const Quantity_Color& theColor)
+{
+  if (theShape.IsNull())
+  {
+    return;
+  }
+
+  const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
+  setColor (aDrawer, theColor);
+  aDrawer->SetOwnColor (theColor);
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+}
+
+//=======================================================================
+//function : SetCustomWidth
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::SetCustomWidth (const TopoDS_Shape& theShape,
+                                       const Standard_Real theLineWidth)
+{
+  if (theShape.IsNull())
+  {
+    return;
+  }
+
+  const Handle(AIS_ColoredDrawer)& aDrawer = CustomAspects (theShape);
+  setWidth (CustomAspects (theShape), theLineWidth);
+  aDrawer->SetOwnWidth (theLineWidth);
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+}
+
+//=======================================================================
+//function : SetColor
+//purpose  :
+//=======================================================================
+
+void AIS_ColoredShape::SetColor (const Quantity_Color&  theColor)
+{
+  setColor (myDrawer, theColor);
+  myOwnColor  = theColor;
+  hasOwnColor = Standard_True;
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+  for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
+  {
+    const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
+    if (aDrawer->HasOwnColor())
+    {
+      continue;
+    }
+
+    if (aDrawer->HasShadingAspect())
+    {
+      aDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
+    }
+    if (aDrawer->HasLineAspect())
+    {
+      aDrawer->LineAspect()->SetColor (theColor);
+    }
+    if (aDrawer->HasWireAspect())
+    {
+      aDrawer->WireAspect()->SetColor (theColor);
+    }
+  }
+}
+
+//=======================================================================
+//function : SetWidth
+//purpose  :
+//=======================================================================
+
+void AIS_ColoredShape::SetWidth (const Standard_Real    theLineWidth)
+{
+  setWidth (myDrawer, theLineWidth);
+  myOwnWidth = theLineWidth;
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+  for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
+  {
+    const Handle(AIS_ColoredDrawer)& aDrawer = anIter.Value();
+    if (aDrawer->HasOwnWidth())
+    {
+      continue;
+    }
+
+    if (aDrawer->HasLineAspect())
+    {
+      aDrawer->LineAspect()->SetWidth (theLineWidth);
+    }
+    if (aDrawer->HasWireAspect())
+    {
+      aDrawer->WireAspect()->SetWidth (theLineWidth);
+    }
+  }
+}
+
+//=======================================================================
+//function : SetTransparency
+//purpose  :
+//=======================================================================
+
+void AIS_ColoredShape::SetTransparency (const Standard_Real theValue)
+{
+  setTransparency (myDrawer, theValue);
+  myTransparency = theValue;
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (AIS_Shaded);
+  for (DataMapOfShapeColor::Iterator anIter (myShapeColors); anIter.More(); anIter.Next())
+  {
+    const Handle(AIS_Drawer)& aDrawer = anIter.Value();
+    if (aDrawer->HasShadingAspect())
+    {
+      aDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
+    }
+  }
+}
+
+//=======================================================================
+//function : Compute
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::Compute (const Handle(PrsMgr_PresentationManager3d)& ,
+                                const Handle(Prs3d_Presentation)&           thePrs,
+                                const Standard_Integer                      theMode)
+{
+  thePrs->Clear();
+  if (IsInfinite())
+  {
+    thePrs->SetInfiniteState (Standard_True);
+  }
+
+  const Standard_Boolean isClosed = StdPrs_ToolShadedShape::IsClosed (myshape);
+  if (theMode == AIS_Shaded)
+  {
+    // compute mesh for entire shape beforehand to ensure consistency and optimizations (parallelization)
+    Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
+    Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
+    Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
+    if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
+     || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+    {
+      BRepTools::Clean (myshape);
+    }
+    StdPrs_ShadedShape::Tessellate (myshape, myDrawer);
+  }
+
+  // 1) myShapeColors + myshape --> array[TopAbs_ShapeEnum] of map of color-to-compound
+  DataMapOfShapeCompd aTypeKeyshapeDrawshapeArray[(size_t )TopAbs_SHAPE];
+  dispatchColors (myshape, myShapeColors, aTypeKeyshapeDrawshapeArray);
+
+  // 2) finally add appropriate presentations (1 color -- 1 compound) according to theMode
+  Handle(AIS_ColoredDrawer) aCustomDrawer;
+  for (size_t aShType = 0; aShType < (size_t )TopAbs_SHAPE; ++aShType)
+  {
+    DataMapOfShapeCompd& aKeyshapeDrawshapeMap = aTypeKeyshapeDrawshapeArray[aShType];
+    for (DataMapOfShapeCompd::Iterator aMapIter (aKeyshapeDrawshapeMap);
+         aMapIter.More(); aMapIter.Next())
+    {
+      const TopoDS_Shape&    aShapeKey  = aMapIter.Key();   // key shape with detailed color or a base shape
+      const TopoDS_Compound& aShapeDraw = aMapIter.Value(); // compound of subshapes with <aShType> type
+      Handle(AIS_Drawer)     aDrawer    = !myShapeColors.Find (aShapeKey, aCustomDrawer) ? myDrawer : aCustomDrawer;
+
+      // Draw each kind of subshapes and personal-colored shapes in a separate group
+      // since it's necessary to set transparency/material for all subshapes
+      // without affecting their unique colors
+      Handle(Graphic3d_Group) aCurrGroup = Prs3d_Root::NewGroup (thePrs);
+      switch (theMode)
+      {
+        default:
+        case AIS_Shaded:
+        {
+          if ((Standard_Integer )aShapeDraw.ShapeType() <= TopAbs_FACE
+           && !IsInfinite())
+          {
+            StdPrs_ShadedShape::Add (thePrs, aShapeDraw, aDrawer);
+
+            aDrawer->SetShadingAspectGlobal (Standard_False);
+            Handle(Graphic3d_AspectFillArea3d) anAsp = aDrawer->ShadingAspect()->Aspect();
+            isClosed ? anAsp->SuppressBackFace() : anAsp->AllowBackFace();
+            aCurrGroup->SetGroupPrimitivesAspect (anAsp);
+            break;
+          }
+          // compute wire-frame otherwise
+        }
+        case AIS_WireFrame:
+        {
+          StdPrs_WFDeflectionShape::Add (thePrs, aShapeDraw, aDrawer);
+          break;
+        }
+      }
+    }
+  }
+}
+
+//=======================================================================
+//function : dispatchColors
+//purpose  :
+//=======================================================================
+Standard_Boolean AIS_ColoredShape::dispatchColors (const TopoDS_Shape&        theBaseKey,
+                                                   const TopoDS_Shape&        theSubshapeToParse,
+                                                   const DataMapOfShapeShape& theSubshapeKeyshapeMap,
+                                                   const TopAbs_ShapeEnum     theParentType,
+                                                   DataMapOfShapeCompd*       theTypeKeyshapeDrawshapeArray)
+{
+  TopAbs_ShapeEnum aShType = theSubshapeToParse.ShapeType();
+  if (aShType == TopAbs_SHAPE)
+  {
+    return Standard_False;
+  }
+
+  // check own setting of current shape
+  TopoDS_Shape     aKeyShape   = theBaseKey;
+  Standard_Boolean isOverriden = theSubshapeKeyshapeMap.Find (theSubshapeToParse, aKeyShape);
+
+  // iterate on sub-shapes
+  BRep_Builder aBBuilder;
+  TopoDS_Shape aShapeCopy = theSubshapeToParse.EmptyCopied();
+  Standard_Boolean isSubOverride = Standard_False;
+  Standard_Integer nbDef = 0;
+  for (TopoDS_Iterator it (theSubshapeToParse); it.More(); it.Next())
+  {
+    if (dispatchColors (theBaseKey, it.Value(),
+                        theSubshapeKeyshapeMap, aShType,
+                        theTypeKeyshapeDrawshapeArray))
+    {
+      isSubOverride = Standard_True;
+    }
+    else
+    {
+      aBBuilder.Add (aShapeCopy, it.Value());
+      ++nbDef;
+    }
+  }
+  if (aShType == TopAbs_FACE || !isSubOverride)
+  {
+    aShapeCopy = theSubshapeToParse;
+  }
+  else if (nbDef == 0)
+  {
+    return isOverriden || isSubOverride; // empty compound
+  }
+
+  // if any of styles is overridden regarding to default one, add rest to map
+  if (isOverriden
+  || (isSubOverride && theParentType != TopAbs_WIRE  // avoid drawing edges when vertex color is overridden
+                    && theParentType != TopAbs_FACE) // avoid drawing edges of the same color as face
+  || (theParentType == TopAbs_SHAPE && !(isOverriden || isSubOverride))) // bind original shape to default color
+  {
+    TopoDS_Compound aCompound;
+    DataMapOfShapeCompd& aKeyshapeDrawshapeMap = theTypeKeyshapeDrawshapeArray[(size_t )aShType];
+    if (!aKeyshapeDrawshapeMap.FindFromKey (aKeyShape, aCompound))
+    {
+      aBBuilder.MakeCompound (aCompound);
+      aKeyshapeDrawshapeMap.Add (aKeyShape, aCompound);
+    }
+    aBBuilder.Add (aCompound, aShapeCopy);
+  }
+  return isOverriden || isSubOverride;
+}
+
+//=======================================================================
+//function : dispatchColors
+//purpose  :
+//=======================================================================
+void AIS_ColoredShape::dispatchColors (const TopoDS_Shape&        theBaseShape,
+                                       const DataMapOfShapeColor& theKeyshapeColorMap,
+                                       DataMapOfShapeCompd*       theTypeKeyshapeDrawshapeArray)
+{
+  // Extract <theShapeColors> map (KeyshapeColored -> Color)
+  // to subshapes map (Subshape -> KeyshapeColored).
+  // This needed when colored shape is not part of <theBaseShape>
+  // (but subshapes are) and actually container for subshapes.
+  DataMapOfShapeShape aSubshapeKeyshapeMap;
+  for (DataMapOfShapeColor::Iterator anIt (theKeyshapeColorMap);
+       anIt.More(); anIt.Next())
+  {
+    const TopoDS_Shape&   aSh = anIt.Key();
+    TopAbs_ShapeEnum    aType = aSh.ShapeType();
+    TopAbs_ShapeEnum aSubType = (aType == TopAbs_SOLID || aType == TopAbs_SHELL)
+                              ? TopAbs_FACE
+                              : (aType == TopAbs_WIRE ? TopAbs_EDGE : TopAbs_SHAPE);
+    switch (aSubType)
+    {
+      case TopAbs_SHAPE:
+      {
+        aSubshapeKeyshapeMap.Bind (aSh, aSh);
+        break;
+      }
+      default:
+      {
+        for (TopExp_Explorer anExp (aSh, aSubType); anExp.More(); anExp.Next())
+        {
+          if (!aSubshapeKeyshapeMap.IsBound (anExp.Current()))
+          {
+            aSubshapeKeyshapeMap.Bind (anExp.Current(), aSh);
+          }
+        }
+      }
+    }
+  }
+
+  // Fill the array of maps per shape type
+  dispatchColors (theBaseShape, theBaseShape,
+                  aSubshapeKeyshapeMap, TopAbs_SHAPE,
+                  theTypeKeyshapeDrawshapeArray);
+}
diff --git a/src/AIS/AIS_ColoredShape.hxx b/src/AIS/AIS_ColoredShape.hxx
new file mode 100644
index 0000000000..0fedcf8d20
--- /dev/null
+++ b/src/AIS/AIS_ColoredShape.hxx
@@ -0,0 +1,145 @@
+// Created on: 2014-04-24
+// Created by: Kirill Gavrilov
+// Copyright (c) 2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _AIS_ColoredShape_HeaderFile
+#define _AIS_ColoredShape_HeaderFile
+
+#include <AIS_Drawer.hxx>
+#include <AIS_Shape.hxx>
+
+#include <NCollection_DataMap.hxx>
+#include <NCollection_IndexedDataMap.hxx>
+#include <TopTools_ShapeMapHasher.hxx>
+#include <TopoDS_Compound.hxx>
+
+//! Customizable properties.
+class AIS_ColoredDrawer : public AIS_Drawer
+{
+public:
+
+  AIS_ColoredDrawer (const Handle(AIS_Drawer)& theLink)
+  : myHasOwnColor (Standard_False),
+    myHasOwnWidth (Standard_False)
+  {
+    Link (theLink);
+  }
+
+  Standard_Boolean HasOwnColor() const                              { return myHasOwnColor; }
+  void             UnsetOwnColor()                                  { myHasOwnColor = Standard_False; }
+  void             SetOwnColor (const Quantity_Color& /*theColor*/) { myHasOwnColor = Standard_True;  }
+  Standard_Boolean HasOwnWidth() const                              { return myHasOwnWidth; }
+  void             UnsetOwnWidth()                                  { myHasOwnWidth = Standard_False; }
+  void             SetOwnWidth (const Standard_Real /*theWidth*/)   { myHasOwnWidth = Standard_True;  }
+
+public:  //! @name list of overridden properties
+
+  Standard_Boolean myHasOwnColor;
+  Standard_Boolean myHasOwnWidth;
+
+public:
+  DEFINE_STANDARD_RTTI(AIS_ColoredDrawer);
+
+};
+
+DEFINE_STANDARD_HANDLE(AIS_ColoredDrawer, AIS_Drawer)
+
+//! Presentation of the shape with customizable sub-shapes properties.
+class AIS_ColoredShape : public AIS_Shape
+{
+public:
+
+  //! Default constructor
+  Standard_EXPORT AIS_ColoredShape (const TopoDS_Shape& theShape);
+
+  //! Copy constructor
+  Standard_EXPORT AIS_ColoredShape (const Handle(AIS_Shape)& theShape);
+
+public: //! @name sub-shape aspects
+
+  //! Customize properties of specified sub-shape.
+  //! The shape will be stored in the map but ignored, if it is not sub-shape of main Shape!
+  //! This method can be used to mark sub-shapes with customizable properties.
+  Standard_EXPORT Handle(AIS_ColoredDrawer) CustomAspects (const TopoDS_Shape& theShape);
+
+  //! Reset the map of custom sub-shape aspects.
+  Standard_EXPORT void ClearCustomAspects();
+
+  //! Reset custom properties of specified sub-shape.
+  //! @param theToUnregister unregister or not sub-shape from the map
+  Standard_EXPORT void UnsetCustomAspects (const TopoDS_Shape&    theShape,
+                                           const Standard_Boolean theToUnregister = Standard_False);
+
+  //! Customize color of specified sub-shape
+  Standard_EXPORT void SetCustomColor (const TopoDS_Shape&   theShape,
+                                       const Quantity_Color& theColor);
+
+  //! Customize line width of specified sub-shape
+  Standard_EXPORT void SetCustomWidth (const TopoDS_Shape& theShape,
+                                       const Standard_Real theLineWidth);
+
+public: //! @name global aspects
+
+  //! Setup color of entire shape.
+  Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor);
+
+  //! Setup line width of entire shape.
+  Standard_EXPORT virtual void SetWidth (const Standard_Real theLineWidth);
+
+  //! Sets transparency value.
+  Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue);
+
+protected: //! @name override presentation computation
+
+  Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePrsMgr,
+                                        const Handle(Prs3d_Presentation)&           thePrs,
+                                        const Standard_Integer                      theMode);
+
+protected:
+
+  typedef NCollection_DataMap<TopoDS_Shape, Handle(AIS_ColoredDrawer), TopTools_ShapeMapHasher> DataMapOfShapeColor;
+  typedef NCollection_DataMap<TopoDS_Shape, TopoDS_Shape,              TopTools_ShapeMapHasher> DataMapOfShapeShape;
+  typedef NCollection_IndexedDataMap<TopoDS_Shape, TopoDS_Compound,    TopTools_ShapeMapHasher> DataMapOfShapeCompd;
+
+protected:
+
+  //! Recursive function to map shapes.
+  //! @param theBaseKey                    the key to be used for undetailed shapes (default colors)
+  //! @param theSubshapeToParse            the subshape to be parsed
+  //! @param theSubshapeKeyshapeMap        shapes map Subshape (in the base shape) -> Keyshape (detailed shape)
+  //! @param theParentType                 the parent subshape type
+  //! @param theTypeKeyshapeDrawshapeArray the array of shape types to fill
+  Standard_EXPORT static Standard_Boolean dispatchColors (const TopoDS_Shape&        theBaseKey,
+                                                          const TopoDS_Shape&        theSubshapeToParse,
+                                                          const DataMapOfShapeShape& theSubshapeKeyshapeMap,
+                                                          const TopAbs_ShapeEnum     theParentType,
+                                                          DataMapOfShapeCompd*       theTypeKeyshapeDrawshapeArray);
+
+  Standard_EXPORT static void dispatchColors (const TopoDS_Shape&        theBaseShape,
+                                              const DataMapOfShapeColor& theKeyshapeColorMap,
+                                              DataMapOfShapeCompd*       theTypeKeyshapeDrawshapeArray);
+
+protected:
+
+  DataMapOfShapeColor myShapeColors;
+
+public:
+
+  DEFINE_STANDARD_RTTI(AIS_ColoredShape);
+
+};
+
+DEFINE_STANDARD_HANDLE(AIS_ColoredShape, AIS_Shape)
+
+#endif // _AIS_ColoredShape_HeaderFile
diff --git a/src/AIS/AIS_Drawer.lxx b/src/AIS/AIS_Drawer.lxx
index 1b4a63515d..8112684fe4 100644
--- a/src/AIS/AIS_Drawer.lxx
+++ b/src/AIS/AIS_Drawer.lxx
@@ -15,86 +15,136 @@
 // commercial license or contractual agreement.
 
 inline Standard_Boolean AIS_Drawer::WasLastLocal() const
-{return Standard_False;}
+{
+  return Standard_False;
+}
 
-inline Standard_Boolean AIS_Drawer::HasLocalAttributes() const 
-{return hasLocalAttributes;}
+inline Standard_Boolean AIS_Drawer::HasLocalAttributes() const
+{
+  return hasLocalAttributes;
+}
 
-inline Standard_Real AIS_Drawer::PreviousDeviationCoefficient ()  const 
-{return  (myhasOwnDeviationCoefficient) ? myPreviousDeviationCoefficient : 0.0;}
+inline Standard_Real AIS_Drawer::PreviousDeviationCoefficient() const
+{
+  return myhasOwnDeviationCoefficient ? myPreviousDeviationCoefficient : 0.0;
+}
 
-inline Standard_Real AIS_Drawer::PreviousHLRDeviationCoefficient ()  const 
-{return  (myhasOwnHLRDeviationCoefficient) ? myPreviousHLRDeviationCoefficient : 0.0;}
+inline Standard_Real AIS_Drawer::PreviousHLRDeviationCoefficient() const
+{
+  return myhasOwnHLRDeviationCoefficient ? myPreviousHLRDeviationCoefficient : 0.0;
+}
 
-inline Standard_Real AIS_Drawer::PreviousDeviationAngle ()  const 
-{return  (myhasOwnDeviationAngle) ? myPreviousDeviationAngle : 0.0;}
+inline Standard_Real AIS_Drawer::PreviousDeviationAngle() const
+{
+  return myhasOwnDeviationAngle ? myPreviousDeviationAngle : 0.0;
+}
 
-inline Standard_Real AIS_Drawer::PreviousHLRDeviationAngle ()  const 
-{return  (myhasOwnHLRDeviationAngle) ? myPreviousHLRDeviationAngle : 0.0;}
+inline Standard_Real AIS_Drawer::PreviousHLRDeviationAngle() const
+{
+  return myhasOwnHLRDeviationAngle ? myPreviousHLRDeviationAngle : 0.0;
+}
 
-inline void AIS_Drawer::Link ( const Handle(Prs3d_Drawer)& aDrawer) 
-{ myLink = aDrawer;}
+inline void AIS_Drawer::Link (const Handle(Prs3d_Drawer)& theDrawer)
+{
+  myLink = theDrawer;
+}
 
 inline Standard_Boolean AIS_Drawer::HasLink() const
-{ return ! myLink.IsNull();}
+{
+  return !myLink.IsNull();
+}
 
-inline void AIS_Drawer::SetDeviationCoefficient ()
-{ myhasOwnDeviationCoefficient    = Standard_False; }
+inline void AIS_Drawer::SetDeviationCoefficient()
+{
+  myhasOwnDeviationCoefficient = Standard_False;
+}
 
-inline void AIS_Drawer::SetHLRDeviationCoefficient () 
-{ myhasOwnHLRDeviationCoefficient    = Standard_False; }
+inline void AIS_Drawer::SetHLRDeviationCoefficient()
+{
+  myhasOwnHLRDeviationCoefficient = Standard_False;
+}
 
-inline void AIS_Drawer::SetDeviationAngle () 
-{ myhasOwnDeviationAngle    = Standard_False;}
+inline void AIS_Drawer::SetDeviationAngle()
+{
+  myhasOwnDeviationAngle = Standard_False;
+}
 
-inline void AIS_Drawer::SetHLRAngle () 
-{ myhasOwnHLRDeviationAngle    = Standard_False;}
+inline void AIS_Drawer::SetHLRAngle() 
+{
+  myhasOwnHLRDeviationAngle = Standard_False;
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnDeviationCoefficient ()  const 
-{ return  myhasOwnDeviationCoefficient;}
+inline Standard_Boolean AIS_Drawer::IsOwnDeviationCoefficient() const
+{
+  return myhasOwnDeviationCoefficient;
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnDeviationAngle ()  const 
-{ return  myhasOwnDeviationAngle;}
+inline Standard_Boolean AIS_Drawer::IsOwnDeviationAngle() const
+{
+  return myhasOwnDeviationAngle;
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationCoefficient ()  const 
-{ return  myhasOwnHLRDeviationCoefficient;}
+inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationCoefficient() const
+{
+  return myhasOwnHLRDeviationCoefficient;
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationAngle ()  const 
-{ return  myhasOwnHLRDeviationAngle;}
+inline Standard_Boolean AIS_Drawer::IsOwnHLRDeviationAngle() const
+{
+  return myhasOwnHLRDeviationAngle;
+}
 
-inline Standard_Boolean AIS_Drawer::HasTextAspect ()  const 
-{ return (!myTextAspect.IsNull());}
+inline Standard_Boolean AIS_Drawer::HasTextAspect() const
+{
+  return !myTextAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasWireAspect ()  const 
-{ return (!myWireAspect.IsNull());}
+inline Standard_Boolean AIS_Drawer::HasWireAspect() const
+{
+  return !myWireAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasLineAspect ()  const 
-{return !myLineAspect.IsNull(); }
+inline Standard_Boolean AIS_Drawer::HasLineAspect() const
+{
+  return !myLineAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasShadingAspect ()  const 
-{  return !myShadingAspect.IsNull();}
+inline Standard_Boolean AIS_Drawer::HasShadingAspect() const
+{
+  return !myShadingAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasPointAspect ()  const 
-{ return !myPointAspect.IsNull();}
+inline Standard_Boolean AIS_Drawer::HasPointAspect() const
+{
+  return !myPointAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasDatumAspect ()  const 
-{ return !myDatumAspect.IsNull();}
+inline Standard_Boolean AIS_Drawer::HasDatumAspect() const
+{
+  return !myDatumAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::HasPlaneAspect ()  const 
-{ return !myPlaneAspect.IsNull();}
+inline Standard_Boolean AIS_Drawer::HasPlaneAspect() const
+{
+  return !myPlaneAspect.IsNull();
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw () const
-{ return myHasOwnFaceBoundaryDraw; }
+inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryDraw() const
+{
+  return myHasOwnFaceBoundaryDraw;
+}
 
-inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryAspect () const
-{ return !myFaceBoundaryAspect.IsNull (); }
+inline Standard_Boolean AIS_Drawer::IsOwnFaceBoundaryAspect() const
+{
+  return !myFaceBoundaryAspect.IsNull();
+}
 
-inline void AIS_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR) 
+inline void AIS_Drawer::SetTypeOfHLR (const Prs3d_TypeOfHLR theTypeOfHLR)
 {
   myTypeOfHLR = theTypeOfHLR;
 }
 
-inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR ( ) const
+inline Prs3d_TypeOfHLR AIS_Drawer::TypeOfHLR() const
 {
   return (myTypeOfHLR == Prs3d_TOH_NotSet) ? myLink->TypeOfHLR() : myTypeOfHLR;
 }
diff --git a/src/AIS/AIS_Shape.cdl b/src/AIS/AIS_Shape.cdl
index a0932562d6..a7990c9e9e 100644
--- a/src/AIS/AIS_Shape.cdl
+++ b/src/AIS/AIS_Shape.cdl
@@ -61,6 +61,7 @@ uses
     Projector             from Prs3d,
     PresentationManager3d from PrsMgr,
     Selection             from SelectMgr,
+    Drawer                from AIS,
     KindOfInteractive     from AIS,
     Transformation        from Geom,
     Drawer                from Prs3d,
@@ -298,7 +299,21 @@ uses
 		       	aBox : Box from Bnd;
 		       	aDrawer : Drawer from Prs3d) is protected;
     		
-    
+    setColor (me;
+              theDrawer : Drawer from AIS;
+              theColor  : Color  from Quantity)
+    is protected;
+
+    setWidth (me;
+              theDrawer : Drawer from AIS;
+              theWidth  : Real   from Standard)
+    is protected;
+
+    setTransparency (me;
+                     theDrawer : Drawer from AIS;
+                     theValue  : Real   from Standard)
+    is protected;
+
 fields
     myshape            : Shape   from TopoDS   is protected;
     myBB               : Box     from Bnd      is protected;
diff --git a/src/AIS/AIS_Shape.cxx b/src/AIS/AIS_Shape.cxx
index d1e016debc..68088dd45e 100644
--- a/src/AIS/AIS_Shape.cxx
+++ b/src/AIS/AIS_Shape.cxx
@@ -215,23 +215,15 @@ void AIS_Shape::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentat
   }
   case 1:
     {
-      Standard_Real prevangle ;
-      Standard_Real newangle  ; 
-      Standard_Real prevcoeff ;
-      Standard_Real newcoeff  ; 
-      
-      Standard_Boolean isOwnDeviationAngle = OwnDeviationAngle(newangle,prevangle);
-      Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(newcoeff,prevcoeff);
-      if (((Abs (newangle - prevangle) > Precision::Angular()) && isOwnDeviationAngle) ||
-          ((Abs (newcoeff - prevcoeff) > Precision::Confusion()) && isOwnDeviationCoefficient)) { 
-#ifdef DEB
-        cout << "AIS_Shape : compute"<<endl;
-        cout << "newangl   : " << newangle << " # de " << "prevangl  : " << prevangle << " OU "<<endl;
-        cout << "newcoeff  : " << newcoeff << " # de " << "prevcoeff : " << prevcoeff << endl;
-#endif
-        BRepTools::Clean(myshape);
+      Standard_Real anAnglePrev, anAngleNew, aCoeffPrev, aCoeffNew;
+      Standard_Boolean isOwnDeviationAngle       = OwnDeviationAngle      (anAngleNew, anAnglePrev);
+      Standard_Boolean isOwnDeviationCoefficient = OwnDeviationCoefficient(aCoeffNew,  aCoeffPrev);
+      if ((isOwnDeviationAngle       && Abs (anAngleNew - anAnglePrev) > Precision::Angular())
+       || (isOwnDeviationCoefficient && Abs (aCoeffNew  - aCoeffPrev)  > Precision::Confusion()))
+      {
+        BRepTools::Clean (myshape);
       }
-      
+
       //shading only on face...
       if ((Standard_Integer) myshape.ShapeType()>4)
         StdPrs_WFDeflectionShape::Add(aPrs,myshape,myDrawer);
@@ -496,134 +488,211 @@ void AIS_Shape::SetColor(const Quantity_NameOfColor aCol)
 }
 
 //=======================================================================
-//function : SetColor
-//purpose  : 
+//function : setColor
+//purpose  :
 //=======================================================================
 
-void AIS_Shape::SetColor(const Quantity_Color &aCol)
+void AIS_Shape::setColor (const Handle(AIS_Drawer)& theDrawer,
+                          const Quantity_Color&     theColor) const
 {
-  if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
-    myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
+  if (!theDrawer->HasShadingAspect())
+  {
+    theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+    *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
   }
+  if (!theDrawer->HasLineAspect())
+  {
+    theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+    *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
+  }
+  if (!theDrawer->HasWireAspect())
+  {
+    theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+    *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
+  }
+  if (!theDrawer->HasPointAspect())
+  {
+    theDrawer->SetPointAspect (new Prs3d_PointAspect (Aspect_TOM_POINT, Quantity_NOC_BLACK, 1.0));
+    *theDrawer->PointAspect()->Aspect() = *theDrawer->Link()->PointAspect()->Aspect();
+  }
+  // disable dedicated line aspects
+  theDrawer->SetFreeBoundaryAspect  (theDrawer->LineAspect());
+  theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
+  theDrawer->SetSeenLineAspect      (theDrawer->LineAspect());
+
+  // override color
+  theDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
+  theDrawer->SetShadingAspectGlobal (Standard_False);
+  theDrawer->LineAspect()->SetColor (theColor);
+  theDrawer->WireAspect()->SetColor (theColor);
+  theDrawer->PointAspect()->SetColor (theColor);
+}
+
+//=======================================================================
+//function : SetColor
+//purpose  :
+//=======================================================================
+
+void AIS_Shape::SetColor (const Quantity_Color& theColor)
+{
+  setColor (myDrawer, theColor);
+  myOwnColor  = theColor;
   hasOwnColor = Standard_True;
 
-  myDrawer->ShadingAspect()->SetColor(aCol,myCurrentFacingModel);
-  myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
-  myDrawer->SetShadingAspectGlobal(Standard_False);
-
-
-  const Standard_Real WW = HasWidth()? Width():AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line);
-
-  myDrawer->SetLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
-  myDrawer->SetWireAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
-  myDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
-  myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
-  myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(aCol,Aspect_TOL_SOLID,WW));
-
   // fast shading modification...
-  if(!GetContext().IsNull()){
-    if( GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aCurGroup = Prs3d_Root::CurrentGroup(aPresentation);
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation)         aPrs         = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)            aCurGroup    = Prs3d_Root::CurrentGroup (aPrs);
       Handle(Graphic3d_AspectFillArea3d) anAreaAspect = myDrawer->ShadingAspect()->Aspect();
-      Handle(Graphic3d_AspectLine3d) aLineAspect = myDrawer->LineAspect()->Aspect();
+      Handle(Graphic3d_AspectLine3d)     aLineAspect  = myDrawer->LineAspect()->Aspect();
+      Handle(Graphic3d_AspectMarker3d)   aPointAspect = myDrawer->PointAspect()->Aspect();
 
       // Set aspects for presentation and for group
-      aPresentation->SetPrimitivesAspect(anAreaAspect);
-      aPresentation->SetPrimitivesAspect(aLineAspect);
+      aPrs->SetPrimitivesAspect (anAreaAspect);
+      aPrs->SetPrimitivesAspect (aLineAspect);
+      aPrs->SetPrimitivesAspect (aPointAspect);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aCurGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aCurGroup->SetGroupPrimitivesAspect(anAreaAspect);
-      if (aCurGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_LINE))
-        aCurGroup->SetGroupPrimitivesAspect(aLineAspect);
+      if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aCurGroup->SetGroupPrimitivesAspect (anAreaAspect);
+      }
+      if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
+      {
+        aCurGroup->SetGroupPrimitivesAspect (aLineAspect);
+      }
+      if (aCurGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_MARKER))
+      {
+        aCurGroup->SetGroupPrimitivesAspect (aPointAspect);
+      }
     }
   }
 
-  LoadRecomputable(0);
-  LoadRecomputable(2);
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (2);
 }
 
 //=======================================================================
 //function : UnsetColor
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void AIS_Shape::UnsetColor()
 {
-  if ( !HasColor() )
+  if (!HasColor())
   {
     myToRecomputeModes.Clear();
     return;
   }
   hasOwnColor = Standard_False;
 
-  Handle(Prs3d_LineAspect) NullAsp;
-  Handle(Prs3d_ShadingAspect) NullShA;
-  
-  if(!HasWidth()) {
-    myDrawer->SetLineAspect(NullAsp);
-    myDrawer->SetWireAspect(NullAsp);
-    myDrawer->SetFreeBoundaryAspect(NullAsp);
-    myDrawer->SetUnFreeBoundaryAspect(NullAsp);
-    myDrawer->SetSeenLineAspect(NullAsp);
+  if (!HasWidth())
+  {
+    Handle(Prs3d_LineAspect) anEmptyAsp;
+    myDrawer->SetLineAspect          (anEmptyAsp);
+    myDrawer->SetWireAspect          (anEmptyAsp);
+    myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
+    myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
+    myDrawer->SetSeenLineAspect      (anEmptyAsp);
   }
-  else {
-    Quantity_Color CC;
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
-    myDrawer->LineAspect()->SetColor(CC);
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire,CC);
-    myDrawer->WireAspect()->SetColor(CC);
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free,CC);
-    myDrawer->FreeBoundaryAspect()->SetColor(CC);
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree,CC);
-    myDrawer->UnFreeBoundaryAspect()->SetColor(CC);
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
-    myDrawer->SeenLineAspect()->SetColor(CC);
+  else
+  {
+    Quantity_Color aColor;
+    AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Line,   aColor);
+    myDrawer->LineAspect()->SetColor (aColor);
+    AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Wire,   aColor);
+    myDrawer->WireAspect()->SetColor (aColor);
+    AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Free,   aColor);
+    myDrawer->FreeBoundaryAspect()->SetColor (aColor);
+    AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_UnFree, aColor);
+    myDrawer->UnFreeBoundaryAspect()->SetColor (aColor);
+    AIS_GraphicTool::GetLineColor (myDrawer->Link(), AIS_TOA_Seen,   aColor);
+    myDrawer->SeenLineAspect()->SetColor (aColor);
   }
 
-  if( HasMaterial() || IsTransparent()) {
+  if (HasMaterial()
+   || IsTransparent())
+  {
     Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(HasMaterial()? myDrawer : myDrawer->Link());
-    if( HasMaterial() ) {
-      Quantity_Color color = myDrawer->Link()->ShadingAspect()->Color(myCurrentFacingModel);
-      mat.SetColor(color);
+    if (HasMaterial())
+    {
+      Quantity_Color aColor = myDrawer->Link()->ShadingAspect()->Color (myCurrentFacingModel);
+      mat.SetColor (aColor);
     }
-    if( IsTransparent() ) {
-      Standard_Real trans = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
-      mat.SetTransparency(trans);
+    if (IsTransparent())
+    {
+      Standard_Real aTransp = myDrawer->ShadingAspect()->Transparency (myCurrentFacingModel);
+      mat.SetTransparency (aTransp);
     }
-    myDrawer->ShadingAspect()->SetMaterial(mat,myCurrentFacingModel);
+    myDrawer->ShadingAspect()->SetMaterial (mat ,myCurrentFacingModel);
   }
-  else {
-    myDrawer->SetShadingAspect(NullShA);
+  else
+  {
+    myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
   }
+  myDrawer->SetPointAspect (Handle(Prs3d_PointAspect)());
 
-  if(!GetContext().IsNull()){
-    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation) aPrs   = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)    aGroup = Prs3d_Root::CurrentGroup (aPrs);
 
       Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->Link()->ShadingAspect()->Aspect();
-      Handle(Graphic3d_AspectLine3d) aLineAsp = myDrawer->Link()->LineAspect()->Aspect();
-      Quantity_Color CC;
-      AIS_GraphicTool::GetInteriorColor(myDrawer->Link(),CC);
-      anAreaAsp->SetInteriorColor(CC);
-      aPresentation->SetPrimitivesAspect(anAreaAsp);
-      aPresentation->SetPrimitivesAspect(aLineAsp);
+      Handle(Graphic3d_AspectLine3d)     aLineAsp  = myDrawer->Link()->LineAspect()->Aspect();
+      Quantity_Color aColor;
+      AIS_GraphicTool::GetInteriorColor (myDrawer->Link(), aColor);
+      anAreaAsp->SetInteriorColor (aColor);
+      aPrs->SetPrimitivesAspect (anAreaAsp);
+      aPrs->SetPrimitivesAspect (aLineAsp);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_LINE))
-        aGroup->SetGroupPrimitivesAspect(aLineAsp);
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aGroup->SetGroupPrimitivesAspect (anAreaAsp);
+      }
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_LINE))
+      {
+        aGroup->SetGroupPrimitivesAspect (aLineAsp);
+      }
     }
   }
-  LoadRecomputable(0);
-  LoadRecomputable(2);
+  LoadRecomputable (AIS_WireFrame);
+  LoadRecomputable (2);
+}
+
+//=======================================================================
+//function : setWidth
+//purpose  :
+//=======================================================================
+
+void AIS_Shape::setWidth (const Handle(AIS_Drawer)& theDrawer,
+                          const Standard_Real       theLineWidth) const
+{
+  if (!theDrawer->HasLineAspect())
+  {
+    theDrawer->SetLineAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+    *theDrawer->LineAspect()->Aspect() = *theDrawer->Link()->LineAspect()->Aspect();
+  }
+  if (!theDrawer->HasWireAspect())
+  {
+    theDrawer->SetWireAspect (new Prs3d_LineAspect (Quantity_NOC_BLACK, Aspect_TOL_SOLID, 1.0));
+    *theDrawer->WireAspect()->Aspect() = *theDrawer->Link()->WireAspect()->Aspect();
+  }
+  // disable dedicated line aspects
+  theDrawer->SetFreeBoundaryAspect  (theDrawer->LineAspect());
+  theDrawer->SetUnFreeBoundaryAspect(theDrawer->LineAspect());
+  theDrawer->SetSeenLineAspect      (theDrawer->LineAspect());
+
+  // override width
+  theDrawer->LineAspect()->SetWidth (theLineWidth);
+  theDrawer->WireAspect()->SetWidth (theLineWidth);
 }
 
 //=======================================================================
@@ -631,64 +700,48 @@ void AIS_Shape::UnsetColor()
 //purpose  : 
 //=======================================================================
 
-void AIS_Shape::SetWidth(const Standard_Real W)
+void AIS_Shape::SetWidth (const Standard_Real theLineWidth)
 {
-  if(HasColor() || HasWidth()){
-    myDrawer->LineAspect()->SetWidth(W);
-    myDrawer->WireAspect()->SetWidth(W);
-    myDrawer->FreeBoundaryAspect()->SetWidth(W);
-    myDrawer->UnFreeBoundaryAspect()->SetWidth(W);
-    myDrawer->SeenLineAspect()->SetWidth(W);
-  }
-  else{
-    Quantity_Color CC;
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Line,CC);
-    myDrawer->SetLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Wire,CC);
-    myDrawer->SetWireAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Free,CC);
-    myDrawer->SetFreeBoundaryAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_UnFree,CC);
-    myDrawer->SetUnFreeBoundaryAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-    AIS_GraphicTool::GetLineColor(myDrawer->Link(),AIS_TOA_Seen,CC);
-    myDrawer->SetSeenLineAspect(new Prs3d_LineAspect(CC,Aspect_TOL_SOLID,W));
-  }
-  myOwnWidth = W;
-  LoadRecomputable(0); // means that it is necessary to recompute only the wireframe....
-  LoadRecomputable(2); // and the bounding box...
+  setWidth (myDrawer, theLineWidth);
+  myOwnWidth = theLineWidth;
+  LoadRecomputable (AIS_WireFrame); // means that it is necessary to recompute only the wireframe....
+  LoadRecomputable (2);             // and the bounding box...
 }
 
 //=======================================================================
 //function : UnsetWidth
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void AIS_Shape::UnsetWidth()
 {
-  if(myOwnWidth == 0.0)
+  if (myOwnWidth == 0.0)
   {
     myToRecomputeModes.Clear();
     return;
   }
-  myOwnWidth=0.0;
 
-  Handle(Prs3d_LineAspect) NullAsp;
+  myOwnWidth = 0.0;
 
-  if(!HasColor()){
-    myDrawer->SetLineAspect(NullAsp);
-    myDrawer->SetWireAspect(NullAsp);
-    myDrawer->SetFreeBoundaryAspect(NullAsp);
-    myDrawer->SetUnFreeBoundaryAspect(NullAsp);
-    myDrawer->SetSeenLineAspect(NullAsp);
+  Handle(Prs3d_LineAspect) anEmptyAsp;
+
+  if (!HasColor())
+  {
+    myDrawer->SetLineAspect          (anEmptyAsp);
+    myDrawer->SetWireAspect          (anEmptyAsp);
+    myDrawer->SetFreeBoundaryAspect  (anEmptyAsp);
+    myDrawer->SetUnFreeBoundaryAspect(anEmptyAsp);
+    myDrawer->SetSeenLineAspect      (anEmptyAsp);
   }
-  else{
-    myDrawer->LineAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Line));
-    myDrawer->WireAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Wire));
-    myDrawer->FreeBoundaryAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Free));
-    myDrawer->UnFreeBoundaryAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_UnFree));
-    myDrawer->SeenLineAspect()->SetWidth(AIS_GraphicTool::GetLineWidth(myDrawer->Link(),AIS_TOA_Seen));
+  else
+  {
+    myDrawer->LineAspect()          ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Line));
+    myDrawer->WireAspect()          ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Wire));
+    myDrawer->FreeBoundaryAspect()  ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Free));
+    myDrawer->UnFreeBoundaryAspect()->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_UnFree));
+    myDrawer->SeenLineAspect()      ->SetWidth (AIS_GraphicTool::GetLineWidth (myDrawer->Link(), AIS_TOA_Seen));
   }
-  LoadRecomputable(0);
+  LoadRecomputable (AIS_WireFrame);
 }
 
 //=======================================================================
@@ -703,146 +756,188 @@ void AIS_Shape::SetMaterial(const Graphic3d_NameOfMaterial aMat)
 
 //=======================================================================
 //function : SetMaterial
-//purpose  : 
+//purpose  :
 //=======================================================================
 
-void AIS_Shape::SetMaterial(const Graphic3d_MaterialAspect& aMat)
+void AIS_Shape::SetMaterial (const Graphic3d_MaterialAspect& theMat)
 {
-  if( !HasColor() && !IsTransparent() && !HasMaterial() ) {
-    myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
+  if (!myDrawer->HasShadingAspect())
+  {
+    myDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+    *myDrawer->ShadingAspect()->Aspect() = *myDrawer->Link()->ShadingAspect()->Aspect();
   }
   hasOwnMaterial = Standard_True;
 
-  myDrawer->ShadingAspect()->SetMaterial(aMat,myCurrentFacingModel);
-  myDrawer->ShadingAspect()->SetTransparency(myTransparency,myCurrentFacingModel);
+  myDrawer->ShadingAspect()->SetMaterial (theMat, myCurrentFacingModel);
+  if (HasColor())
+  {
+    myDrawer->ShadingAspect()->SetColor (myOwnColor, myCurrentFacingModel);
+  }
+  myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
 
-  if(!GetContext().IsNull()){
-    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation) aPrs   = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)    aGroup = Prs3d_Root::CurrentGroup (aPrs);
     
       Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
-      aPresentation->SetPrimitivesAspect(anAreaAsp);
+      aPrs->SetPrimitivesAspect (anAreaAsp);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aGroup->SetGroupPrimitivesAspect (anAreaAsp);
+      }
     }
-    myRecomputeEveryPrs =Standard_False; // no mode to recalculate  :only viewer update
+    myRecomputeEveryPrs = Standard_False; // no mode to recalculate  :only viewer update
     myToRecomputeModes.Clear();
   }
 }
+
 //=======================================================================
 //function : UnsetMaterial
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void AIS_Shape::UnsetMaterial()
 {
-  if( !HasMaterial() ) return;
+  if (!HasMaterial())
+  {
+    return;
+  }
 
-  if( HasColor() || IsTransparent()) {
-    Graphic3d_MaterialAspect mat = AIS_GraphicTool::GetMaterial(myDrawer->Link()); 
-    if( HasColor() ) {
-      Quantity_Color color = myDrawer->ShadingAspect()->Color(myCurrentFacingModel);
-      mat.SetColor(color);
+  if (HasColor()
+   || IsTransparent())
+  {
+    myDrawer->ShadingAspect()->SetMaterial (myDrawer->Link()->ShadingAspect()->Material (myCurrentFacingModel),
+                                            myCurrentFacingModel);
+    if (HasColor())
+    {
+      myDrawer->ShadingAspect()->SetColor        (myOwnColor,     myCurrentFacingModel);
+      myDrawer->ShadingAspect()->SetTransparency (myTransparency, myCurrentFacingModel);
     }
-    if( IsTransparent() ) {
-      Standard_Real trans = myDrawer->ShadingAspect()->Transparency(myCurrentFacingModel);
-      mat.SetTransparency(trans);
-    }
-    myDrawer->ShadingAspect()->SetMaterial(mat,myCurrentFacingModel);
-  } else {
-    Handle(Prs3d_ShadingAspect) SA;
-    myDrawer->SetShadingAspect(SA);
+  }
+  else
+  {
+    myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
   }
   hasOwnMaterial = Standard_False;
-  if(!GetContext().IsNull()){
-    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
+
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation) aPrs   = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)    aGroup = Prs3d_Root::CurrentGroup (aPrs);
       Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
-      aPresentation->SetPrimitivesAspect(anAreaAsp);
+      aPrs->SetPrimitivesAspect (anAreaAsp);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aGroup->SetGroupPrimitivesAspect (anAreaAsp);
+      }
     }
   }
-  myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
+  myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
   myToRecomputeModes.Clear();  
 }
 
 //=======================================================================
-//function : SetTransparency
-//purpose  : 
+//function : setTransparency
+//purpose  :
 //=======================================================================
 
-void AIS_Shape::SetTransparency(const Standard_Real AValue)
+void AIS_Shape::setTransparency (const Handle(AIS_Drawer)& theDrawer,
+                                 const Standard_Real       theValue) const
 {
-  if ( !HasColor() && !HasMaterial() ) {
-    myDrawer->SetShadingAspect(new Prs3d_ShadingAspect());
+  if (!theDrawer->HasShadingAspect())
+  {
+    theDrawer->SetShadingAspect (new Prs3d_ShadingAspect());
+    *theDrawer->ShadingAspect()->Aspect() = *theDrawer->Link()->ShadingAspect()->Aspect();
   }
-  myDrawer->ShadingAspect()->SetTransparency(AValue,myCurrentFacingModel);
-  myTransparency = AValue;
 
-  if(!GetContext().IsNull()){
-    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
+  // override transparency
+  theDrawer->ShadingAspect()->SetTransparency (theValue, myCurrentFacingModel);
+}
+
+//=======================================================================
+//function : SetTransparency
+//purpose  :
+//=======================================================================
+
+void AIS_Shape::SetTransparency (const Standard_Real theValue)
+{
+  setTransparency (myDrawer, theValue);
+  myTransparency = theValue;
+
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation)         aPrs      = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)            aGroup    = Prs3d_Root::CurrentGroup (aPrs);
       Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
-      aPresentation->SetPrimitivesAspect(anAreaAsp);
-      //force highest priority for transparent objects
-      aPresentation->SetDisplayPriority(10);
+      aPrs->SetPrimitivesAspect (anAreaAsp);
+      // force highest priority for transparent objects
+      aPrs->SetDisplayPriority (10);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aGroup->SetGroupPrimitivesAspect (anAreaAsp);
+      }
     }
   }
-  myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
+  myRecomputeEveryPrs = Standard_False; // no mode to recalculate - only viewer update
   myToRecomputeModes.Clear();
 }
 
 //=======================================================================
 //function : UnsetTransparency
-//purpose  : 
+//purpose  :
 //=======================================================================
 
 void AIS_Shape::UnsetTransparency()
 {
-  if( HasColor() || HasMaterial() ) {
-    myDrawer->ShadingAspect()->SetTransparency(0.0,myCurrentFacingModel);
-  } else {
-    Handle(Prs3d_ShadingAspect) SA;
-    myDrawer->SetShadingAspect(SA);
+  myTransparency = 0.0;
+  if (!myDrawer->HasShadingAspect())
+  {
+    return;
+  }
+  else if (HasColor() || HasMaterial())
+  {
+    myDrawer->ShadingAspect()->SetTransparency (0.0, myCurrentFacingModel);
+  }
+  else
+  {
+    myDrawer->SetShadingAspect (Handle(Prs3d_ShadingAspect)());
   }
 
-  myTransparency = 0.0;
-
-  if(!GetContext().IsNull()){
-    if(GetContext()->MainPrsMgr()->HasPresentation(this,1)){
-      Handle(Prs3d_Presentation) aPresentation = 
-        GetContext()->MainPrsMgr()->CastPresentation(this,1)->Presentation();
-      Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup(aPresentation);
+  if (!GetContext().IsNull())
+  {
+    if (GetContext()->MainPrsMgr()->HasPresentation (this, AIS_Shaded))
+    {
+      Handle(Prs3d_Presentation)         aPrs      = GetContext()->MainPrsMgr()->CastPresentation (this, AIS_Shaded)->Presentation();
+      Handle(Graphic3d_Group)            aGroup    = Prs3d_Root::CurrentGroup (aPrs);
       Handle(Graphic3d_AspectFillArea3d) anAreaAsp = myDrawer->ShadingAspect()->Aspect();
-      aPresentation->SetPrimitivesAspect(anAreaAsp);
+      aPrs->SetPrimitivesAspect (anAreaAsp);
       // Check if aspect of given type is set for the group, 
       // because setting aspect for group with no already set aspect
       // can lead to loss of presentation data
-      if (aGroup->IsGroupPrimitivesAspectSet(Graphic3d_ASPECT_FILL_AREA))
-        aGroup->SetGroupPrimitivesAspect(anAreaAsp);
-
-      aPresentation->ResetDisplayPriority();
+      if (aGroup->IsGroupPrimitivesAspectSet (Graphic3d_ASPECT_FILL_AREA))
+      {
+        aGroup->SetGroupPrimitivesAspect (anAreaAsp);
+      }
+      aPrs->ResetDisplayPriority();
     }
   }
-  myRecomputeEveryPrs =Standard_False; // no mode to recalculate :only viewer update
+  myRecomputeEveryPrs = Standard_False; // no mode to recalculate :only viewer update
   myToRecomputeModes.Clear();
 }
 
diff --git a/src/AIS/FILES b/src/AIS/FILES
index f19a8a5a14..9b7b40d1f5 100755
--- a/src/AIS/FILES
+++ b/src/AIS/FILES
@@ -5,6 +5,8 @@ AIS_LocalContext_1.cxx
 AIS_NListTransient.hxx
 AIS_NListIteratorOfListTransient.hxx
 AIS_NDataMapOfTransientIteratorOfListTransient.hxx
+AIS_ColoredShape.hxx
+AIS_ColoredShape.cxx
 AIS_TexturedShape.hxx
 AIS_TexturedShape.cxx
 AIS_Triangulation.cdl
diff --git a/src/Graphic3d/Graphic3d_MaterialAspect.cdl b/src/Graphic3d/Graphic3d_MaterialAspect.cdl
index 5d0bf8b087..ba71d0c26a 100644
--- a/src/Graphic3d/Graphic3d_MaterialAspect.cdl
+++ b/src/Graphic3d/Graphic3d_MaterialAspect.cdl
@@ -392,6 +392,12 @@ is
         --  Trigger: when <aRank> is < 1 or > NumberOfMaterials.
         ---Level: Public
 
+        MaterialFromName (myclass;
+                          theName : CString from Standard)
+        returns NameOfMaterial from Graphic3d;
+        ---Purpose:
+        -- Returns the material for specified name or Graphic3d_NOM_DEFAULT if name is unknown.
+
         ----------------------------
         -- Category: Private methods
         ----------------------------
diff --git a/src/Graphic3d/Graphic3d_MaterialAspect.cxx b/src/Graphic3d/Graphic3d_MaterialAspect.cxx
index e5c95cce2d..76f5543abb 100644
--- a/src/Graphic3d/Graphic3d_MaterialAspect.cxx
+++ b/src/Graphic3d/Graphic3d_MaterialAspect.cxx
@@ -900,6 +900,48 @@ Standard_CString Graphic3d_MaterialAspect::MaterialName(const Standard_Integer a
   return theMaterials[aRank-1].name;
 }
 
+Graphic3d_NameOfMaterial Graphic3d_MaterialAspect::MaterialFromName (const Standard_CString theName)
+{
+  TCollection_AsciiString aName (theName);
+  aName.LowerCase();
+  aName.Capitalize();
+  const Standard_Integer aNbMaterials = Graphic3d_MaterialAspect::NumberOfMaterials();
+  for (Standard_Integer aMatIter = 1; aMatIter <= aNbMaterials; ++aMatIter)
+  {
+    if (aName == Graphic3d_MaterialAspect::MaterialName (aMatIter))
+    {
+      return Graphic3d_NameOfMaterial(aMatIter - 1);
+    }
+  }
+
+  // parse aliases
+  if (aName == "Plastic")            // Plastified
+  {
+    return Graphic3d_NOM_PLASTIC;
+  }
+  else if (aName == "Shiny_plastic") // Shiny_plastified
+  {
+    return Graphic3d_NOM_SHINY_PLASTIC;
+  }
+  else if (aName == "Plaster")       // Plastered
+  {
+    return Graphic3d_NOM_PLASTER;
+  }
+  else if (aName == "Satin")         // Satined
+  {
+    return Graphic3d_NOM_SATIN;
+  }
+  else if (aName == "Neon_gnc")      // Ionized
+  {
+    return Graphic3d_NOM_NEON_GNC;
+  }
+  else if (aName == "Neon_phc") // Neon
+  {
+    return Graphic3d_NOM_NEON_PHC;
+  }
+  return Graphic3d_NOM_DEFAULT;
+}
+
 Graphic3d_TypeOfMaterial Graphic3d_MaterialAspect::MaterialType(const Standard_Integer aRank) {
 
   if( aRank < 1 || aRank > NumberOfMaterials() )
diff --git a/src/NCollection/NCollection_IndexedDataMap.hxx b/src/NCollection/NCollection_IndexedDataMap.hxx
index de26082814..806d810528 100644
--- a/src/NCollection/NCollection_IndexedDataMap.hxx
+++ b/src/NCollection/NCollection_IndexedDataMap.hxx
@@ -104,15 +104,18 @@ template < class TheKeyType,
       myMap(NULL),
       myIndex(0) {}
     //! Constructor
-    Iterator (const NCollection_IndexedDataMap& theMap) :
-      myMap((NCollection_IndexedDataMap *) &theMap),
-      myIndex(1) {}
+    Iterator (const NCollection_IndexedDataMap& theMap)
+    : myMap  ((NCollection_IndexedDataMap* )&theMap),
+      myNode (myMap->nodeFromIndex (1)),
+      myIndex (1) {}
     //! Query if the end of collection is reached by iterator
     virtual Standard_Boolean More(void) const
     { return (myIndex <= myMap->Extent()); }
     //! Make a step along the collection
     virtual void Next(void)
-    { myIndex++; }
+    {
+      myNode = myMap->nodeFromIndex (++myIndex);
+    }
     //! Value access
     virtual const TheItemType& Value(void) const
     {  
@@ -120,7 +123,7 @@ template < class TheKeyType,
       if (!More())
         Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::Value");
 #endif
-      return myMap->FindFromIndex(myIndex);
+      return myNode->Value();
     }
     //! ChangeValue access
     virtual TheItemType& ChangeValue(void) const
@@ -129,12 +132,21 @@ template < class TheKeyType,
       if (!More())
         Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::Iterator::ChangeValue");
 #endif
-      return myMap->ChangeFromIndex(myIndex);
+      return myNode->ChangeValue();
+    }
+    //! Key
+    const TheKeyType& Key() const
+    {
+#if !defined No_Exception && !defined No_Standard_NoSuchObject
+      if (!More())
+        Standard_NoSuchObject::Raise("NCollection_DataMap::Iterator::Key");
+#endif
+      return myNode->Key1();
     }
-    
   private:
-    NCollection_IndexedDataMap * myMap;   //!< Pointer to the map being iterated
-    Standard_Integer             myIndex; //!< Current index
+    NCollection_IndexedDataMap* myMap;   //!< Pointer to the map being iterated
+    IndexedDataMapNode*         myNode;  //!< Current node
+    Standard_Integer            myIndex; //!< Current index
   };
   
  public:
@@ -365,16 +377,12 @@ template < class TheKeyType,
     if (theKey2 < 1 || theKey2 > Extent())
       Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindKey");
 #endif
-    IndexedDataMapNode * pNode2 =
-      (IndexedDataMapNode *) myData2[::HashCode(theKey2,NbBuckets())];
-    while (pNode2)
+    IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
+    if (aNode == NULL)
     {
-      if (pNode2->Key2() == theKey2)
-        return pNode2->Key1();
-      pNode2 = (IndexedDataMapNode*) pNode2->Next2();
+      Standard_NoSuchObject::Raise ("NCollection_IndexedDataMap::FindKey");
     }
-    Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::FindKey");
-    return pNode2->Key1(); // This for compiler
+    return aNode->Key1();
   }
 
   //! FindFromIndex
@@ -384,16 +392,12 @@ template < class TheKeyType,
     if (theKey2 < 1 || theKey2 > Extent())
       Standard_OutOfRange::Raise ("NCollection_IndexedDataMap::FindFromIndex");
 #endif
-    IndexedDataMapNode * pNode2 =
-      (IndexedDataMapNode *) myData2[::HashCode(theKey2,NbBuckets())];
-    while (pNode2)
+    IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
+    if (aNode == NULL)
     {
-      if (pNode2->Key2() == theKey2)
-        return pNode2->Value();
-      pNode2 = (IndexedDataMapNode*) pNode2->Next2();
+      Standard_NoSuchObject::Raise ("NCollection_IndexedDataMap::FindFromIndex");
     }
-    Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::FindFromIndex");
-    return pNode2->Value(); // This for compiler
+    return aNode->Value();
   }
 
   //! operator ()
@@ -407,16 +411,12 @@ template < class TheKeyType,
     if (theKey2 < 1 || theKey2 > Extent())
       Standard_OutOfRange::Raise("NCollection_IndexedDataMap::ChangeFromIndex");
 #endif
-    IndexedDataMapNode * pNode2 =
-      (IndexedDataMapNode *) myData2[::HashCode(theKey2,NbBuckets())];
-    while (pNode2)
+    IndexedDataMapNode* aNode = nodeFromIndex (theKey2);
+    if (aNode == NULL)
     {
-      if (pNode2->Key2() == theKey2)
-        return pNode2->ChangeValue();
-      pNode2 = (IndexedDataMapNode*) pNode2->Next2();
+      Standard_NoSuchObject::Raise ("NCollection_IndexedDataMap::ChangeFromIndex");
     }
-    Standard_NoSuchObject::Raise("NCollection_IndexedDataMap::FindFromIndex");
-    return pNode2->ChangeValue(); // This for compiler
+    return aNode->ChangeValue();
   }
 
   //! operator ()
@@ -476,6 +476,27 @@ template < class TheKeyType,
     return pNode1->ChangeValue();
   }
 
+  //! Find value for key with copying.
+  //! @return true if key was found
+  Standard_Boolean FindFromKey (const TheKeyType& theKey1,
+                                TheItemType&      theValue) const
+  {
+    if (IsEmpty())
+    {
+      return Standard_False;
+    }
+    for (IndexedDataMapNode* aNode = (IndexedDataMapNode* )myData1[Hasher::HashCode (theKey1, NbBuckets())];
+         aNode != NULL; aNode = (IndexedDataMapNode* )aNode->Next())
+    {
+      if (Hasher::IsEqual (aNode->Key1(), theKey1))
+      {
+        theValue = aNode->Value();
+        return Standard_True;
+      }
+    }
+    return Standard_False;
+  }
+
   //! Clear data. If doReleaseMemory is false then the table of
   //! buckets is not released and will be reused.
   void Clear(const Standard_Boolean doReleaseMemory = Standard_True)
@@ -505,6 +526,25 @@ template < class TheKeyType,
     CreateIterator(void) const
   { return *(new (this->IterAllocator()) Iterator(*this)); }
 
+  //! Find map node associated with specified index.
+  //! Return NULL if not found (exception-free internal implementation).
+  IndexedDataMapNode* nodeFromIndex (const Standard_Integer theKey2) const
+  {
+    if (Extent() == 0)
+    {
+      return NULL;
+    }
+    for (IndexedDataMapNode* aNode = (IndexedDataMapNode* )myData2[::HashCode (theKey2, NbBuckets())];
+         aNode != NULL; aNode = (IndexedDataMapNode* )aNode->Next2())
+    {
+      if (aNode->Key2() == theKey2)
+      {
+        return aNode;
+      }
+    }
+    return NULL;
+  }
+
 };
 
 #endif
diff --git a/src/OpenGl/OpenGl_AspectMarker.cxx b/src/OpenGl/OpenGl_AspectMarker.cxx
index 65d234251f..b294421971 100644
--- a/src/OpenGl/OpenGl_AspectMarker.cxx
+++ b/src/OpenGl/OpenGl_AspectMarker.cxx
@@ -1462,13 +1462,13 @@ OpenGl_AspectMarker::OpenGl_AspectMarker()
 // =======================================================================
 void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect)
 {
-  myColor.rgb[0] = (float )theAspect.Color.r;
-  myColor.rgb[1] = (float )theAspect.Color.g;
-  myColor.rgb[2] = (float )theAspect.Color.b;
-  myColor.rgb[3] = 1.0f;
-  myMarkerImage  = theAspect.MarkerImage;
-  myType         = theAspect.MarkerType;
-  myScale = myMarkerSize = theAspect.Scale;
+  myColor.rgb[0]  = (float )theAspect.Color.r;
+  myColor.rgb[1]  = (float )theAspect.Color.g;
+  myColor.rgb[2]  = (float )theAspect.Color.b;
+  myColor.rgb[3]  = 1.0f;
+  myMarkerImage   = theAspect.MarkerImage;
+  myType          = theAspect.MarkerType;
+  myScale         = theAspect.Scale;
   myShaderProgram = theAspect.ShaderProgram;
 
   // update sprite resource bindings
@@ -1476,13 +1476,11 @@ void OpenGl_AspectMarker::SetAspect (const CALL_DEF_CONTEXTMARKER& theAspect)
   TCollection_AsciiString aSpriteAKey = THE_EMPTY_KEY;
   myResources.SpriteKeys (myMarkerImage, myType, myScale, myColor, aSpriteKey, aSpriteAKey);
 
-  if (aSpriteKey.IsEmpty() || myResources.SpriteKey != aSpriteKey)
-  {
-    myResources.ResetSpriteReadiness();
-  }
-  if (aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey)
+  if (aSpriteKey.IsEmpty()  || myResources.SpriteKey  != aSpriteKey
+   || aSpriteAKey.IsEmpty() || myResources.SpriteAKey != aSpriteAKey)
   {
     myResources.ResetSpriteReadiness();
+    myMarkerSize = theAspect.Scale;
   }
 
   // update shader program resource bindings
diff --git a/src/StdPrs/StdPrs_ShadedShape.cdl b/src/StdPrs/StdPrs_ShadedShape.cdl
index 747904a526..c36c2cde5e 100755
--- a/src/StdPrs/StdPrs_ShadedShape.cdl
+++ b/src/StdPrs/StdPrs_ShadedShape.cdl
@@ -44,4 +44,9 @@ is
        theUVScale      : Pnt2d        from gp);
   ---Purpose: Shades <theShape> with texture coordinates.
 
+  Tessellate (myclass;
+              theShape  : Shape  from TopoDS;
+              theDrawer : Drawer from Prs3d);
+  ---Purpose: Validates triangulation within the shape and performs tessellation if necessary.
+
 end ShadedShape;
diff --git a/src/StdPrs/StdPrs_ShadedShape.cxx b/src/StdPrs/StdPrs_ShadedShape.cxx
index bc86ff93d0..4600dd9808 100644
--- a/src/StdPrs/StdPrs_ShadedShape.cxx
+++ b/src/StdPrs/StdPrs_ShadedShape.cxx
@@ -358,6 +358,32 @@ void StdPrs_ShadedShape::Add (const Handle(Prs3d_Presentation)& thePresentation,
                            Standard_False, aDummy, aDummy, aDummy);
 }
 
+// =======================================================================
+// function : Tessellate
+// purpose  :
+// =======================================================================
+void StdPrs_ShadedShape::Tessellate (const TopoDS_Shape&          theShape,
+                                     const Handle (Prs3d_Drawer)& theDrawer)
+{
+  // Check if it is possible to avoid unnecessary recomputation
+  // of shape triangulation
+  Standard_Real aDeflection = GetDeflection (theShape, theDrawer);
+  if (BRepTools::Triangulation (theShape, aDeflection))
+  {
+    return;
+  }
+
+  // retrieve meshing tool from Factory
+  BRepTools::Clean (theShape);
+  Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape,
+                                                                                   aDeflection,
+                                                                                   theDrawer->HLRAngle());
+  if (!aMeshAlgo.IsNull())
+  {
+    aMeshAlgo->Perform();
+  }
+}
+
 // =======================================================================
 // function : Add
 // purpose  :
@@ -408,22 +434,8 @@ void StdPrs_ShadedShape::Add (const Handle (Prs3d_Presentation)& thePresentation
       StdPrs_WFShape::Add (thePresentation, theShape, theDrawer);
     }
   }
-  Standard_Real aDeflection = GetDeflection (theShape, theDrawer);
-
-  // Check if it is possible to avoid unnecessary recomputation
-  // of shape triangulation
-  if (!BRepTools::Triangulation (theShape, aDeflection))
-  {
-    BRepTools::Clean (theShape);
-
-    // retrieve meshing tool from Factory
-    Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape,
-                                                                                     aDeflection,
-                                                                                     theDrawer->HLRAngle());
-    if (!aMeshAlgo.IsNull())
-      aMeshAlgo->Perform();
-  }
 
+  Tessellate (theShape, theDrawer);
   ShadeFromShape (theShape, thePresentation, theDrawer,
                   theHasTexels, theUVOrigin, theUVRepeat, theUVScale);
 
diff --git a/src/ViewerTest/ViewerTest.cxx b/src/ViewerTest/ViewerTest.cxx
index 6bd670d57f..3c8de425fe 100644
--- a/src/ViewerTest/ViewerTest.cxx
+++ b/src/ViewerTest/ViewerTest.cxx
@@ -37,7 +37,7 @@
 #include <StdSelect_ShapeTypeFilter.hxx>
 #include <AIS.hxx>
 #include <AIS_Drawer.hxx>
-#include <AIS_InteractiveObject.hxx>
+#include <AIS_ColoredShape.hxx>
 #include <AIS_Trihedron.hxx>
 #include <AIS_Axis.hxx>
 #include <AIS_Relation.hxx>
@@ -105,38 +105,6 @@ Quantity_NameOfColor ViewerTest::GetColorFromName (const Standard_CString theNam
   return DEFAULT_COLOR;
 }
 
-//=======================================================================
-//function : GetMaterialFromName
-//purpose  : get the Graphic3d_NameOfMaterial from a string
-//=======================================================================
-
-static Graphic3d_NameOfMaterial GetMaterialFromName( const char *name )
-{
-  Graphic3d_NameOfMaterial mat = DEFAULT_MATERIAL;
-
-  if      ( !strcasecmp(name,"BRASS" ) ) 	 mat = Graphic3d_NOM_BRASS;
-  else if ( !strcasecmp(name,"BRONZE" ) )        mat = Graphic3d_NOM_BRONZE;
-  else if ( !strcasecmp(name,"COPPER" ) ) 	 mat = Graphic3d_NOM_COPPER;
-  else if ( !strcasecmp(name,"GOLD" ) ) 	 mat = Graphic3d_NOM_GOLD;
-  else if ( !strcasecmp(name,"PEWTER" ) ) 	 mat = Graphic3d_NOM_PEWTER;
-  else if ( !strcasecmp(name,"SILVER" ) ) 	 mat = Graphic3d_NOM_SILVER;
-  else if ( !strcasecmp(name,"STEEL" ) ) 	 mat = Graphic3d_NOM_STEEL;
-  else if ( !strcasecmp(name,"METALIZED" ) ) 	 mat = Graphic3d_NOM_METALIZED;
-  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,"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;
-  else if ( !strcasecmp(name,"SHINY_PLASTIC" ) ) mat = Graphic3d_NOM_SHINY_PLASTIC;
-  else if ( !strcasecmp(name,"SATIN" ) )	 mat = Graphic3d_NOM_SATIN;
-  else if ( !strcasecmp(name,"PLASTIC" ) )	 mat = Graphic3d_NOM_PLASTIC;
-  else if ( !strcasecmp(name,"OBSIDIAN" ) )	 mat = Graphic3d_NOM_OBSIDIAN;
-  else if ( !strcasecmp(name,"JADE" ) )	         mat = Graphic3d_NOM_JADE;
-
-  return mat;
-}
-
 //=======================================================================
 //function : GetTypeNames
 //purpose  :
@@ -1013,495 +981,742 @@ static int VSubInt(Draw_Interpretor& di, Standard_Integer argc, const char** arg
     else return 1;
   }
   return 0;
-
-}
-//==============================================================================
-//function : VColor2
-//Author   : ege
-//purpose  : change the color of a selected or named or displayed shape
-//Draw arg : vcolor2 [name] color
-//==============================================================================
-static int VColor2 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-
-  Standard_Boolean    ThereIsCurrent;
-  Standard_Boolean    ThereIsArgument;
-  Standard_Boolean    IsBound = Standard_False ;
-
-  const Standard_Boolean HaveToSet=(strcasecmp( argv[0],"vsetcolor") == 0);
-  if (HaveToSet) {
-    if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error: Give 2 or 3 arguments" << "\n"; return 1; }
-    ThereIsArgument = (argc != 2);
-  }
-  else {
-    if ( argc > 2 ) { di << argv[0] << " syntax error: Given too many arguments" << "\n"; return 1; }
-    ThereIsArgument = (argc == 2);
-  }
-
-  if ( !a3DView().IsNull() ) {
-    TCollection_AsciiString name;
-    if (ThereIsArgument) {
-      name = argv[1];
-      IsBound= GetMapOfAIS().IsBound2(name);
-    }
-    if (TheAISContext()->HasOpenedContext())
-      TheAISContext()->CloseLocalContext();
-
-    //  On set le Booleen There is current
-    if (TheAISContext() -> NbCurrents() > 0  ) {ThereIsCurrent =Standard_True; }
-    else ThereIsCurrent =Standard_False;
-
-    //=======================================================================
-    // Il y a un  argument
-    //=======================================================================
-    if ( ThereIsArgument && IsBound ) {
-      const Handle(Standard_Transient) anObj = GetMapOfAIS().Find2(name);
-      if (anObj->IsKind(STANDARD_TYPE(AIS_InteractiveObject))) {
-        Handle(AIS_InteractiveObject) ashape =
-          Handle(AIS_InteractiveObject)::DownCast (anObj);
-#ifdef DEB
-          if (HaveToSet)
-            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,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 (ViewerTest::GetColorFromName(argv[2]));
-      }
-    }
-
-
-    //=======================================================================
-    // Il n'y a pas d'arguments
-    // Mais un ou plusieurs objets on des current representation
-    //=======================================================================
-    if (ThereIsCurrent && !ThereIsArgument) {
-      for (TheAISContext() -> InitCurrent() ;
-           TheAISContext() -> MoreCurrent() ;
-           TheAISContext() ->NextCurrent() )
-      {
-        const Handle(AIS_InteractiveObject) ashape= TheAISContext()->Current();
-        if (ashape.IsNull())
-          continue;
-#ifdef DEB
-        if (HaveToSet)
-          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,ViewerTest::GetColorFromName(argv[1]),Standard_False);
-        else
-          TheAISContext()->UnsetColor(ashape,Standard_False);
-      }
-
-      TheAISContext()->UpdateCurrentViewer();
-    }
-
-    //=======================================================================
-    // Il n'y a pas d'arguments(nom de shape) ET aucun objet courrant
-    // on impose a tous les objets du viewer la couleur passee
-    //=======================================================================
-    else if (!ThereIsCurrent && !ThereIsArgument){
-      ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName it(GetMapOfAIS());
-      while ( it.More() ) {
-        const Handle(AIS_InteractiveObject) ashape =
-          Handle(AIS_InteractiveObject)::DownCast(it.Key1());
-        if (!ashape.IsNull()) {
-          if(HaveToSet)
-            TheAISContext()->SetColor(ashape,ViewerTest::GetColorFromName(argv[1]),Standard_False);
-          else
-            TheAISContext()->UnsetColor(ashape,Standard_False);
-        }
-        it.Next();
-      }
-      TheAISContext()->UpdateCurrentViewer();
-    }
-  }
-  return 0;
 }
 
-//==============================================================================
-//function : VTransparency
-//Author   : ege
-//purpose  : change the transparency of a selected or named or displayed shape
-//Draw arg : vtransparency [name] TransparencyCoeficient
-//==============================================================================
-
-static int VTransparency  (Draw_Interpretor& di, Standard_Integer argc,
-                           const char** argv)
+//! Auxiliary class to iterate presentations from different collections.
+class ViewTest_PrsIter
 {
-  Standard_Boolean    ThereIsCurrent;
-  Standard_Boolean    ThereIsArgument;
-  Standard_Boolean    IsBound = Standard_False ;
+public:
 
-  const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsettransparency") == 0);
-  if (HaveToSet) {
-    if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
-    ThereIsArgument = (argc != 2);
-  }
-  else{
-    if ( argc > 2 ) { di << argv[0] << " syntax error: Passez au plus un argument" << "\n"; return 1; }
-    ThereIsArgument = (argc == 2);
+  //! Create and initialize iterator object.
+  ViewTest_PrsIter (const TCollection_AsciiString& theName)
+  : mySource (IterSource_All)
+  {
+    NCollection_Sequence<TCollection_AsciiString> aNames;
+    if (!theName.IsEmpty())
+    aNames.Append (theName);
+    Init (aNames);
   }
 
-  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;
-
-    //=======================================================================
-    // Il y a des arguments: un nom et une couleur
-    //=======================================================================
-    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(anObj);
-        if(HaveToSet)
-          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(Draw::Atof(argv[2]) );
-        else
-          ashape->UnsetTransparency();
-      }
-    }
-    //=======================================================================
-    // Il n'y a pas d'arguments
-    // Mais un ou plusieurs objets on des current representation
-    //=======================================================================
-    if (ThereIsCurrent && !ThereIsArgument) {
-      for (TheAISContext() -> InitCurrent() ;
-           TheAISContext() -> MoreCurrent() ;
-           TheAISContext() ->NextCurrent() )
-      {
-        Handle(AIS_InteractiveObject) ashape =  TheAISContext() -> Current();
-        if(HaveToSet)
-          TheAISContext()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False);
-        else
-          TheAISContext()->UnsetTransparency(ashape,Standard_False);
-      }
-
-      TheAISContext()->UpdateCurrentViewer();
-    }
-    //=======================================================================
-    // Il n'y a pas d'arguments ET aucun objet courrant
-    //=======================================================================
-    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()->SetTransparency(ashape,Draw::Atof(argv[1]),Standard_False);
-          else
-            TheAISContext()->UnsetTransparency(ashape,Standard_False);
-        }
-        it.Next();
-      }
-      TheAISContext()->UpdateCurrentViewer();
-    }
-  }
-  return 0;
-}
-
-
-//==============================================================================
-//function : VMaterial
-//Author   : ege
-//purpose  : change the Material of a selected or named or displayed shape
-//Draw arg : vmaterial  [Name] Material
-//==============================================================================
-static int VMaterial (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-
-  Standard_Boolean    ThereIsCurrent;
-  Standard_Boolean    ThereIsName;
-  Standard_Boolean    IsBound = Standard_False ;
-
-  const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsetmaterial") == 0);
-  if (HaveToSet) {
-    if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
-    ThereIsName = (argc != 2);
-  }
-  else {
-    if ( argc>2 ) { di << argv[0] << " syntax error passez au plus un argument" << "\n"; return 1; }
-    ThereIsName = (argc == 2);
+  //! Create and initialize iterator object.
+  ViewTest_PrsIter (const NCollection_Sequence<TCollection_AsciiString>& theNames)
+  : mySource (IterSource_All)
+  {
+    Init (theNames);
   }
 
-  if ( !a3DView().IsNull() ) {
-    TCollection_AsciiString name;
-    if (ThereIsName) {
-      name = argv[1];
-      IsBound= GetMapOfAIS().IsBound2(name);
+  //! Initialize the iterator.
+  void Init (const NCollection_Sequence<TCollection_AsciiString>& theNames)
+  {
+    Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
+    mySeq = theNames;
+    mySelIter.Nullify();
+    myCurrent.Nullify();
+    myCurrentTrs.Nullify();
+    if (!mySeq.IsEmpty())
+    {
+      mySource = IterSource_List;
+      mySeqIter = NCollection_Sequence<TCollection_AsciiString>::Iterator (mySeq);
+    }
+    else if (aCtx->NbCurrents() > 0)
+    {
+      mySource  = IterSource_Selected;
+      mySelIter = aCtx;
+      mySelIter->InitCurrent();
     }
-    if (TheAISContext()->HasOpenedContext())
-      TheAISContext()->CloseLocalContext();
-    if (TheAISContext() -> NbCurrents() > 0  )
-      ThereIsCurrent =Standard_True;
     else
-      ThereIsCurrent =Standard_False;
-
-    //=======================================================================
-    // Ther is a name of shape and a material name
-    //=======================================================================
-    if ( ThereIsName && IsBound ) {
-      Handle(AIS_InteractiveObject) ashape =
-        Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2(name));
-      if (!ashape.IsNull()) {
-        if (HaveToSet)
-          TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[2]));
-        else
-          TheAISContext()->UnsetMaterial(ashape);
-      }
+    {
+      mySource = IterSource_All;
+      myMapIter.Initialize (GetMapOfAIS());
     }
-    //=======================================================================
-    // Il n'y a pas de nom de shape
-    // Mais un ou plusieurs objets on des current representation
-    //=======================================================================
-    if (ThereIsCurrent && !ThereIsName) {
-      for (TheAISContext() -> InitCurrent() ;
-           TheAISContext() -> MoreCurrent() ;
-           TheAISContext() ->NextCurrent() )
+    initCurrent();
+  }
+
+  const TCollection_AsciiString& CurrentName() const
+  {
+    return myCurrentName;
+  }
+
+  const Handle(AIS_InteractiveObject)& Current() const
+  {
+    return myCurrent;
+  }
+
+  const Handle(Standard_Transient)& CurrentTrs() const
+  {
+    return myCurrentTrs;
+  }
+
+  //! @return true if iterator points to valid object within collection
+  Standard_Boolean More() const
+  {
+    switch (mySource)
+    {
+      case IterSource_All:      return myMapIter.More();
+      case IterSource_List:     return mySeqIter.More();
+      case IterSource_Selected: return mySelIter->MoreCurrent();
+    }
+    return Standard_False;
+  }
+
+  //! Go to the next item.
+  void Next()
+  {
+    myCurrentName.Clear();
+    myCurrentTrs.Nullify();
+    myCurrent.Nullify();
+    switch (mySource)
+    {
+      case IterSource_All:
       {
-        Handle(AIS_InteractiveObject) ashape = TheAISContext()->Current();
-        if (HaveToSet)
-          TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),Standard_False);
-        else
-          TheAISContext()->UnsetMaterial(ashape,Standard_False);
+        myMapIter.Next();
+        break;
       }
-      TheAISContext()->UpdateCurrentViewer();
-    }
-
-    //=======================================================================
-    // Il n'y a pas de noms de shape ET aucun objet courrant
-    // On impose a tous les objets du viewer le material passe en argument
-    //=======================================================================
-    else if (!ThereIsCurrent && !ThereIsName){
-      ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName
-        it(GetMapOfAIS());
-      while ( it.More() ) {
-        Handle(AIS_InteractiveObject) ashape =
-          Handle(AIS_InteractiveObject)::DownCast (it.Key1());
-        if (!ashape.IsNull()) {
-          if (HaveToSet)
-            TheAISContext()->SetMaterial(ashape,GetMaterialFromName(argv[1]),Standard_False);
-          else
-            TheAISContext()->UnsetMaterial(ashape,Standard_False);
-        }
-        it.Next();
-      }
-      TheAISContext()->UpdateCurrentViewer();
-    }
-  }
-  return 0;
-}
-
-
-
-//==============================================================================
-//function : VWidth
-//Author   : ege
-//purpose  : change the width of the edges of a selected or named or displayed shape
-//Draw arg : vwidth  [Name] WidthValue(1->10)
-//==============================================================================
-static int VWidth (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
-{
-
-  Standard_Boolean    ThereIsCurrent;
-  Standard_Boolean    ThereIsArgument;
-  Standard_Boolean    IsBound = Standard_False ;
-
-  const Standard_Boolean HaveToSet = (strcasecmp( argv[0],"vsetwidth") == 0);
-  if (HaveToSet) {
-    if ( argc < 2 || argc > 3 ) { di << argv[0] << " syntax error passez 1 ou 2 arguments" << "\n"; return 1; }
-    ThereIsArgument = (argc != 2);
-  }
-  else {
-    if ( argc>2 ) { di << argv[0] << " syntax error passez au plus 1  argument" << "\n"; return 1; }
-    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));
-        if (HaveToSet)
-          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 ( Draw::Atof (argv[2]) );
-      }
-    }
-
-    //=======================================================================
-    // Il n'y a pas d'arguments
-    // Mais un ou plusieurs objets on des current representation
-    //=======================================================================
-    if (ThereIsCurrent && !ThereIsArgument) {
-      for (TheAISContext() -> InitCurrent() ;
-           TheAISContext() -> MoreCurrent() ;
-           TheAISContext() ->NextCurrent() )
+      case IterSource_List:
       {
-        Handle(AIS_InteractiveObject) ashape =  TheAISContext() -> Current();
-        if (HaveToSet)
-          TheAISContext()->SetWidth(ashape,Draw::Atof(argv[1]),Standard_False);
-        else
-          TheAISContext()->UnsetWidth(ashape,Standard_False);
+        mySeqIter.Next();
+        break;
+      }
+      case IterSource_Selected:
+      {
+        mySelIter->NextCurrent();
+        break;
       }
-      TheAISContext()->UpdateCurrentViewer();
     }
-    //=======================================================================
-    // Il n'y a pas d'arguments ET aucun objet courrant
-    //=======================================================================
-    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,Draw::Atof(argv[1]),Standard_False);
-          else
-            TheAISContext()->UnsetWidth(ashape,Standard_False);
-        }
-        it.Next();
-     }
-     TheAISContext()->UpdateCurrentViewer();
-   }
+    initCurrent();
   }
-  return 0;
-}
+
+private:
+
+  void initCurrent()
+  {
+    switch (mySource)
+    {
+      case IterSource_All:
+      {
+        if (myMapIter.More())
+        {
+          myCurrentName = myMapIter.Key2();
+          myCurrentTrs  = myMapIter.Key1();
+          myCurrent     = Handle(AIS_InteractiveObject)::DownCast (myCurrentTrs);
+        }
+        break;
+      }
+      case IterSource_List:
+      {
+        if (mySeqIter.More())
+        {
+          if (!GetMapOfAIS().IsBound2 (mySeqIter.Value()))
+          {
+            std::cout << "Error: object " << mySeqIter.Value() << " is not displayed!\n";
+            return;
+          }
+          myCurrentName = mySeqIter.Value();
+          myCurrentTrs  = GetMapOfAIS().Find2 (mySeqIter.Value());
+          myCurrent     = Handle(AIS_InteractiveObject)::DownCast (myCurrentTrs);
+        }
+        break;
+      }
+      case IterSource_Selected:
+      {
+        if (mySelIter->MoreCurrent())
+        {
+          myCurrentName = GetMapOfAIS().Find1 (mySelIter->Current());
+          myCurrent     = mySelIter->Current();
+        }
+        break;
+      }
+    }
+  }
+
+private:
+
+  enum IterSource
+  {
+    IterSource_All,
+    IterSource_List,
+    IterSource_Selected
+  };
+
+private:
+
+  Handle(AIS_InteractiveContext) mySelIter;    //!< iterator for current (selected) objects (IterSource_Selected)
+  ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName myMapIter; //!< iterator for map of all objects (IterSource_All)
+  NCollection_Sequence<TCollection_AsciiString>           mySeq;
+  NCollection_Sequence<TCollection_AsciiString>::Iterator mySeqIter;
+
+  TCollection_AsciiString        myCurrentName;//!< current item name
+  Handle(Standard_Transient)     myCurrentTrs; //!< current item (as transient object)
+  Handle(AIS_InteractiveObject)  myCurrent;    //!< current item
+
+  IterSource                     mySource;     //!< iterated collection
+
+};
 
 //==============================================================================
 //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)
+static int VSetInteriorStyle (Draw_Interpretor& /*theDI*/,
+                              Standard_Integer  theArgNb,
+                              const char**      theArgVec)
 {
-  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";
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cerr << "Error: no active view!\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();
+  Standard_Integer anArgIter = 1;
+  TCollection_AsciiString aName;
+  if (theArgNb - anArgIter == 2)
+  {
+    aName = theArgVec[anArgIter++];
   }
+  else if (theArgNb - anArgIter != 1)
+  {
+    std::cout << "Error: wrong number of arguments!\n";
+    return 1;
+  }
+  Standard_Integer        anInterStyle = Aspect_IS_SOLID;
+  TCollection_AsciiString aStyleArg (theArgVec[anArgIter++]);
+  aStyleArg.LowerCase();
+  if (aStyleArg == "empty")
+  {
+    anInterStyle = 0;
+  }
+  else if (aStyleArg == "hollow")
+  {
+    anInterStyle = 1;
+  }
+  else if (aStyleArg == "hatch")
+  {
+    anInterStyle = 2;
+  }
+  else if (aStyleArg == "solid")
+  {
+    anInterStyle = 3;
+  }
+  else if (aStyleArg == "hiddenline")
+  {
+    anInterStyle = 4;
+  }
+  else
+  {
+    anInterStyle = aStyleArg.IntegerValue();
+  }
+  if (anInterStyle < Aspect_IS_EMPTY
+   || anInterStyle > Aspect_IS_HIDDENLINE)
+  {
+    std::cout << "Error: style must be within a range [0 (Aspect_IS_EMPTY), "
+              << Aspect_IS_HIDDENLINE << " (Aspect_IS_HIDDENLINE)]\n";
+    return 1;
+  }
+
+  if (!aName.IsEmpty()
+   && !GetMapOfAIS().IsBound2 (aName))
+  {
+    std::cout << "Error: object " << aName << " is not displayed!\n";
+    return 1;
+  }
+
+  if (aCtx->HasOpenedContext())
+  {
+    aCtx->CloseLocalContext();
+  }
+  for (ViewTest_PrsIter anIter (aName); anIter.More(); anIter.Next())
+  {
+    const Handle(AIS_InteractiveObject)& anIO = anIter.Current();
+    if (!anIO.IsNull())
+    {
+      const Handle(Prs3d_Drawer)& aDrawer        = anIO->Attributes();
+      Handle(Prs3d_ShadingAspect) aShadingAspect = aDrawer->ShadingAspect();
+      Handle(Graphic3d_AspectFillArea3d) aFillAspect = aShadingAspect->Aspect();
+      aFillAspect->SetInteriorStyle ((Aspect_InteriorStyle )anInterStyle);
+      aCtx->RecomputePrsOnly (anIO, Standard_False, Standard_True);
+    }
+  }
+
+  // update the screen and redraw the view
+  TheAISContext()->UpdateCurrentViewer();
+  return 0;
+}
+
+//! Auxiliary structure for VAspects
+struct ViewerTest_AspectsChangeSet
+{
+  Standard_Integer         ToSetColor;
+  Quantity_Color           Color;
+
+  Standard_Integer         ToSetLineWidth;
+  Standard_Real            LineWidth;
+
+  Standard_Integer         ToSetTransparency;
+  Standard_Real            Transparency;
+
+  Standard_Integer         ToSetMaterial;
+  Graphic3d_NameOfMaterial Material;
+  TCollection_AsciiString  MatName;
+
+  NCollection_Sequence<TopoDS_Shape> SubShapes;
+
+  //! Empty constructor
+  ViewerTest_AspectsChangeSet()
+  : ToSetColor        (0),
+    Color             (DEFAULT_COLOR),
+    ToSetLineWidth    (0),
+    LineWidth         (1.0),
+    ToSetTransparency (0),
+    Transparency      (0.0),
+    ToSetMaterial     (0),
+    Material (Graphic3d_NOM_DEFAULT) {}
+
+  //! @return true if no changes have been requested
+  Standard_Boolean IsEmpty() const
+  {
+    return ToSetLineWidth    == 0
+        && ToSetTransparency == 0
+        && ToSetColor        == 0
+        && ToSetMaterial     == 0;
+  }
+
+  //! @return true if properties are valid
+  Standard_Boolean Validate (const Standard_Boolean theIsSubPart) const
+  {
+    Standard_Boolean isOk = Standard_True;
+    if (LineWidth <= 0.0
+     || LineWidth >  10.0)
+    {
+      std::cout << "Error: the width should be within [1; 10] range (specified " << LineWidth << ")\n";
+      isOk = Standard_False;
+    }
+    if (Transparency < 0.0
+     || Transparency > 1.0)
+    {
+      std::cout << "Error: the transparency should be within [0; 1] range (specified " << Transparency << ")\n";
+      isOk = Standard_False;
+    }
+    if (theIsSubPart
+     && ToSetTransparency)
+    {
+      std::cout << "Error: the transparency can not be defined for sub-part of object!\n";
+      isOk = Standard_False;
+    }
+    if (ToSetMaterial == 1
+     && Material == Graphic3d_NOM_DEFAULT)
+    {
+      std::cout << "Error: unknown material " << MatName << ".\n";
+      isOk = Standard_False;
+    }
+    return isOk;
+  }
+
+};
+
+//==============================================================================
+//function : VAspects
+//purpose  :
+//==============================================================================
+static Standard_Integer VAspects (Draw_Interpretor& /*theDI*/,
+                                  Standard_Integer  theArgNb,
+                                  const char**      theArgVec)
+{
+  TCollection_AsciiString aCmdName (theArgVec[0]);
+  const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+  if (aCtx.IsNull())
+  {
+    std::cerr << "Error: no active view!\n";
+    return 1;
+  }
+
+  Standard_Integer      anArgIter = 1;
+  NCollection_Sequence<TCollection_AsciiString> aNames;
+  for (; anArgIter < theArgNb; ++anArgIter)
+  {
+    TCollection_AsciiString anArg = theArgVec[anArgIter];
+    if (!anArg.IsEmpty()
+      && anArg.Value (1) != '-')
+    {
+      aNames.Append (anArg);
+    }
+    else
+    {
+      break;
+    }
+  }
+
+  NCollection_Sequence<ViewerTest_AspectsChangeSet> aChanges;
+  aChanges.Append (ViewerTest_AspectsChangeSet());
+  ViewerTest_AspectsChangeSet* aChangeSet = &aChanges.ChangeLast();
+
+  // parse syntax of legacy commands
+  if (aCmdName == "vsetwidth")
+  {
+    if (aNames.IsEmpty()
+    || !aNames.Last().IsRealValue())
+    {
+      std::cout << "Error: not enough arguments!\n";
+      return 1;
+    }
+    aChangeSet->ToSetLineWidth = 1;
+    aChangeSet->LineWidth = aNames.Last().RealValue();
+    aNames.Remove (aNames.Length());
+  }
+  else if (aCmdName == "vunsetwidth")
+  {
+    aChangeSet->ToSetLineWidth = -1;
+  }
+  else if (aCmdName == "vsetcolor")
+  {
+    if (aNames.IsEmpty())
+    {
+      std::cout << "Error: not enough arguments!\n";
+      return 1;
+    }
+    aChangeSet->ToSetColor = 1;
+    aChangeSet->Color  = ViewerTest::GetColorFromName (aNames.Last().ToCString());
+    aNames.Remove (aNames.Length());
+  }
+  else if (aCmdName == "vunsetcolor")
+  {
+    aChangeSet->ToSetColor = -1;
+  }
+  else if (aCmdName == "vsettransparency")
+  {
+    if (aNames.IsEmpty()
+    || !aNames.Last().IsRealValue())
+    {
+      std::cout << "Error: not enough arguments!\n";
+      return 1;
+    }
+    aChangeSet->ToSetTransparency = 1;
+    aChangeSet->Transparency  = aNames.Last().RealValue();
+    aNames.Remove (aNames.Length());
+  }
+  else if (aCmdName == "vunsettransparency")
+  {
+    aChangeSet->ToSetTransparency = -1;
+  }
+  else if (aCmdName == "vsetmaterial")
+  {
+    if (aNames.IsEmpty())
+    {
+      std::cout << "Error: not enough arguments!\n";
+      return 1;
+    }
+    aChangeSet->ToSetMaterial = 1;
+    aChangeSet->MatName  = aNames.Last();
+    aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+    aNames.Remove (aNames.Length());
+  }
+  else if (aCmdName == "vunsetmaterial")
+  {
+    aChangeSet->ToSetMaterial = -1;
+  }
+  else if (anArgIter >= theArgNb)
+  {
+    std::cout << "Error: not enough arguments!\n";
+    return 1;
+  }
+
+  if (!aChangeSet->IsEmpty())
+  {
+    anArgIter = theArgNb;
+  }
+  for (; anArgIter < theArgNb; ++anArgIter)
+  {
+    TCollection_AsciiString anArg = theArgVec[anArgIter];
+    anArg.LowerCase();
+    if (anArg == "-setwidth"
+     || anArg == "-setlinewidth")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      aChangeSet->ToSetLineWidth = 1;
+      aChangeSet->LineWidth = Draw::Atof (theArgVec[anArgIter]);
+    }
+    else if (anArg == "-unsetwidth"
+          || anArg == "-unsetlinewidth")
+    {
+      aChangeSet->ToSetLineWidth = -1;
+      aChangeSet->LineWidth = 1.0;
+    }
+    else if (anArg == "-settransp"
+          || anArg == "-settransparancy")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      aChangeSet->ToSetTransparency = 1;
+      aChangeSet->Transparency = Draw::Atof (theArgVec[anArgIter]);
+      if (aChangeSet->Transparency >= 0.0
+       && aChangeSet->Transparency <= Precision::Confusion())
+      {
+        aChangeSet->ToSetTransparency = -1;
+        aChangeSet->Transparency = 0.0;
+      }
+    }
+    else if (anArg == "-setalpha")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      aChangeSet->ToSetTransparency = 1;
+      aChangeSet->Transparency  = Draw::Atof (theArgVec[anArgIter]);
+      if (aChangeSet->Transparency < 0.0
+       || aChangeSet->Transparency > 1.0)
+      {
+        std::cout << "Error: the transparency should be within [0; 1] range (specified " << aChangeSet->Transparency << ")\n";
+        return 1;
+      }
+      aChangeSet->Transparency = 1.0 - aChangeSet->Transparency;
+      if (aChangeSet->Transparency >= 0.0
+       && aChangeSet->Transparency <= Precision::Confusion())
+      {
+        aChangeSet->ToSetTransparency = -1;
+        aChangeSet->Transparency = 0.0;
+      }
+    }
+    else if (anArg == "-unsettransp"
+          || anArg == "-unsettransparancy"
+          || anArg == "-unsetalpha"
+          || anArg == "-opaque")
+    {
+      aChangeSet->ToSetTransparency = -1;
+      aChangeSet->Transparency = 0.0;
+    }
+    else if (anArg == "-setcolor")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      aChangeSet->ToSetColor = 1;
+      aChangeSet->Color = ViewerTest::GetColorFromName (theArgVec[anArgIter]);
+    }
+    else if (anArg == "-unsetcolor")
+    {
+      aChangeSet->ToSetColor = -1;
+      aChangeSet->Color = DEFAULT_COLOR;
+    }
+    else if (anArg == "-setmat"
+          || anArg == "-setmaterial")
+    {
+      if (++anArgIter >= theArgNb)
+      {
+        std::cout << "Error: wrong syntax at " << anArg << "\n";
+        return 1;
+      }
+      aChangeSet->ToSetMaterial = 1;
+      aChangeSet->MatName  = theArgVec[anArgIter];
+      aChangeSet->Material = Graphic3d_MaterialAspect::MaterialFromName (aChangeSet->MatName.ToCString());
+    }
+    else if (anArg == "-unsetmat"
+          || anArg == "-unsetmaterial")
+    {
+      aChangeSet->ToSetMaterial = -1;
+      aChangeSet->Material = Graphic3d_NOM_DEFAULT;
+    }
+    else if (anArg == "-subshape"
+          || anArg == "-subshapes")
+    {
+      if (aNames.IsEmpty())
+      {
+        std::cout << "Error: main objects should specified explicitly when -subshapes is used!\n";
+        return 1;
+      }
+
+      aChanges.Append (ViewerTest_AspectsChangeSet());
+      aChangeSet = &aChanges.ChangeLast();
+
+      for (++anArgIter; anArgIter < theArgNb; ++anArgIter)
+      {
+        Standard_CString aSubShapeName = theArgVec[anArgIter];
+        if (*aSubShapeName == '-')
+        {
+          --anArgIter;
+          break;
+        }
+
+        TopoDS_Shape aSubShape = DBRep::Get (aSubShapeName);
+        if (aSubShape.IsNull())
+        {
+          std::cerr << "Error: shape " << aSubShapeName << " doesn't found!\n";
+          return 1;
+        }
+        aChangeSet->SubShapes.Append (aSubShape);
+      }
+
+      if (aChangeSet->SubShapes.IsEmpty())
+      {
+        std::cerr << "Error: empty list is specified after -subshapes!\n";
+        return 1;
+      }
+    }
+    else if (anArg == "-unset")
+    {
+      aChangeSet->ToSetLineWidth = -1;
+      aChangeSet->LineWidth = 1.0;
+      aChangeSet->ToSetTransparency = -1;
+      aChangeSet->Transparency = 0.0;
+      aChangeSet->ToSetColor = -1;
+      aChangeSet->Color = DEFAULT_COLOR;
+      aChangeSet->ToSetMaterial = -1;
+      aChangeSet->Material = Graphic3d_NOM_DEFAULT;
+    }
+    else
+    {
+      std::cout << "Error: wrong syntax at " << anArg << "\n";
+      return 1;
+    }
+  }
+
+  Standard_Boolean isFirst = Standard_True;
+  for (NCollection_Sequence<ViewerTest_AspectsChangeSet>::Iterator aChangesIter (aChanges);
+       aChangesIter.More(); aChangesIter.Next())
+  {
+    if (!aChangesIter.Value().Validate (!isFirst))
+    {
+      return 1;
+    }
+    isFirst = Standard_False;
+  }
+
+  if (aCtx->HasOpenedContext())
+  {
+    aCtx->CloseLocalContext();
+  }
+  for (ViewTest_PrsIter aPrsIter (aNames); aPrsIter.More(); aPrsIter.Next())
+  {
+    const TCollection_AsciiString& aName = aPrsIter.CurrentName();
+    Handle(AIS_InteractiveObject)  aPrs  = aPrsIter.Current();
+    Handle(AIS_ColoredShape) aColoredPrs;
+    Standard_Boolean toDisplay = Standard_False;
+    if (aChanges.Length() > 1)
+    {
+      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";
+        return 1;
+      }
+      aColoredPrs = Handle(AIS_ColoredShape)::DownCast (aShapePrs);
+      if (aColoredPrs.IsNull())
+      {
+        aColoredPrs = new AIS_ColoredShape (aShapePrs);
+        aCtx->Remove (aShapePrs, Standard_False);
+        GetMapOfAIS().UnBind2 (aName);
+        GetMapOfAIS().Bind (aColoredPrs, aName);
+        toDisplay = Standard_True;
+        aShapePrs = aColoredPrs;
+        aPrs      = aColoredPrs;
+      }
+    }
+
+    if (!aPrs.IsNull())
+    {
+      NCollection_Sequence<ViewerTest_AspectsChangeSet>::Iterator aChangesIter (aChanges);
+      aChangeSet = &aChangesIter.ChangeValue();
+      if (aChangeSet->ToSetMaterial == 1)
+      {
+        aCtx->SetMaterial (aPrs, aChangeSet->Material, Standard_False);
+      }
+      else if (aChangeSet->ToSetMaterial == -1)
+      {
+        aCtx->UnsetMaterial (aPrs, Standard_False);
+      }
+      if (aChangeSet->ToSetColor == 1)
+      {
+        aCtx->SetColor (aPrs, aChangeSet->Color, Standard_False);
+      }
+      else if (aChangeSet->ToSetColor == -1)
+      {
+        aCtx->UnsetColor (aPrs, Standard_False);
+      }
+      if (aChangeSet->ToSetTransparency == 1)
+      {
+        aCtx->SetTransparency (aPrs, aChangeSet->Transparency, Standard_False);
+      }
+      else if (aChangeSet->ToSetTransparency == -1)
+      {
+        aCtx->UnsetTransparency (aPrs, Standard_False);
+      }
+      if (aChangeSet->ToSetLineWidth == 1)
+      {
+        aCtx->SetWidth (aPrs, aChangeSet->LineWidth, Standard_False);
+      }
+      else if (aChangeSet->ToSetLineWidth == -1)
+      {
+        aCtx->UnsetWidth (aPrs, Standard_False);
+      }
+
+      for (aChangesIter.Next(); aChangesIter.More(); aChangesIter.Next())
+      {
+        aChangeSet = &aChangesIter.ChangeValue();
+        for (NCollection_Sequence<TopoDS_Shape>::Iterator aSubShapeIter (aChangeSet->SubShapes);
+             aSubShapeIter.More(); aSubShapeIter.Next())
+        {
+          const TopoDS_Shape& aSubShape = aSubShapeIter.Value();
+          if (aChangeSet->ToSetColor == 1)
+          {
+            aColoredPrs->SetCustomColor (aSubShape, aChangeSet->Color);
+          }
+          if (aChangeSet->ToSetLineWidth == 1)
+          {
+            aColoredPrs->SetCustomWidth (aSubShape, aChangeSet->LineWidth);
+          }
+          if (aChangeSet->ToSetColor     == -1
+           || aChangeSet->ToSetLineWidth == -1)
+          {
+            aColoredPrs->UnsetCustomAspects (aSubShape, Standard_True);
+          }
+        }
+      }
+      if (toDisplay)
+      {
+        aCtx->Display (aPrs, Standard_False);
+      }
+      else if (!aColoredPrs.IsNull())
+      {
+        aColoredPrs->Redisplay();
+      }
+    }
+    else
+    {
+      Handle(NIS_InteractiveObject) aNisObj = Handle(NIS_InteractiveObject)::DownCast (aPrsIter.CurrentTrs());
+      Handle(NIS_Triangulated)      aNisTri = Handle(NIS_Triangulated)::DownCast (aNisObj);
+      if (!aNisObj.IsNull())
+      {
+        if (aChangeSet->ToSetTransparency != 0)
+        {
+          aNisObj->SetTransparency (aChangeSet->Transparency);
+        }
+      }
+      if (!aNisTri.IsNull())
+      {
+        if (aChangeSet->ToSetColor != 0)
+        {
+          aNisTri->SetColor (aChangeSet->Color);
+        }
+        if (aChangeSet->ToSetLineWidth != 0)
+        {
+          aNisTri->SetLineWidth (aChangeSet->LineWidth);
+        }
+      }
+    }
+  }
+
+  // update the screen and redraw the view
+  TheAISContext()->UpdateCurrentViewer();
   return 0;
 }
 
@@ -3392,46 +3607,67 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
   theCommands.Add("vsub",      "vsub 0/1 (off/on) [obj]        : Subintensity(on/off) of selected objects",
 		  __FILE__,VSubInt,group);
 
+  theCommands.Add("vaspects",
+              "vaspects [name1 [name2 [...]]]"
+      "\n\t\t:          [-setcolor ColorName] [-unsetcolor]"
+      "\n\t\t:          [-setmaterial MatName] [-unsetmaterial]"
+      "\n\t\t:          [-settransparency Transp] [-unsettransparancy]"
+      "\n\t\t:          [-setwidth LineWidth] [-unsetwidth]"
+      "\n\t\t:          [-subshapes subname1 [subname2 [...]]]"
+      "\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.",
+		  __FILE__,VAspects,group);
+
   theCommands.Add("vsetcolor",
-		  "vsetcolor [name] ColorName"
-      "\n\t\t: Sets color for all, selected or named objects.",
-		  __FILE__,VColor2,group);
+      "vsetcolor [name] ColorName"
+      "\n\t\t: Sets color for all, selected or named objects."
+      "\n\t\t: Alias for vaspects -setcolor [name] ColorName.",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vunsetcolor",
-		  "vunsetcolor [name]"
-      "\n\t\t: Resets color for all, selected or named objects.",
-		  __FILE__,VColor2,group);
+		  "vunsetcolor [-noupdate|-update] [name]"
+      "\n\t\t: Resets color for all, selected or named objects."
+      "\n\t\t: Alias for vaspects -unsetcolor [name].",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vsettransparency",
 		  "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);
+      "\n\t\t: The Coefficient may be between 0.0 (opaque) and 1.0 (fully transparent)."
+      "\n\t\t: Alias for vaspects -settransp [name] Coefficient.",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vunsettransparency",
-		  "vunsettransparency [name]"
-      "\n\t\t: Resets transparency for all, selected or named objects.",
-		  __FILE__,VTransparency,group);
+		  "vunsettransparency [-noupdate|-update] [name]"
+      "\n\t\t: Resets transparency for all, selected or named objects."
+      "\n\t\t: Alias for vaspects -unsettransp [name].",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vsetmaterial",
-		  "vmaterial          : vmaterial  [name of shape] MaterialName",
-		  __FILE__,VMaterial,group);
+		  "vsetmaterial [name] MaterialName"
+      "\n\t\t: Alias for vaspects -setmaterial [name] MaterialName.",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vunsetmaterial",
-		  "vmaterial          : vmaterial  [name of shape]",
-		  __FILE__,VMaterial,group);
+		  "vunsetmaterial [name]"
+      "\n\t\t: Alias for vaspects -unsetmaterial [name].",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vsetwidth",
-		  "vsetwidth          : vwidth  [name of shape] width(0->10)",
-		  __FILE__,VWidth,group);
+		  "vsetwidth [name] width(0->10)"
+      "\n\t\t: Alias for vaspects -setwidth [name] width.",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vunsetwidth",
-		  "vunsetwidth          : vwidth  [name of shape]",
-		  __FILE__,VWidth,group);
+		  "vunsetwidth [name]"
+      "\n\t\t: Alias for vaspects -unsetwidth [name] width.",
+		  __FILE__,VAspects,group);
 
   theCommands.Add("vsetinteriorstyle",
-		  "vsetinteriorstyle    : vsetinteriorstyle [name of shape] style",
-		  __FILE__,VInteriorStyle,group);
+		  "vsetinteriorstyle [name] style"
+      "\n\t\t: Where style is: 0 = EMPTY, 1 = HOLLOW, 2 = HATCH, 3 = SOLID, 4 = HIDDENLINE.",
+		  __FILE__,VSetInteriorStyle,group);
 
   theCommands.Add("vardis",
 		  "vardis          : display activeareas",
diff --git a/tests/bugs/vis/bug24762_coloredshape b/tests/bugs/vis/bug24762_coloredshape
new file mode 100644
index 0000000000..c126609666
--- /dev/null
+++ b/tests/bugs/vis/bug24762_coloredshape
@@ -0,0 +1,48 @@
+puts "========"
+puts "OCC24762 new interactive object AIS_ColoredShape with customized subshapes presentations"
+puts "========"
+
+# draw box in advance which should fit all our markers
+box b  0 0 0 1 2 3
+box bb 3 0 0 2 3 1
+
+# prepare view
+vinit View1
+vclear
+vglinfo
+vsetdispmode 1
+vaxo
+vdisplay b bb
+vfit
+
+# customize box 1
+explode b V
+vaspects b -subshapes b_1      -setcolor GREEN
+explode b E
+vaspects b -subshapes b_6 b_12 -setcolor RED     -setwidth 6
+explode b W
+vaspects b -subshapes b_2      -setcolor HOTPINK -setwidth 4
+explode b F
+vaspects b -subshapes b_3      -setcolor GRAY
+
+# customize box 2
+explode bb F
+vaspects bb -setcolor GREEN -subshapes bb_6 -setcolor RED
+vsetdispmode bb 0
+
+# take snapshot
+vdump $imagedir/${casename}.png
+
+# check colors on box 1
+set aWireColor  [vreadpixel 54  150 rgb name]
+set anEdgeColor [vreadpixel 100  90 rgb name]
+set aFaceColor  [vreadpixel 30  200 rgb name]
+if {"$aWireColor"  != "HOTPINK"} {
+  puts "Error: wrong Wire color"
+}
+if {"$anEdgeColor" != "RED"} {
+  puts "Error: wrong Edge color"
+}
+if {"$aFaceColor"  != "LEMONCHIFFON1"} {
+  puts "Error: wrong Face color"
+}