]> OCCT Git - occt.git/commitdiff
0032633: Draw Harness - extend command incmesh to apply default visualization parameters
authorkgv <kgv@opencascade.com>
Tue, 19 Oct 2021 18:34:18 +0000 (21:34 +0300)
committersmoskvin <smoskvin@opencascade.com>
Fri, 22 Oct 2021 16:58:15 +0000 (19:58 +0300)
incmesh - added -prs option to use StdPrs_ToolTriangulatedShape::GetDeflection() as meshing parameters.
vdisplay, XDisplay - added -autoTriangulation option to manage meshing behavior before displaying a shape.
trinfo - added output of meshing parameters.
Fixed broken incmesh syntax usage in several test cases.

15 files changed:
src/DrawResources/CheckCommands.tcl
src/MeshTest/MeshTest.cxx
src/ViewerTest/ViewerTest.cxx
src/XDEDRAW/XDEDRAW.cxx
tests/bugs/mesh/bug25281
tests/hlr/poly_hlr/bug23625_1
tests/mesh/advanced_incmesh/begin
tests/mesh/advanced_incmesh_parallel/begin
tests/mesh/end
tests/mesh/standard_incmesh/begin
tests/mesh/standard_incmesh_parallel/begin
tests/perf/mesh/bug26889_1
tests/perf/mesh/bug26889_2
tests/perf/mesh/bug26889_3
tests/v3d/bugs/bug23200_1

