]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Update for documentation and some fixes
authorNATHALIE GORE <ng13417n@dsp0897499.atlas.edf.fr>
Tue, 1 Oct 2019 13:24:48 +0000 (15:24 +0200)
committerNATHALIE GORE <ng13417n@dsp0897499.atlas.edf.fr>
Tue, 1 Oct 2019 13:24:48 +0000 (15:24 +0200)
15 files changed:
src/PythonAddons/doc/addons_Features.rst
src/PythonAddons/doc/compoundVerticesFeature.rst [new file with mode: 0644]
src/PythonAddons/doc/images/compound.png [new file with mode: 0644]
src/PythonAddons/doc/images/compoundVertices.png [new file with mode: 0644]
src/PythonAddons/doc/images/compoundVerticesPanel.png [new file with mode: 0644]
src/PythonAddons/doc/images/importParameters.png [new file with mode: 0644]
src/PythonAddons/doc/images/importParametersPanel.png [new file with mode: 0644]
src/PythonAddons/doc/importParametersFeature.rst [new file with mode: 0644]
src/PythonAddons/macros/box/__init__.py [deleted file]
src/PythonAddons/macros/box/feature.py [deleted file]
src/PythonAddons/macros/box/icons/box_ico.png [deleted file]
src/PythonAddons/macros/box/widget.xml [deleted file]
src/PythonAddons/macros/compoundVertices/feature.py
src/PythonAddons/macros/compoundVertices/widget.xml
src/PythonAddons/macros/importParameters/widget.xml

index ddeac8f89dfcf1b87f8fcac560c834953ec1f8ea..1db6329d641b948d2c99f16223f01903ea839a8c 100644 (file)
@@ -13,10 +13,12 @@ A feature description includes 4 files:
 - feature.py with python commands, 
 - icon.png with image of button in the toolbar (the file is located at sub-folder /icons).
 
-Two examples of already created custom features are:
+Some examples of already created custom features are:
 
 .. toctree::
    :titlesonly:
    :maxdepth: 1
 
    rectangleFeature.rst
