]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Implementation of the task #3109 : Feature Copy. Documentation and translation.
authormpv <mpv@opencascade.com>
Mon, 9 Dec 2019 13:29:44 +0000 (16:29 +0300)
committermpv <mpv@opencascade.com>
Mon, 9 Dec 2019 13:29:44 +0000 (16:29 +0300)
src/FeaturesPlugin/FeaturesPlugin_msg_fr.ts
src/FeaturesPlugin/Test/TestCopyMoveResult.py
src/FeaturesPlugin/doc/FeaturesPlugin.rst
src/FeaturesPlugin/doc/TUI_copyFeature.rst [new file with mode: 0644]
src/FeaturesPlugin/doc/copyFeature.rst [new file with mode: 0644]
src/FeaturesPlugin/doc/examples/copy.py [new file with mode: 0644]
src/FeaturesPlugin/doc/images/Copy.png [new file with mode: 0644]
src/FeaturesPlugin/doc/images/CreatedCopy.png [new file with mode: 0644]
src/FeaturesPlugin/doc/images/copy_btn.png [new file with mode: 0644]
src/FeaturesPlugin/doc/unionFeature.rst

index 95b2e83e2bd3bc8f2e193af7c251c02fc1efbc64..1a043413bbe5ded849c2ae1f481d21515f0d4cae 100644 (file)
       <source>Recover</source>
       <translation>Récupérer</translation>
     </message>
+    <message>
+      <source>Copy</source>
+      <translation>Copie</translation>
+    </message>
     <message>
       <source>Remove Sub-Shapes</source>
       <translation>Supprimer les sous-formes</translation>
     </message>
   </context>
 
+  <!-- Copy -->
+  <context>
+    <name>Copy</name>
+    <message>
+      <source>Copy</source>
+      <translation>Copie</translation>
+    </message>
+    <message>
+      <source>Copies results or sub-results</source>
+      <translation>Copie les résultats ou les sous-résultats</translation>
+    </message>
+  </context>
+  <context>
+    <name>Recover:objects</name>
+    <message>
+      <source>Sources:</source>
+      <translation>Sources:</translation>
+    </message>
+    <message>
+      <source>Select copied objects</source>
+      <translation>Sélectionnez les objets copiés</translation>
+    </message>
+  </context>
+  <context>
+    <name>Recover:number</name>
+    <message>
+      <source>Nb copies</source>
+      <translation>Nb de copies</translation>
+    </message>
+    <message>
+      <source>Number of copies</source>
+      <translation>Nombre de copies</translation>
+    </message>
+  </context>
+
   <!-- Remove_SubShapes -->
   <context>
     <name>Remove_SubShapes</name>
index bde1d85c1fbc9c4ff62418388904e0923b03ec90..cebb307ac48c9f98fa1f98114b6fa33cb498bc30 100644 (file)
@@ -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())
index f701574c7a0d137ee74088fce0e64a379b6e8a8f..6298dd1f885239c969bcc99f8085fb6dbb5f4fb4 100644 (file)
@@ -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 (file)
index 0000000..4d7bafb
--- /dev/null
@@ -0,0 +1,12 @@
+
+  .. _tui_create_copy:
+
+Create Copy
+============
+
+.. literalinclude:: examples/copy.py
+    :linenos:
+    :language: python
+
+:download:`Download this script <examples/copy.py>` 
+   
diff --git a/src/FeaturesPlugin/doc/copyFeature.rst b/src/FeaturesPlugin/doc/copyFeature.rst
new file mode 100644 (file)
index 0000000..9a8be49
--- /dev/null
@@ -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 (file)
index 0000000..1e81c0e
--- /dev/null
@@ -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 (file)
index 0000000..5304873
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 (file)
index 0000000..f25513a
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 (file)
index 0000000..7e11163
Binary files /dev/null and b/src/FeaturesPlugin/doc/images/copy_btn.png differ
index 3fbaf42c1bad584a0ad9441e851a3fce12307c39..1220c84d0f4b1117c0ff4b37cd0fb05e656d7e16 100644 (file)
@@ -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