index e0b5c33f46f2afafd3c648b1cd99833d498bcd9b..e39a130e23d73d2cdae350998daf412ee85a9e09 100644 (file)
@@ -999,7 +999,7 @@ proc checktrinfo {shape args} {
 
     # get current number of faces, triangles and nodes, value of max deflection
     set tri_info [trinfo ${shape}]
-    set triinfo_pattern "(\[0-9\]+) +faces(.*\[^0-9]\(\[0-9\]+) +empty faces)?.*\[^0-9]\(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[-0-9.+eE\]+)"
+    set triinfo_pattern "(\[0-9\]+) +faces(.*\[^0-9]\(\[0-9\]+) +empty faces)?.*\[^0-9]\(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*Maximal deflection +(\[-0-9.+eE\]+)"
     if {![regexp "${triinfo_pattern}" ${tri_info} dump cur_nb_faces tmp cur_nb_empty_faces cur_nb_triangles cur_nb_nodes cur_deflection]} {
         puts "Error: command trinfo prints empty info"
     }
index 234081dad9aaecc42a9342fe47c0ec540571d4c8..83da94bd47d37711c9f77130839ad4ccc05be2a3 100644 (file)
@@ -42,6 +42,9 @@
 #include <OSD_OpenFile.hxx>
 #include <Poly_Connect.hxx>
 #include <Poly_MergeNodesTool.hxx>
+#include <Poly_TriangulationParameters.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <StdPrs_ToolTriangulatedShape.hxx>
 #include <TopExp_Explorer.hxx>
 #include <TopTools_MapIteratorOfMapOfShape.hxx>
 #include <BRep_CurveRepresentation.hxx>
@@ -80,83 +83,71 @@ OSD_Chronometer chIsos, chPointsOnIsos;
 //function : incrementalmesh
 //purpose  : 
 //=======================================================================
-static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv)
+static Standard_Integer incrementalmesh (Draw_Interpretor& theDI,
+                                         Standard_Integer theNbArgs,
+                                         const char** theArgVec)
 {
-  if (nbarg < 3)
+  if (theNbArgs < 3)
   {
-    di << "\
-Builds triangular mesh for the shape\n\
-usage: incmesh Shape LinearDeflection [options]\n\
-options:\n\
-        -a val          angular deflection for edges in deg\n\
-                        (default ~28.64 deg = 0.5 rad)\n\n\
-        -ai val         angular deflection inside of faces in deg\n\
-                        (default ~57.29 deg = 1 rad)\n\n\
-        -di val         Linear deflection used to tessellate the face interior.\n\
-        -min            minimum size parameter limiting size of triangle's\n\
-                        edges to prevent sinking into amplification in case\n\
-                        of distorted curves and surfaces\n\n\
-        -relative       notifies that relative deflection is used\n\
-                        (switched off by default)\n\n\
-        -int_vert_off   disables insertion of internal vertices into mesh\n\
-                        (enabled by default)\n\
-        -surf_def_off   disables control of deflection of mesh from real\n\
-                        surface (enabled by default)\n\
-        -parallel       enables parallel execution (switched off by default)\n\
-        -adjust_min     enables local adjustment of min size depending on edge size (switched off by default)\n\
-        -force_face_def disables usage of shape tolerances for computing face deflection (switched off by default)\n\
-        -decrease       enforces the meshing of the shape even if current mesh satisfies the new criteria\
-                        (switched off by default).\n\
-        -algo {watson|delabella} changes core triangulation algorithm to one with specified id (watson is used by default)\n";
-    return 0;
+    theDI << "Syntax error: wrong number of arguments";
+    return 1;
   }
+
   TopoDS_ListOfShape aListOfShapes;
   IMeshTools_Parameters aMeshParams;
-  Standard_Boolean isDeflectionInitialized = Standard_False;
+  bool hasDefl = false, hasAngDefl = false, isPrsDefl = false;
 
-  Handle (IMeshTools_Context) aContext = new BRepMesh_Context;
-  for (Standard_Integer anArgIter = 1; anArgIter < nbarg; ++anArgIter)
+  Handle(IMeshTools_Context) aContext = new BRepMesh_Context();
+  for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
   {
-    TCollection_AsciiString aName = argv[anArgIter];
-    TCollection_AsciiString       aNameCase = aName;
+    TCollection_AsciiString aNameCase (theArgVec[anArgIter]);
     aNameCase.LowerCase();
-
-    if (aNameCase == "")
-      continue;
-    else if (aNameCase == "-relative")
-      aMeshParams.Relative = Standard_True;
-    else if (aNameCase == "-parallel")
-      aMeshParams.InParallel = Standard_True;
+    if (aNameCase == "-relative"
+     || aNameCase == "-norelative")
+    {
+      aMeshParams.Relative = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (aNameCase == "-parallel"
+          || aNameCase == "-noparallel")
+    {
+      aMeshParams.InParallel = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
     else if (aNameCase == "-int_vert_off")
-      aMeshParams.InternalVerticesMode = Standard_False;
+    {
+      aMeshParams.InternalVerticesMode = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
+    }
     else if (aNameCase == "-surf_def_off")
-      aMeshParams.ControlSurfaceDeflection = Standard_False;
+    {
+      aMeshParams.ControlSurfaceDeflection = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
+    }
     else if (aNameCase == "-adjust_min")
-      aMeshParams.AdjustMinSize = Standard_True;
+    {
+      aMeshParams.AdjustMinSize = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
     else if (aNameCase == "-force_face_def")
-      aMeshParams.ForceFaceDeflection = Standard_True;
+    {
+      aMeshParams.ForceFaceDeflection = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
     else if (aNameCase == "-decrease")
-      aMeshParams.AllowQualityDecrease = Standard_True;
-    else if (aNameCase == "-algo")
     {
-      if (++anArgIter >= nbarg)
-      {
-        di << "Error: wrong syntax at " << aNameCase;
-        return 1;
-      }
-      TCollection_AsciiString anAlgoStr (argv[anArgIter]);
+      aMeshParams.AllowQualityDecrease = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
+    }
+    else if (aNameCase == "-algo"
+          && anArgIter + 1 < theNbArgs)
+    {
+      TCollection_AsciiString anAlgoStr (theArgVec[++anArgIter]);
       anAlgoStr.LowerCase();
       if (anAlgoStr == "watson"
        || anAlgoStr == "0")
       {
         aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Watson;
-        aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_MeshAlgoFactory));
+        aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_MeshAlgoFactory()));
       }
       else if (anAlgoStr == "delabella"
             || anAlgoStr == "1")
       {
         aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Delabella;
-        aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory));
+        aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory()));
       }
       else if (anAlgoStr == "-1"
             || anAlgoStr == "default")
@@ -166,89 +157,82 @@ options:\n\
       }
       else
       {
-        di << "Syntax error at " << anAlgoStr;
+        theDI << "Syntax error at '" << anAlgoStr << "'";
         return 1;
       }
     }
-    else if (aNameCase == "-a")
+    else if ((aNameCase == "-prs"
+           || aNameCase == "-presentation"
+           || aNameCase == "-vis"
+           || aNameCase == "-visualization")
+         && !isPrsDefl)
     {
-      if (++anArgIter >= nbarg)
-      {
-        di << "Error: wrong syntax at " << aNameCase;
-        return 1;
-      }
-      Standard_Real aVal = Draw::Atof (argv[anArgIter]) * M_PI / 180.;
+      isPrsDefl = true;
+    }
+    else if ((aNameCase == "-angular"
+           || aNameCase == "-angdefl"
+           || aNameCase == "-angulardeflection"
+           || aNameCase == "-a")
+          && anArgIter + 1 < theNbArgs)
+    {
+      Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]) * M_PI / 180.;
       if (aVal <= Precision::Angular())
       {
-        di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'";
+        theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
         return 1;
       }
       aMeshParams.Angle = aVal;
