diff --git a/doc/salome/gui/GEOM/images/neo-obj7.png b/doc/salome/gui/GEOM/images/neo-obj7.png index 15dfa2376..8d3012107 100755 Binary files a/doc/salome/gui/GEOM/images/neo-obj7.png and b/doc/salome/gui/GEOM/images/neo-obj7.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-OB.png b/doc/salome/gui/GEOM/images/restore-ss-OB.png new file mode 100644 index 000000000..022c284a4 Binary files /dev/null and b/doc/salome/gui/GEOM/images/restore-ss-OB.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-dialog.png b/doc/salome/gui/GEOM/images/restore-ss-dialog.png new file mode 100644 index 000000000..168cba257 Binary files /dev/null and b/doc/salome/gui/GEOM/images/restore-ss-dialog.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-viewer-after.png b/doc/salome/gui/GEOM/images/restore-ss-viewer-after.png new file mode 100644 index 000000000..af13c7f1c Binary files /dev/null and b/doc/salome/gui/GEOM/images/restore-ss-viewer-after.png differ diff --git a/doc/salome/gui/GEOM/images/restore-ss-viewer-before.png b/doc/salome/gui/GEOM/images/restore-ss-viewer-before.png new file mode 100644 index 000000000..6d2e581bf Binary files /dev/null and b/doc/salome/gui/GEOM/images/restore-ss-viewer-before.png differ diff --git a/doc/salome/gui/GEOM/input/creating_compound.doc b/doc/salome/gui/GEOM/input/creating_compound.doc index 30d685ba1..2fdb43263 100644 --- a/doc/salome/gui/GEOM/input/creating_compound.doc +++ b/doc/salome/gui/GEOM/input/creating_compound.doc @@ -10,6 +10,8 @@ Entity - > Build - > Compound. \n TUI Command: geompy.MakeCompound(ListOfShape) \n Arguments: Name + List of shapes. +\n Advanced option: + \ref restore_presentation_parameters_page "Set presentation parameters and subshapes from arguments". \image html neo-obj7.png @@ -20,4 +22,4 @@ Entity - > Build - > Compound. Our TUI Scripts provide you with useful examples of creation of \ref tui_creation_compound "Advanced Geometric Objects". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc b/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc new file mode 100644 index 000000000..134871744 --- /dev/null +++ b/doc/salome/gui/GEOM/input/restore_presentation_parameters.doc @@ -0,0 +1,53 @@ +/*! + +\page restore_presentation_parameters_page Restore presentation parameters and a tree of subshapes + +\n This functionality allows the operation result to inherit colour +and subshapes from its arguments. + +\n To activate this functionality, one should check the "Set +presentation parameters and subshapes from arguments" checkbox in +corresponding dialog. + +\image html restore-ss-dialog.png + +\n Let us view an example to understand, how it works. +Before the partitioning we had box Box_1 with two published faces and +cylinder Cylinder_1 with free published edges. After the partition we +have also resulting object with several subshapes, that corresponds to +operation arguments and their published subshapes. We performed two +partitions: Partition_1 result obtained by partitioning two objects +Box_1 and Cylinder_1 as objects, with no tool, Partiton_2 obtained by +partitioning Box_1 object with Cylinder_1 tool: + +\image html restore-ss-OB.png + +\n If all the shapes and subshapes have their own colours before the +partitioning, the resultiong shape and its automatically generated +subshapes will inherit these colours. + +\n If the resulting shape corresponds to its first argument (like +after transformation or after the boolean operation Cut, or after the +partiton with one object shape), it inherits its colour, and also +inherits its subshapes (like Partition_2). + +\n In the case, when the resulting shape composed from multiple arguments +(like after boolean operations, except Cut, or after the partition with +several object shapes, or it is a compound), it will have default +colour, but its generated subshapes, corresponding to arguments and +their subshapes, will inherit corresponding colours. And in this case +it will have generated subshapes, corresponding to the arguments (like +Partition_1). + +\n See the picture before the partition: + +\image html restore-ss-viewer-before.png + +\n And the picture, displaying only the Partition_2 with subshapes: + +\image html restore-ss-viewer-after.png + +\n You can also call this functionality from your python scripts. +See our TUI Scripts for \ref tui_restore_prs_params "example". + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_basic_operations.doc b/doc/salome/gui/GEOM/input/tui_basic_operations.doc index 14f7c07f9..1250c128d 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_operations.doc @@ -79,4 +79,62 @@ gg.createAndDisplayGO(id_archimede) gg.setDisplayMode(id_archimede,1) \endcode -*/ \ No newline at end of file +\anchor tui_restore_prs_params +

Restore presentation parameters and subshapes

+ +\code +import geompy +import GEOM + +# create a box and a cylinder +box = geompy.MakeBoxDXDYDZ(200, 200, 200) +cyl = geompy.MakeCylinderRH(100, 300) + +# create translated box +vec = geompy.MakeVectorDXDYDZ(100, 50, 0) +tra = geompy.MakeTranslationVector(box, vec) + +# create partition objects +partition1 = geompy.MakePartition([box, cyl]) +partition2 = geompy.MakePartition([box], [cyl]) +partition3 = geompy.MakePartition([box], [tra]) + +# set colours +box.SetColor(SALOMEDS.Color(1,0,0)) +cyl.SetColor(SALOMEDS.Color(0,1,0)) + +# add objects in the study +geompy.addToStudy(box, "Box") +geompy.addToStudy(cyl, "Cylinder") +geompy.addToStudy(vec, "Vector") +geompy.addToStudy(tra, "Translation") +geompy.addToStudy(partition1, "Partition_1") +geompy.addToStudy(partition2, "Partition_2") +geompy.addToStudy(partition3, "Partition_3") + +# Restore presentation parameters and subshapes +# different methods can be used to find the subshapes in the result: +# GetInPlace, GetSame, GetInPlaceByHistory, GetShapesOnShape. +# By default, GetInPlace method is used (GEOM.FSM_GetInPlace) +geompy.RestoreSubShapes(partition1) + +geompy.RestoreSubShapes(partition2, [], GEOM.FSM_GetInPlace) + +# The list of arguments can be used to avoid restoring all arguments, +# but restore only the passed. +geompy.RestoreSubShapes(partition3, [tra], GEOM.FSM_GetInPlaceByHistory) + +# To find subshapes in a transformed shape only one method could be +# used: pass GEOM.FSM_Transformed for that. +# True passed for the last argument, means that the transformed shape +# will inherit colour and subshapes from its first argument (see above +# MakeTranslation). +geompy.RestoreSubShapes(tra, [], GEOM.FSM_Transformed, True) + +# Also we could do this directly with method addToStudy: +partition4 = geompy.MakePartition([box, tra]) +geompy.addToStudy(partition4, "Partition_4", True, [], + GEOM.FSM_GetInPlaceByHistory, False) +\endcode + +*/