From ac79803473edc50b8e9eca6db675513164b8b3ff Mon Sep 17 00:00:00 2001 From: jfa Date: Thu, 15 Jul 2010 10:43:21 +0000 Subject: [PATCH] IMP 0020851 (LimitTolerance). --- .../GEOM/input/limit_tolerance_operation.doc | 24 ++++++++++--- doc/salome/gui/GEOM/input/partition.doc | 6 ++++ .../GEOM/input/shape_processing_operation.doc | 15 +++++++- .../GEOM/input/tui_repairing_operations.doc | 36 ++++++++++++------- 4 files changed, 63 insertions(+), 18 deletions(-) diff --git a/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc index 7f692656d..3767c0c99 100644 --- a/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc +++ b/doc/salome/gui/GEOM/input/limit_tolerance_operation.doc @@ -5,18 +5,32 @@ \n To produce a Limit Tolerance operation in the Main Menu select Repair - > Limit Tolerance. +\image html limit_tolerance_dlg.png + +\n Arguments: 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: +
    +
  1. Try a partition on objects obj1 and obj2.
  2. +
  3. Partition fails.
  4. +
  5. Perform Limit Tolerance on objects obj1 and obj2.
  6. +
  7. Try again the partition.
  8. +
+See also \ref tui_limit_tolerance "TUI example". \n TUI Command: geompy.LimitTolerance(Shape, Tolerance), 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 Arguments: Name + 1 shape + 1 value (new tolerance). - Our TUI Scripts provide you with useful examples of the use of \ref tui_limit_tolerance "Repairing Operations". diff --git a/doc/salome/gui/GEOM/input/partition.doc b/doc/salome/gui/GEOM/input/partition.doc index 6661d12f2..2b3b31eae 100644 --- a/doc/salome/gui/GEOM/input/partition.doc +++ b/doc/salome/gui/GEOM/input/partition.doc @@ -37,6 +37,12 @@ the box, see corresponding \ref partition_picture_3 "picture" below). \n Advanced option: \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 Shape Processing + and Limit Tolerance in such cases. See also \ref + tui_limit_tolerance "TUI example" of shape healing. + \n TUI Command: geompy.MakePartition(ListOfShapes, ListOfTools, ListOfKeepInside, ListOfRemoveInside, Limit, RemoveWebs, ListOfMaterials, KeepNonlimitShapes), where where \em diff --git a/doc/salome/gui/GEOM/input/shape_processing_operation.doc b/doc/salome/gui/GEOM/input/shape_processing_operation.doc index b10f35c6e..7d7c9a406 100644 --- a/doc/salome/gui/GEOM/input/shape_processing_operation.doc +++ b/doc/salome/gui/GEOM/input/shape_processing_operation.doc @@ -3,7 +3,7 @@ \page shape_processing_operation_page Shape Processing \n To produce a Shape Processing operation in the Main Menu -select Repair - > Shape Processing. + select Repair - > Shape Processing. \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 Shape Processing is usefull not only on invalid shapes, + but sometimes also on shapes, that are classified as valid by + the Check functionality. Use it, if some operation (for + example, Partition) fails. + Example of usage: +
    +
  1. Try a partition on objects obj1 and obj2.
  2. +
  3. Partition fails.
  4. +
  5. Perform Shape Processing on objects obj1 and obj2.
  6. +
  7. Try again the partition.
  8. +
+ 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. diff --git a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc index ff562631f..247234037 100644 --- a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc @@ -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 -- 2.39.2