+      hasAngDefl = true;
     }
-    else if (aNameCase == "-ai")
+    else if (aNameCase == "-ai"
+          && anArgIter + 1 < theNbArgs)
     {
-      if (++anArgIter >= nbarg)
-      {
-        di << "Error: wrong syntax at " << aNameCase;
-        return 1;
-      }
-      Standard_Real aVal = Draw::Atof (argv[anArgIter]) * M_PI / 180.;
+      Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]) * M_PI / 180.;
       if (aVal <= Precision::Angular())
       {
-        di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'";
+        theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
         return 1;
       }
       aMeshParams.AngleInterior = aVal;
     }
-    else if (aNameCase == "-min")
+    else if (aNameCase == "-min"
+          && anArgIter + 1 < theNbArgs)
     {
-      if (++anArgIter >= nbarg)
-      {
-        di << "Error: wrong syntax at " << aNameCase;
-        return 1;
-      }
-      Standard_Real aVal = Draw::Atof (argv[anArgIter]);
+      Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]);
       if (aVal <= Precision::Confusion())
       {
-        di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'";
+        theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
         return 1;
       }
       aMeshParams.MinSize = aVal;
     }
-    else if (aNameCase == "-di")
+    else if (aNameCase == "-di"
+          && anArgIter + 1 < theNbArgs)
     {
-      if (++anArgIter >= nbarg)
-      {
-        di << "Error: wrong syntax at " << aNameCase;
-        return 1;
-      }
-      Standard_Real aVal = Draw::Atof (argv[anArgIter]);
+      Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]);
       if (aVal <= Precision::Confusion())
       {
-        di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'";
+        theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
         return 1;
       }
       aMeshParams.DeflectionInterior = aVal;
     }
-    else if (aNameCase.IsRealValue (Standard_True))
+    else if (aNameCase.IsRealValue (true)
+         && !hasDefl)
     {
-      if (isDeflectionInitialized)
-      {
-        continue;
-      }
-      aMeshParams.Deflection = Max (Draw::Atof (argv[anArgIter]), Precision::Confusion());
+      aMeshParams.Deflection = Max (Draw::Atof (theArgVec[anArgIter]), Precision::Confusion());
       if (aMeshParams.DeflectionInterior < Precision::Confusion())
       {
         aMeshParams.DeflectionInterior = aMeshParams.Deflection;
       }
-      isDeflectionInitialized = Standard_True;
+      hasDefl = true;
     }
     else
     {
-      TopoDS_Shape aShape = DBRep::Get (aName);
+      TopoDS_Shape aShape = DBRep::Get (theArgVec[anArgIter]);
       if (aShape.IsNull())
       {
-        di << "Syntax error: null shapes are not allowed here - " << aName <<"\n";
+        theDI << "Syntax error: null shapes are not allowed here '" << theArgVec[anArgIter] << "'\n";
         return 1;
       }
       aListOfShapes.Append (aShape);
@@ -261,8 +245,8 @@ options:\n\
     return 1;
   }
 
-  di << "Incremental Mesh, multi-threading "
-     << (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
+  theDI << "Incremental Mesh, multi-threading "
+        << (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
 
   TopoDS_Shape aShape;
   if (aListOfShapes.Size() == 1)
@@ -279,64 +263,55 @@ options:\n\
     }
     aShape = aCompound;
   }
-  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
+
+  if (isPrsDefl)
+  {
+    Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
+    if (hasDefl)
+    {
+      aDrawer->SetDeviationCoefficient (aMeshParams.Deflection);
+    }
+    aMeshParams.Deflection = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, aDrawer);
+    if (!hasAngDefl)
+    {
+      aMeshParams.Angle = aDrawer->DeviationAngle();
+    }
+  }
+
+  Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
   BRepMesh_IncrementalMesh aMesher;
   aMesher.SetShape (aShape);
   aMesher.ChangeParameters() = aMeshParams;
-
   aMesher.Perform (aContext, aProgress->Start());
 
-  di << "Meshing statuses: ";
+  theDI << "Meshing statuses: ";
   const Standard_Integer aStatus = aMesher.GetStatusFlags();
