Salome HOME
IMP 0020851 (LimitTolerance).
authorjfa <jfa@opencascade.com>
Thu, 15 Jul 2010 10:43:21 +0000 (10:43 +0000)
committerjfa <jfa@opencascade.com>
Thu, 15 Jul 2010 10:43:21 +0000 (10:43 +0000)
doc/salome/gui/GEOM/input/limit_tolerance_operation.doc
doc/salome/gui/GEOM/input/partition.doc
doc/salome/gui/GEOM/input/shape_processing_operation.doc
doc/salome/gui/GEOM/input/tui_repairing_operations.doc

index 7f692656d0849fed8626dcec310bc3f8bfe330dc..3767c0c991f6bf53c297027ffdf7b559c925b6ef 100644 (file)
@@ -5,18 +5,32 @@
 \n To produce a <b>Limit Tolerance</b> operation in the <b>Main
    Menu</b> select <b>Repair - > Limit Tolerance</b>.
 
+\image html limit_tolerance_dlg.png
+
+\n <b>Arguments:</b> Name + 1 shape + 1 value (new tolerance).
+
 \n It is possible on all kind of shapes.
 
-\n The \b Result will be a \b GEOM_Object. 
+\n The \b Result will be a \b GEOM_Object.
+
+\n This functionality tries to set new value of tolerance for the
+   given shape. But the final tolerance value depends also on the
+   initial shape topology (regards existing gaps) in order to obtain
+   valid resulting shape.
+
+\n Example of usage:
+<ol>
+<li>Try a partition on objects obj1 and obj2.</li>
+<li>Partition fails.</li>
+<li>Perform Limit Tolerance on objects obj1 and obj2.</li>
+<li>Try again the partition.</li>
+</ol>
+See also \ref tui_limit_tolerance "TUI example".
 
 \n <b>TUI Command:</b> <em>geompy.LimitTolerance(Shape, Tolerance),</em>
  where \em Shape is a shape with presumably incorrect tolerance, \em
  Tolerance is a desired value of tolerance.
 
-\image html limit_tolerance_dlg.png
-
-\n <b>Arguments:</b> Name + 1 shape + 1 value (new tolerance).
-
 Our <b>TUI Scripts</b> provide you with useful examples of the use of
 \ref tui_limit_tolerance "Repairing Operations".
 
index 6661d12f234f6f29348fcdedd2c7487570939854..2b3b31eae18dee72666f5959704436f283d49357 100644 (file)
@@ -37,6 +37,12 @@ the box, see corresponding \ref partition_picture_3 "picture" below).
 \n <b>Advanced option:</b>
    \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments".
 
+\note Partition is a kind of complex operation, result of it depends
+      on the initial shapes quality. Sometimes, if partition fails,
+      some healing operations could help. Try <b>Shape Processing</b>
+      and <b>Limit Tolerance</b> in such cases. See also \ref
+      tui_limit_tolerance "TUI example" of shape healing.
+
 \n <b>TUI Command:</b> <em>geompy.MakePartition(ListOfShapes,
 ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs,
 ListOfMaterials, KeepNonlimitShapes),</em> where where \em
index b10f35c6e198fdd1b48becaedc742735227d8596..7d7c9a406715a6340cc8e6ae3ae75bb731cced66 100644 (file)
@@ -3,7 +3,7 @@
 \page shape_processing_operation_page Shape Processing
 
 \n To produce a <b>Shape Processing</b> operation in the <b>Main Menu</b> 
-select <b>Repair - > Shape Processing</b>.
+   select <b>Repair - > Shape Processing</b>.
 \n This operation processes one or more shapes using various operators.
 
 \n The \b Result will be a \b GEOM_Object.
@@ -15,6 +15,19 @@ is a list of operators ("FixShape", "SplitClosedFaces", etc.),
 etc), \em Values is a list of values of parameters placed in the same
 order as in the list of Parameters.
 
+\note <b>Shape Processing</b> is usefull not only on invalid shapes,
+      but sometimes also on shapes, that are classified as valid by
+      the <b>Check</b> functionality. Use it, if some operation (for
+      example, <b>Partition</b>) fails.
+      Example of usage:
+      <ol>
+      <li>Try a partition on objects obj1 and obj2.</li>
+      <li>Partition fails.</li>
+      <li>Perform Shape Processing on objects obj1 and obj2.</li>
+      <li>Try again the partition.</li>
+      </ol>
+      See also \ref tui_limit_tolerance "TUI example".
+
 \n In this dialog box you can select the object that you need to
 process, define its name and operators applied to it during
 processing.
index ff562631f9abc14a80abc5c57b6f79dd98b82e6b..24723403783319e407f03b5347739e2b0fe873e6 100644 (file)
@@ -297,21 +297,33 @@ import geompy
 gg = salome.ImportComponentGUI("GEOM")
 
 # import initial topology
-bad_shape = geompy.ImportBREP("my_bad_shape.brep")
+shape1 = geompy.ImportBREP("my_shape_1.brep")
+shape2 = geompy.ImportBREP("my_shape_2.brep")
 
-# limit tolerance
-tolerance = 1e-07
-good_shape = geompy.LimitTolerance(bad_shape, tolerance)
+geompy.addToStudy(shape1, "Shape 1")
+geompy.addToStudy(shape2, "Shape 2")
 
-# add objects in the study
-id_bad_shape  = geompy.addToStudy(bad_shape, "My Bad Shape")
-id_good_shape = geompy.addToStudy(good_shape, "My Good Shape")
+# perform partition
+try:
+    part = geompy.MakePartition([shape1, shape2])
+except:
+    # limit tolerance
+    tolerance = 1e-07
+    shape1_lt = geompy.LimitTolerance(shape1, tolerance)
+    shape2_lt = geompy.LimitTolerance(shape2, tolerance)
 
-# display the results
-gg.createAndDisplayGO(id_bad_shape)
-gg.setDisplayMode(id_bad_shape, 1)
-gg.createAndDisplayGO(id_good_shape)
-gg.setDisplayMode(id_good_shape, 1) 
+    # process shape
+    good_shape1 = geompy.ProcessShape(shape1_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+    good_shape2 = geompy.ProcessShape(shape2_lt, ["FixShape"], ["FixShape.Tolerance3d"], ["1e-7"])
+
+    geompy.addToStudy(good_shape1, "Shape 1 corrected")
+    geompy.addToStudy(good_shape2, "Shape 2 corrected")
+
+    # perform partition on corrected shapes
+    part = geompy.MakePartition([good_shape1, good_shape2])
+    pass
+
+geompy.addToStudy(part, "Partition")
 \endcode
 
 \anchor tui_add_point_on_edge