From: mpv Date: Mon, 9 Dec 2019 13:29:44 +0000 (+0300) Subject: Implementation of the task #3109 : Feature Copy. Documentation and translation. X-Git-Tag: V9_5_0a1~114 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8f36dafd50feb0050fa09601fe31a5395eb70ea4;p=modules%2Fshaper.git Implementation of the task #3109 : Feature Copy. Documentation and translation. --- diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts index 95b2e83e2..1a043413b 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts @@ -57,6 +57,10 @@ Recover Récupérer + + Copy + Copie + Remove Sub-Shapes Supprimer les sous-formes @@ -1123,6 +1127,41 @@ + + + Copy + + Copy + Copie + + + Copies results or sub-results + Copie les résultats ou les sous-résultats + + + + Recover:objects + + Sources: + Sources: + + + Select copied objects + Sélectionnez les objets copiés + + + + Recover:number + + Nb copies + Nb de copies + + + Number of copies + Nombre de copies + + + Remove_SubShapes diff --git a/src/FeaturesPlugin/Test/TestCopyMoveResult.py b/src/FeaturesPlugin/Test/TestCopyMoveResult.py index bde1d85c1..cebb307ac 100644 --- a/src/FeaturesPlugin/Test/TestCopyMoveResult.py +++ b/src/FeaturesPlugin/Test/TestCopyMoveResult.py @@ -59,8 +59,9 @@ from ModelAPI import * aFactory = ModelAPI_Session.get().validators() assert(aFactory.validate(Group_1.feature())) selectionList = Group_1.feature().selectionList("group_list") -assert(selectionList.size() == 1) # still the same solid +assert(selectionList.size() == 2) # still the same solid + the copied and filleted -assert(selectionList.value(0).namingName() == "Fillet_1_1_1") +assert(selectionList.value(0).namingName() == "Extrusion_1_1_1") +assert(selectionList.value(1).namingName() == "Fillet_1_1_1") assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/doc/FeaturesPlugin.rst b/src/FeaturesPlugin/doc/FeaturesPlugin.rst index f701574c7..6298dd1f8 100644 --- a/src/FeaturesPlugin/doc/FeaturesPlugin.rst +++ b/src/FeaturesPlugin/doc/FeaturesPlugin.rst @@ -13,6 +13,7 @@ Features plug-in provides a set of common topological operations. It implements angularCopyFeature.rst chamferFeature.rst commonFeature.rst + copyFeature.rst cutFeature.rst extrusionCutFeature.rst extrusionFeature.rst diff --git a/src/FeaturesPlugin/doc/TUI_copyFeature.rst b/src/FeaturesPlugin/doc/TUI_copyFeature.rst new file mode 100644 index 000000000..4d7bafb4d --- /dev/null +++ b/src/FeaturesPlugin/doc/TUI_copyFeature.rst @@ -0,0 +1,12 @@ + + .. _tui_create_copy: + +Create Copy +============ + +.. literalinclude:: examples/copy.py + :linenos: + :language: python + +:download:`Download this script ` + diff --git a/src/FeaturesPlugin/doc/copyFeature.rst b/src/FeaturesPlugin/doc/copyFeature.rst new file mode 100644 index 000000000..9a8be49ef --- /dev/null +++ b/src/FeaturesPlugin/doc/copyFeature.rst @@ -0,0 +1,53 @@ +.. |copy_btn.icon| image:: images/copy_btn.png + +Copy +===== + +Copy feature makes duplicates of the selected features, results, sub-results and sub-shapes. For the whole feature selected +all results of this feature are copied. The referenced arguments of this feature are not concealed. The history behavior of +copy is specific: *Move to the End* of groups will move to all copy-results. For an example, if a face of a box was selected +for a group and a copy of this box was done, the *Move to the End* of this group will cause two faces appeared in this Group: +the original one and the copy. + + +To create a Copy in the active part: + +#. select in the Main Menu *Features - > Copy* item or +#. click |copy_btn.icon| **Copy** button in the toolbar + +The following property panel will be opened: + +.. image:: images/Copy.png + :align: center + +.. centered:: + **Copy operation** + +Here it is necessary to select some objects. Only results and sub-results and their sub-shapes located in the folder **Results** can be selected and copied. +Also it is possible to increase the number of resulting copies. + +**Apply** button creates a copy. + +**Cancel** button cancels the operation. + +**TUI Command**: + +.. py:function:: model.addCopy(Part_doc, objects, number_of_copies) + + :param part: The current part object. + :param objects: A list of objects. + :param number_of_copies: A number of resulting copies. + :return: Result feature Copy. + +Result +"""""" + +The Result of the operation will be one or several copies of the selected shapes located in the same place: + +.. image:: images/CreatedCopy.png + :align: center + +.. centered:: + **Copy created** + +**See Also** a sample TUI Script of :ref:`tui_create_copy` operation. diff --git a/src/FeaturesPlugin/doc/examples/copy.py b/src/FeaturesPlugin/doc/examples/copy.py new file mode 100644 index 000000000..1e81c0e66 --- /dev/null +++ b/src/FeaturesPlugin/doc/examples/copy.py @@ -0,0 +1,18 @@ +from salome.shaper import model + +model.begin() +partSet = model.moduleDocument() +Part_1 = model.addPart(partSet) +Part_1_doc = Part_1.document() +Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY")) +SketchCircle_1 = Sketch_1.addCircle(7, 11, 2) +model.do() +Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2r")], model.selection(), 10, 0) +Extrusion_1.result().setTransparency(0.75) +Copy_1 = model.addCopy(Part_1_doc, [model.selection("FACE", "Extrusion_1_1/From_Face"), model.selection("FACE", "Extrusion_1_1/To_Face")], 2) +Copy_1.result().setColor(0, 170, 0) +Copy_1.results()[1].setColor(0, 170, 0) +Copy_1.results()[2].setColor(0, 170, 0) +Copy_1.results()[3].setColor(0, 170, 0) + +model.end() diff --git a/src/FeaturesPlugin/doc/images/Copy.png b/src/FeaturesPlugin/doc/images/Copy.png new file mode 100644 index 000000000..530487386 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/Copy.png differ diff --git a/src/FeaturesPlugin/doc/images/CreatedCopy.png b/src/FeaturesPlugin/doc/images/CreatedCopy.png new file mode 100644 index 000000000..f25513a46 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/CreatedCopy.png differ diff --git a/src/FeaturesPlugin/doc/images/copy_btn.png b/src/FeaturesPlugin/doc/images/copy_btn.png new file mode 100644 index 000000000..7e1116367 Binary files /dev/null and b/src/FeaturesPlugin/doc/images/copy_btn.png differ diff --git a/src/FeaturesPlugin/doc/unionFeature.rst b/src/FeaturesPlugin/doc/unionFeature.rst index 3fbaf42c1..1220c84d0 100644 --- a/src/FeaturesPlugin/doc/unionFeature.rst +++ b/src/FeaturesPlugin/doc/unionFeature.rst @@ -29,7 +29,7 @@ Here it is necessary to select some objects. Only faces with shared edges or sol .. py:function:: model.addUnion(Part_doc, objects) :param part: The current part object. - :param list: A list of objects. + :param objects: A list of objects. :return: Result object. Result