+   compoundVerticesFeature.rst
+   importParametersFeature.rst
diff --git a/src/PythonAddons/doc/compoundVerticesFeature.rst b/src/PythonAddons/doc/compoundVerticesFeature.rst
new file mode 100644 (file)
index 0000000..00cc89a
--- /dev/null
@@ -0,0 +1,39 @@
+.. _create_compound_Vertices:
+.. |compoundVertices.icon|    image:: images/compound.png
+
+compound Vertices
+=================
+
+Compound Vertices is a feature and can be edited after execution.
+It allows creation of several points basing on XYZ coords file.
+
+.. warning::
+  Please note that it is better to limit yourself to create a maximum of 100 points.
+
+These set of points will be grouped in a compound and can be used for others features. 
+
+To add a new set of points:
+
+#. select in the Main Menu *Macros - > Points set* item  or
+#. click |compoundVertices.icon| **Points set** button in Macros toolbar:
+
+The following property panel appears:
+
+.. image:: images/compoundVerticesPanel.png
+  :align: center
+
+.. centered::
+   set of Points
+
+Select your points file and define a separator if it's different that " " in your points file
+
+Result
+""""""
+
+A resulting compound will contain the points 
+
+.. image:: images/compoundVertices.png
+          :align: center
+
+.. centered::
+   Points
diff --git a/src/PythonAddons/doc/images/compound.png b/src/PythonAddons/doc/images/compound.png
new file mode 100644 (file)
index 0000000..5e119b3
Binary files /dev/null and b/src/PythonAddons/doc/images/compound.png differ
diff --git a/src/PythonAddons/doc/images/compoundVertices.png b/src/PythonAddons/doc/images/compoundVertices.png
new file mode 100644 (file)
index 0000000..9f624f8
Binary files /dev/null and b/src/PythonAddons/doc/images/compoundVertices.png differ
diff --git a/src/PythonAddons/doc/images/compoundVerticesPanel.png b/src/PythonAddons/doc/images/compoundVerticesPanel.png
new file mode 100644 (file)
index 0000000..e24bf2e
Binary files /dev/null and b/src/PythonAddons/doc/images/compoundVerticesPanel.png differ
diff --git a/src/PythonAddons/doc/images/importParameters.png b/src/PythonAddons/doc/images/importParameters.png
new file mode 100644 (file)
index 0000000..3b382b9
Binary files /dev/null and b/src/PythonAddons/doc/images/importParameters.png differ
diff --git a/src/PythonAddons/doc/images/importParametersPanel.png b/src/PythonAddons/doc/images/importParametersPanel.png
new file mode 100644 (file)
index 0000000..f395df5
Binary files /dev/null and b/src/PythonAddons/doc/images/importParametersPanel.png differ
diff --git a/src/PythonAddons/doc/importParametersFeature.rst b/src/PythonAddons/doc/importParametersFeature.rst
new file mode 100644 (file)
index 0000000..3fdfc6f
--- /dev/null
@@ -0,0 +1,27 @@
+.. _create_import_Parameters:
+.. |importParameters.icon|    image:: images/importParameters.png
+
+import Parameters
+=================
+
+Import Parameters is a macro-feature and can not be edited after execution.
+It allows creation of several parameters basing on variables-values file.
+
+To import parameters:
+
+#. select in the Main Menu *Macros - > import Parameters* item  or
+#. click |importParameters.icon| **import Parameters** button in Macros toolbar:
+
+The following property panel appears:
+
+.. image:: images/importParametersPanel.png
+  :align: center
+
+.. centered::
+   Import Parameters
+
+
+Result
+""""""
+
+Several parameters are automatically created.
diff --git a/src/PythonAddons/macros/box/__init__.py b/src/PythonAddons/macros/box/__init__.py
deleted file mode 100644 (file)
index 1b78cf4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-## Copyright (C) 2014-20xx  OPEN CASCADE
diff --git a/src/PythonAddons/macros/box/feature.py b/src/PythonAddons/macros/box/feature.py
deleted file mode 100644 (file)
index 5af78bd..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-## Copyright (C) 2014-20xx  OPEN CASCADE
-
-"""
-Box macro-feature
-"""
-
-from salome.shaper import model
-from salome.shaper import geom
-
-
-class BoxFeature(model.Feature):
-    """An example of feature implementation.
-    """
-
-# Initializations
-
-    def __init__(self):
-        """x.__init__(...) initializes x; see x.__class__.__doc__ for signature"""
-        model.Feature.__init__(self)
-
-    @staticmethod
-    def ID():
-        """Return Id of the feature."""
-        return "Box_script"
-
-    @staticmethod
-    def WIDTH_ID():
-        """Returns ID of Width parameter."""
-        return "width"
-
-    @staticmethod
-    def LENGTH_ID():
-        """Returns ID of Length parameter."""
-        return "length"
-
-    @staticmethod
-    def HEIGHT_ID():
-        """Returns ID of Height parameter."""
-        return "height"
-
-    def getKind(self):
-        """Override Feature.getKind()"""
-        return BoxFeature.ID()
-
-
-# Creation of the box at default size
-
-    def initAttributes(self):
-        """Override Feature.initAttributes()"""
-        # Creating the input arguments of the feature
-        self.addRealInput(self.WIDTH_ID())
-        self.addRealInput(self.LENGTH_ID())
-        self.addRealInput(self.HEIGHT_ID())
-
-        # Creating the base of the box with unit values
-        mypart = model.activeDocument()
-        xoy = model.defaultPlane("XOY")
-
-        # A base of the geometry
-        self.base = model.addSketch(mypart, xoy)
-
-        p1 = geom.Pnt2d(0, 0)
-        p2 = geom.Pnt2d(0, 1)
-        p3 = geom.Pnt2d(1, 1)
-        p4 = geom.Pnt2d(1, 0)
-
-        line = model.addPolygon(self.base, p1, p2, p3, p4)
-
-        self.base.setFixed(line[0].startPoint())
-        self.base.setVertical(line[0])
-
-        # Setting the size of the base with default values
-        # Width
-        self.width = self.base.setLength(line[3], 50)  # Keeps the constraint for edition
-        # Length
-        self.length = self.base.setLength(line[0], 50)  # Keeps the constraint for edition
-
-        # Keeping the rectangle
-        self.base.setParallel(line[0], line[2])
-        self.base.setParallel(line[1], line[3])
-        self.base.setPerpendicular(line[0], line[3])
-
-        # execute sketch
-        mypart.setCurrentFeature(self.base.feature(), False)
-        model.updateFeatures()
-
-        # Creating the extrusion (the box) at default size
-        # A box result
-        self.box = model.addExtrusion(mypart, self.base.selectFace(), 50)
-        self.box.setNestedSketch(self.base)
-#       self.box.setName(self.name())
-
-# Edition of the box at user size
-
-    def execute(self):
-        """F.execute() -- execute the feature"""
-        # Retrieving the user inputs
-        width = self.real(self.WIDTH_ID())
-        length = self.real(self.LENGTH_ID())
-        height = self.real(self.HEIGHT_ID())
-
-        # Editing the box
-        if width.text() == "":
-            self.base.setValue(self.width, width.value())
-        else:
-            self.base.setValue(self.width, width.text())
-
-        if length.text() == "":
-            self.base.setValue(self.length, length.value())
-        else:
-            self.base.setValue(self.length, length.text())
-
-        if (height.text() == ""):
-            self.box.setSize(height.value())
-        else:
-            self.box.setSize(height.text())
-
-        # Publishing the result: not needed for Macro feature
-        # self.addResult( self.box.result() )
-
-    def isMacro(self):
-        """Override Feature.initAttributes().
-        F.isMacro() -> True
-
-        Box feature is macro: removes itself on the creation transaction
-        finish.
-        """
-        return True
diff --git a/src/PythonAddons/macros/box/icons/box_ico.png b/src/PythonAddons/macros/box/icons/box_ico.png
deleted file mode 100644 (file)
index 104a1ed..0000000
Binary files a/src/PythonAddons/macros/box/icons/box_ico.png and /dev/null differ
diff --git a/src/PythonAddons/macros/box/widget.xml b/src/PythonAddons/macros/box/widget.xml
deleted file mode 100644 (file)
index 3e682e5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- Copyright (C) 2014-20xx  OPEN CASCADE -->\r
-<source>\r
-  <workbench id="Macros" document="Part">\r
-    <group id="Samples">\r
-\r
-      <feature id="Box_script" title="Box" tooltip="Create a box parallel to xyz by extruding a rectangular"\r
-            icon="icons/Addons/box_ico.png"\r
-            helpfile="boxFeature.html">\r
-        <doublevalue id="width"  label="Width " min="0" step="1.0" default="50" tooltip="Box width">\r
-          <validator id="GeomValidators_Positive"/>\r
-        </doublevalue>\r
-        <doublevalue id="length" label="Length " min="0" step="1.0" default="50" tooltip="Box length">\r
-          <validator id="GeomValidators_Positive"/>\r
-        </doublevalue>\r
-        <doublevalue id="height" label="Height " min="0" step="1.0" default="50" tooltip="Box height">\r
-          <validator id="GeomValidators_Positive"/>\r
-        </doublevalue>\r
-      </feature>\r
-\r
-    </group>\r
-  </workbench>\r
-</source>\r
index 9b33c7fb50b852189f2117cecb26208043fdec95..bf5ce564b89506f0d73898da78a7c5e25310779c 100644 (file)
@@ -2,6 +2,7 @@
 Author: Nathalie Gore
 """
 
+from qtsalome import QMessageBox
 from salome.shaper import model
 from salome.shaper import geom
 import ModelAPI
@@ -77,6 +78,9 @@ class compoundVertices(model.Feature):
             with open(filepath) as file:
                 for line in file:
                     coord = line.split(self.separator)
+                    if len(coord) != 3:
+                        #QMessageBox.warning( self, 'Error!', '3D coords waited!' )
+                        return
                     x = float(coord[0]); y = float(coord[1]); z = float(coord[2]);
                     point = model.addPoint(part, x,y,z); point.execute(True); self.lfeatures.append(point)
                     vertex = model.addVertex(part, [point.result()]); vertex.execute(True); self.lfeatures.append(vertex)
index 738a90cbe5fc69c20bc74dbc96a05d8e35228bf8..75e5a6c21b76133b20e6a5686325e8e0d6374f97 100644 (file)
@@ -2,8 +2,13 @@
   <workbench id="Macros" document="Part">\r
     <group id="Samples">\r
 \r
-      <feature id="compoundVertices" title="Points set" tooltip="Import a set of construction points" icon="icons/Addons/import.png">\r
-        <file_selector id="file_path" title="Import file" path="">\r
+      <feature\r
+        id="compoundVertices"\r
+        title="Points set"\r
+        tooltip="Import a set of construction points"\r
+        icon="icons/Addons/import.png"\r
+        helpfile="compoundVerticesFeature.html">\r
+        <file_selector id="file_path" title="Import txt file (X Y Z)" path="">\r
         </file_selector>\r
         <stringvalue id="separator"  label="Separator (optional): ">\r
         </stringvalue>\r
index caad1409a6000fad56ca689be8d94d6ff0459660..0865719931043ea94664e7f280e97d9098c8588c 100644 (file)
@@ -2,7 +2,11 @@
   <workbench id="Macros" document="Part">\r
     <group id="Samples">\r
 \r
-      <feature id="importParameters" title="List of Parameters" tooltip="Import a set of parameters" icon="icons/Addons/parameters.png">\r
+      <feature id="importParameters"\r
+        title="List of Parameters"\r
+        tooltip="Import a set of parameters"\r
+        icon="icons/Addons/parameters.png"\r
+        helpfile="importParametersFeature.html">\r
         <file_selector id="file_path" title="Import file" path="">\r
         </file_selector>\r
       </feature>\r