-  if (!aStatus)
+  if (aStatus == 0)
   {
-    di << "NoError";
+    theDI << "NoError";
+    return 0;
   }
-  else
+
+  for (Standard_Integer i = 0; i < 9; i++)
   {
-    Standard_Integer i;
-    for (i = 0; i < 9; i++)
+    Standard_Integer aFlag = aStatus & (1 << i);
+    if (aFlag)
     {
-      Standard_Integer aFlag = aStatus & (1 << i);
-      if (aFlag)
+      switch ((IMeshData_Status) aFlag)
       {
-        switch ((IMeshData_Status) aFlag)
-        {
-        case IMeshData_OpenWire:
-          di << "OpenWire ";
-          break;
-        case IMeshData_SelfIntersectingWire:
-          di << "SelfIntersectingWire ";
-          break;
-        case IMeshData_Failure:
-          di << "Failure ";
-          break;
-        case IMeshData_ReMesh:
-          di << "ReMesh ";
-          break;
-        case IMeshData_UnorientedWire:
-          di << "UnorientedWire ";
-          break;
-        case IMeshData_TooFewPoints:
-          di << "TooFewPoints ";
-          break;
-        case IMeshData_Outdated:
-          di << "Outdated ";
-          break;
-        case IMeshData_Reused:
-          di << "Reused ";
-          break;
-        case IMeshData_UserBreak:
-          di << "User break";
-          break;
-        case IMeshData_NoError:
-        default:
-          break;
-        }
+        case IMeshData_OpenWire:             theDI << "OpenWire "; break;
+        case IMeshData_SelfIntersectingWire: theDI << "SelfIntersectingWire "; break;
+        case IMeshData_Failure:              theDI << "Failure "; break;
+        case IMeshData_ReMesh:               theDI << "ReMesh "; break;
+        case IMeshData_UnorientedWire:       theDI << "UnorientedWire "; break;
+        case IMeshData_TooFewPoints:         theDI << "TooFewPoints "; break;
+        case IMeshData_Outdated:             theDI << "Outdated "; break;
+        case IMeshData_Reused:               theDI << "Reused "; break;
+        case IMeshData_UserBreak:            theDI << "UserBreak "; break;
+        case IMeshData_NoError: break;
       }
     }
   }
-
   return 0;
 }
 
@@ -757,7 +732,7 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
   TopExp_Explorer anExp;
   Handle(Poly_Triangulation) aTriangulation;
   TopLoc_Location aLoc;
-  Standard_Real aMaxDeflection = 0.0;
+  Standard_Real aMaxDeflection = 0.0, aMeshingDefl = -1.0, aMeshingAngDefl = -1.0, aMeshingMinSize = -1.0;
   Standard_Integer aNbFaces = 0, aNbEmptyFaces = 0, aNbTriangles = 0, aNbNodes = 0, aNbRepresentations = 0;
   NCollection_IndexedDataMap<Standard_Integer, TriangulationStat> aLODsStat;
   NCollection_Vector<Standard_Integer> aNbLODs;
@@ -770,9 +745,12 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
     {
       aNbTriangles += aTriangulation->NbTriangles();
       aNbNodes += aTriangulation->NbNodes();
-      if (aTriangulation->Deflection() > aMaxDeflection)
+      aMaxDeflection = Max (aMaxDeflection, aTriangulation->Deflection());
+      if (!aTriangulation->Parameters().IsNull())
       {
-        aMaxDeflection = aTriangulation->Deflection();
+        aMeshingDefl    = Max (aMeshingDefl,    aTriangulation->Parameters()->Deflection());
+        aMeshingAngDefl = Max (aMeshingAngDefl, aTriangulation->Parameters()->Angle());
+        aMeshingMinSize = Max (aMeshingMinSize, aTriangulation->Parameters()->MinSize());
       }
     }
     else
@@ -868,6 +846,18 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
   theDI << "                    " << aNbNodes << " nodes.\n";
   theDI << "                    " << aNbRepresentations << " polygons on triangulation.\n";
   theDI << "Maximal deflection " << aMaxDeflection << "\n";
