0029734: Modeling Algorithms - Compute global properties of tessellated shape
[occt.git] / src / DBRep / DBRep.cxx
index 1295d42..27dd671 100644 (file)
@@ -370,11 +370,22 @@ static Standard_Integer triangles(Draw_Interpretor& ,
 static Standard_Integer tclean(Draw_Interpretor& , 
                               Standard_Integer n, const char** a)
 {
-  if (n < 1) return 1;
-  
-  for (Standard_Integer i = 1; i < n; i++) {
+  if (n == 1) return 1;
+
+  Standard_Integer aStart = 1;
+  Standard_Boolean toRemoveGeometry = Standard_False;
+  if (strcmp(a[1], "-geom") == 0)
+  {
+    aStart++;
+    toRemoveGeometry = Standard_True;
+  }
+
+  for (Standard_Integer i = aStart; i < n; i++) {
     TopoDS_Shape S = DBRep::Get(a[i]);
-    BRepTools::Clean(S);
+    if (toRemoveGeometry)
+      BRepTools::CleanGeometry(S);
+    else
+      BRepTools::Clean(S);
   }
   return 0;
 }
@@ -1412,7 +1423,10 @@ void  DBRep::BasicCommands(Draw_Interpretor& theCommands)
   theCommands.Add("hlr" ,"[no]hlr, rg1, rgn, hid, ang",__FILE__,hlr ,g);
   theCommands.Add("vori","vori [name1 ...], edges are colored by orientation (see vconn)",__FILE__,dispor,g);
   theCommands.Add("triangles", "triangles [name1]..., display triangles of shapes if exists",__FILE__, triangles, g);
-  theCommands.Add("tclean", "tclean [name1]..., erase triangulations and polygons on triangulations from shapes",__FILE__, tclean, g); 
+  theCommands.Add("tclean", "tclean [-geom] [name1]..., depending on using or not key -geom, \n" 
+                   "\t erase geometry objects from shapes - key is used or \n"
+                   "\t erase triangulations and polygons on triangulations from shapes - key is omitted \n",
+                    __FILE__, tclean, g); 
   theCommands.Add("polygons", "polygons [name1]..., display polygons of shapes if exists",__FILE__, polygons, g);
   theCommands.Add("vconn","vconn [name1 ...] , edges are colored by number of faces (see vori)",__FILE__,dispor,g);
   theCommands.Add("discretisation","discretisation [nbpoints]",__FILE__,discretisation,g);