+  if (aMeshingDefl > 0.0)
+  {
+    theDI << "Meshing deflection " << aMeshingDefl << "\n";
+  }
+  if (aMeshingAngDefl > 0.0)
+  {
+    theDI << "Meshing angular deflection " << (aMeshingAngDefl * 180.0 / M_PI) << "\n";
+  }
+  if (aMeshingMinSize > 0.0)
+  {
+    theDI << "Meshing min size " << aMeshingMinSize << "\n";
+  }
 
   if (aNbLODs.Size() > 0)
   {
@@ -1613,7 +1603,32 @@ void  MeshTest::Commands(Draw_Interpretor& theCommands)
 
   g = "Mesh Commands";
 
-  theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g);
+  theCommands.Add("incmesh",
+    "incmesh Shape LinDefl [-angular Angle]=28.64 [-prs]"
+    "\n\t\t:   [-relative {0|1}]=0 [-parallel {0|1}]=0 [-min Size]"
+    "\n\t\t:   [-algo {watson|delabella}]=watson"
+    "\n\t\t:   [-di Value] [-ai Angle]=57.29"
+    "\n\t\t:   [-int_vert_off {0|1}]=0 [-surf_def_off {0|1}]=0 [-adjust_min {0|1}]=0"
+    "\n\t\t:   [-force_face_def {0|1}]=0 [-decrease {0|1}]=0"
+    "\n\t\t: Builds triangular mesh for the shape."
+    "\n\t\t:  LinDefl         linear deflection to control mesh quality;"
+    "\n\t\t:  -angular        angular deflection for edges in deg (~28.64 deg = 0.5 rad by default);"
+    "\n\t\t:  -prs            apply default meshing parameters for visualization purposes"
+    "\n\t\t:                  (20 deg angular deflection, 0.001 of bounding box linear deflection);"
+    "\n\t\t:  -relative       notifies that relative deflection is used (FALSE by default);"
+    "\n\t\t:  -parallel       enables parallel execution (FALSE by default);"
+    "\n\t\t:  -algo           changes core triangulation algorithm to one with specified id (watson by default);"
+    "\n\t\t:  -min            minimum size parameter limiting size of triangle's edges to prevent sinking"
+    "\n\t\t:                  into amplification in case of distorted curves and surfaces;"
+    "\n\t\t:  -di             linear deflection used to tessellate the face interior;"
+    "\n\t\t:  -ai             angular deflection inside of faces in deg (~57.29 deg = 1 rad by default);"
+    "\n\t\t:  -int_vert_off   disables insertion of internal vertices into mesh (enabled by default);"
+    "\n\t\t:  -surf_def_off   disables control of deflection of mesh from real surface (enabled by default);"
+    "\n\t\t:  -adjust_min     enables local adjustment of min size depending on edge size (FALSE by default);"
+    "\n\t\t:  -force_face_def disables usage of shape tolerances for computing face deflection (FALSE by default);"
+    "\n\t\t:  -decrease       enforces the meshing of the shape even if current mesh satisfies the new criteria"
+    "\n\t\t:                  (FALSE by default).",
+  __FILE__, incrementalmesh, g);
   theCommands.Add("tessellate","Builds triangular mesh for the surface, run w/o args for help",__FILE__, tessellate, g);
   theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);
 
index 523c99b903b48ebfbe4353769230a721715a057c..7ea98430f3a9633ec11c6ab51d93375394ba85e3 100644 (file)
@@ -4847,6 +4847,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
   Standard_Integer   anObjHighMode  = -2;
   Standard_Boolean   toSetTrsfPers  = Standard_False;
   Standard_Boolean   toEcho         = Standard_True;
+  Standard_Integer   isAutoTriang   = -1;
   Handle(Graphic3d_TransformPers) aTrsfPers;
   TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
   AIS_DisplayStatus aDispStatus = AIS_DS_None;
@@ -5048,6 +5049,17 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       toReDisplay = Standard_True;
     }
+    else if (aNameCase == "-autotr"
+          || aNameCase == "-autotrian"
+          || aNameCase == "-autotriang"
+          || aNameCase == "-autotriangulation"
+          || aNameCase == "-noautotr"
+          || aNameCase == "-noautotrian"
+          || aNameCase == "-noautotriang"
+          || aNameCase == "-noautotriangulation")
+    {
+      isAutoTriang = Draw::ParseOnOffNoIterator (theArgNb, theArgVec, anArgIter) ? 1 : 0;
+    }
     else if (aNameCase == "-erased"
           || aNameCase == "-load")
     {
@@ -5089,6 +5101,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
         {
           aShape->SetZLayer (aZLayer);
         }
+        if (isAutoTriang != -1)
+        {
+          aShape->Attributes()->SetAutoTriangulation (isAutoTriang == 1);
+        }
         if (toSetTrsfPers)
         {
           aCtx->SetTransformPersistence (aShape, aTrsfPers);
@@ -5157,6 +5173,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
     {
       aShape->SetZLayer (aZLayer);
     }
+    if (isAutoTriang != -1)
+    {
+      aShape->Attributes()->SetAutoTriangulation (isAutoTriang == 1);
+    }
     if (toSetTrsfPers)
     {
       aCtx->SetTransformPersistence (aShape, aTrsfPers);
@@ -6554,7 +6574,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:          [-dispMode mode] [-highMode mode]"
       "\n\t\t:          [-layer index] [-top|-topmost|-overlay|-underlay]"
       "\n\t\t:          [-redisplay] [-erased]"
-      "\n\t\t:          [-noecho]"
+      "\n\t\t:          [-noecho] [-autoTriangulation {0|1}]"
       "\n\t\t:          name1 [name2] ... [name n]"
       "\n\t\t: Displays named objects."
       "\n\t\t: Option -local enables displaying of objects in local"
@@ -6583,7 +6603,8 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
       "\n\t\t:  -dispmode    Sets display mode for objects."
       "\n\t\t:  -highmode    Sets hilight mode for objects."
       "\n\t\t:  -redisplay   Recomputes presentation of objects."
-      "\n\t\t:  -noecho      Avoid printing of command results.",
+      "\n\t\t:  -noecho      Avoid printing of command results."
+      "\n\t\t:  -autoTriang  Enable/disable auto-triangulation for displayed shape."
       __FILE__, VDisplay2, group);
 
   theCommands.Add ("vnbdisplayed",
index a10b762eeef1765c9fe99ddd0050ad56ca2c6125..270b07483bd33f4c61d39249936f547c00109f27 100644 (file)
@@ -644,12 +644,14 @@ private:
   XDEDRAW_XDisplayTool()
   : myDispMode(-2),
     myHiMode  (-2),
+    myIsAutoTriang (-1),
     myToPrefixDocName (Standard_True),
     myToGetNames (Standard_True),
     myToExplore  (Standard_False) {}
 
   //! Display single label.
-  Standard_Integer displayLabel (const TDF_Label& theLabel,
+  Standard_Integer displayLabel (Draw_Interpretor& theDI,
+                                 const TDF_Label& theLabel,
                                  const TCollection_AsciiString& theNamePrefix,
                                  const TopLoc_Location& theLoc,
                                  TCollection_AsciiString& theOutDispList)
@@ -701,7 +703,7 @@ private:
         const TopLoc_Location aLoc = theLoc * XCAFDoc_ShapeTool::GetLocation (theLabel);
         for (TDF_ChildIterator aChildIter (aRefLabel); aChildIter.More(); aChildIter.Next())
         {
-          if (displayLabel (aChildIter.Value(), aName, aLoc, theOutDispList) == 1)
+          if (displayLabel (theDI, aChildIter.Value(), aName, aLoc, theOutDispList) == 1)
           {
             return 1;
           }
@@ -723,7 +725,7 @@ private:
       }
       if (!aPrs->AcceptDisplayMode (myDispMode))
       {
-        std::cout << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myDispMode << " display mode\n";
+        theDI << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myDispMode << " display mode";
         return 1;
       }
       else
@@ -736,11 +738,15 @@ private:
       if (myHiMode != -1
       && !aPrs->AcceptDisplayMode (myHiMode))
       {
-        std::cout << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myHiMode << " display mode\n";
+        theDI << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myHiMode << " display mode";
         return 1;
       }
       aPrs->SetHilightMode (myHiMode);
     }
+    if (myIsAutoTriang != -1)
+    {
+      aPrs->Attributes()->SetAutoTriangulation (myIsAutoTriang == 1);
+    }
 
     ViewerTest::Display (aName, aPrs, false);
     theOutDispList += aName + " ";
@@ -755,7 +761,7 @@ private:
     Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
     if (aContext.IsNull())
     {
-      std::cout << "Error: no active view!\n";
+      theDI << "Error: no active viewer";
       return 1;
     }
 
@@ -785,6 +791,17 @@ private:
       {
         myHiMode = TCollection_AsciiString (theArgVec[++anArgIter]).IntegerValue();
       }
+      else if (anArgCase == "-autotr"
+            || anArgCase == "-autotrian"
+            || anArgCase == "-autotriang"
+            || anArgCase == "-autotriangulation"
+            || anArgCase == "-noautotr"
+            || anArgCase == "-noautotrian"
+            || anArgCase == "-noautotriang"
+            || anArgCase == "-noautotriangulation")
+      {
+        myIsAutoTriang = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter) ? 1 : 0;
+      }
       else if (anArgCase == "-docprefix"
             || anArgCase == "-nodocprefix")
       {
@@ -857,7 +874,7 @@ private:
             if (!myDoc.IsNull()
               && myDoc != aDoc)
             {
-              std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+              theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
               return 1;
             }
             myDoc = aDoc;
@@ -866,7 +883,7 @@ private:
         }
         if (myDoc.IsNull())
         {
-          std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n";
+          theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
           return 1;
         }
 
@@ -875,7 +892,7 @@ private:
         if (aLabel.IsNull()
         || !XCAFDoc_ShapeTool::IsShape (aLabel))
         {
-          std::cout << "Syntax error: " << aValue << " is not a valid shape label\n";
+          theDI << "Syntax error: " << aValue << " is not a valid shape label";
           return 1;
         }
         myLabels.Append (aLabel);
@@ -883,7 +900,7 @@ private:
     }
     if (myDoc.IsNull())
     {
-      std::cout << "Syntax error: not enough arguments\n";
+      theDI << "Syntax error: not enough arguments";
       return 1;
     }
     if (myLabels.IsEmpty())
@@ -894,7 +911,7 @@ private:
     for (TDF_LabelSequence::Iterator aLabIter (myLabels); aLabIter.More(); aLabIter.Next())
     {
       const TDF_Label& aLabel = aLabIter.Value();
-      if (displayLabel (aLabel, myToPrefixDocName ? myDocName + ":" : "", TopLoc_Location(), myOutDispList) == 1)
+      if (displayLabel (theDI, aLabel, myToPrefixDocName ? myDocName + ":" : "", TopLoc_Location(), myOutDispList) == 1)
       {
         return 1;
       }
@@ -920,6 +937,7 @@ private:
   TDF_LabelSequence        myLabels;          //!< labels to display
   Standard_Integer         myDispMode;        //!< shape display mode
   Standard_Integer         myHiMode;          //!< shape highlight mode
+  Standard_Integer         myIsAutoTriang;    //!< auto-triangulation mode
   Standard_Boolean         myToPrefixDocName; //!< flag to prefix objects with document name
   Standard_Boolean         myToGetNames;      //!< flag to use label names or tags
   Standard_Boolean         myToExplore;       //!< flag to explore assembles
@@ -1394,7 +1412,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
 
   di.Add ("XDisplay",
           "XDisplay Doc [label1 [label2 [...]]] [-explore {on|off}] [-docPrefix {on|off}] [-names {on|off}]"
-          "\n\t\t:      [-noupdate] [-dispMode Mode] [-highMode Mode]"
+          "\n\t\t:      [-noupdate] [-dispMode Mode] [-highMode Mode] [-autoTriangulation {0|1}]"
           "\n\t\t: Displays document (parts) in 3D Viewer."
           "\n\t\t:  -dispMode    Presentation display mode."
           "\n\t\t:  -highMode    Presentation highlight mode."
@@ -1402,7 +1420,8 @@ void XDEDRAW::Init(Draw_Interpretor& di)
           "\n\t\t:  -names       Use object names instead of label tag; TRUE by default."
           "\n\t\t:  -explore     Explode labels to leaves; FALSE by default."
           "\n\t\t:  -outDispList Set the TCL variable to the list of displayed object names."
-          "\n\t\t:               (instead of printing them to draw interpreter)",
+          "\n\t\t:               (instead of printing them to draw interpreter)"
+          "\n\t\t:  -autoTriang  Enable/disable auto-triangulation for displayed shapes.",
           __FILE__, XDEDRAW_XDisplayTool::XDisplay, g);
 
   di.Add ("XWdump","Doc filename.{gif|xwd|bmp} \t: Dump contents of viewer window to XWD, GIF or BMP file",
index 6a02314ed3e35f5783fe1f6c17621a0fb53bf3e4..1ae651b465825d07790172b4b26dd4d79ab913ca 100644 (file)
@@ -10,7 +10,7 @@ pload XDE
 
 param xstep.cascade.unit M
 stepread [locate_data_file bug25281_tess_infloop_extract.step] a *
-incmesh a_1 0.0002 1
+incmesh a_1 0.0002 -parallel
 
 checktrinfo a_1 -tri -nod
 
index 27ea8b6e14781709bd2b382bb29248f5e51a5c32..9484d873818d17b1e49e280c579539c94ebbb1e5 100644 (file)
@@ -13,6 +13,6 @@ restore [locate_data_file bug23625_a1.brep] a
 # workaround bug 0031426 until fix
 vinit View1
 vdefaults -autoTriang 0
-incmesh a 7.6 12
+incmesh a 7.6
 
 COMPUTE_HLR $viewname $algotype
index 807dcb2a59efa90b13e09907db45007ae6707489..8ed30037535451a24137723aeee524b154a4f370 100644 (file)
@@ -1,3 +1,3 @@
 set command incmesh
 set group advanced
-set parallel ""
+set parallel 0
index 579f49fcc758fe3a24e9a65c29f64e0470f8a5ac..cdd1e764394b251d22ba0a7a7e38f0e711d8c4bc 100644 (file)
@@ -1,3 +1,3 @@
 set command incmesh
 set group advanced
-set parallel -parallel
+set parallel 1
index 5a69d8b26637c930ff0cb53bf473a713b46cebe7..fbcc8b3c9729d2d69001926c100ce464dd0a4f65 100644 (file)
@@ -31,13 +31,13 @@ if { [string compare $command "shading"] == 0 } {
 }
 
 if { [string compare $command "incmesh"] == 0 } {
-    if { [string compare $parallel "-parallel"] != 0 || [info exists count_parallel] == 0 } {
-       set count_parallel 1
+    if { [string compare $parallel "1"] != 0 || [info exists count_parallel] == 0 } {
+        set count_parallel 1
     }
     for {set i 1} {$i <= $count_parallel} {incr i} {
-       tclean res
-       puts "i = $i"
-       incmesh res ${Deflection} ${parallel}
+        tclean res
+        puts "i = $i"
+        incmesh res ${Deflection} -parallel ${parallel}
     }
 }
 
index 007b5372cb5f5827e9d9b7876fd29be741c51721..be09a2056cea19b91d3d884179d8b2d73fe5a26d 100644 (file)
@@ -1,3 +1,3 @@
 set command incmesh
 set group standard
-set parallel ""
+set parallel 0
index 378b383444ba26747969c4eb6d937cb3bf848834..aefc3e6a8bd3ba037a6634cb1c446f21fe0ffa6d 100644 (file)
@@ -1,3 +1,3 @@
 set command incmesh
 set group standard
-set parallel -parallel
+set parallel 1
index 6d358fdb491ee1350f7c7ca31ee62ee7ea20afa1..f8f0192a3bdb00ced81e81cbbc68d4b681fcdbb7 100644 (file)
@@ -8,7 +8,7 @@ pload XDE
 stepread [locate_data_file bug26889_export.step] a *
 
 dchrono t restart
-incmesh a_1 0.01 1
+incmesh a_1 0.01 -parallel
 dchrono t stop counter incmesh
 
 checktrinfo a_1 -tri 525271 -nod 263456 -defl 0.069482224632795617 -tol_abs_defl 1e-6
index d1ae16a3454fbc43c6e4537ddb43fa5059852d27..893cd4f563edbeb5b79c8a62be3f4d89c0b09f68 100644 (file)
@@ -8,7 +8,7 @@ pload XDE
 stepread [locate_data_file bug26889_export.step] a *
 
 dchrono t restart
-incmesh a_1 0.1 1
+incmesh a_1 0.1 -parallel
 dchrono t stop counter incmesh
 
 checktrinfo a_1 -tri 68779 -nod 34737 -defl 0.24900556935704937 -tol_abs_defl 1e-6
index e87d2483e9e308372e72cc22bb0dfbbef790d44a..c5e3a94f6b5825417ac6ec7700f416ea7a92592a 100644 (file)
@@ -8,7 +8,7 @@ pload XDE
 stepread [locate_data_file bug26889_export.step] a *
 
 dchrono t restart
-incmesh a_1 1.0 1
+incmesh a_1 1.0 -parallel
 dchrono t stop counter incmesh
 
 checktrinfo a_1 -tri 12469 -nod 6503 -defl 1.2783003174746328 -tol_abs_defl 1e-6
index 45e593a4838106f9378c135a261b0823c5b6145f..62677d3f4c9a5f53e9aa0b1c546c0fe97440cf44 100644 (file)
@@ -10,10 +10,8 @@ pload MODELING VISUALIZATION
 vinit View1
 vclear
 vaxo
-vsetdispmode 1
-vdefaults -autoTriang off
 pcone c 0 5 10
-vdisplay c
+vdisplay c -dispMode 1 -autoTriang off
 vfit
 
 set aColor [vreadpixel 200 77 rgb name]