Salome HOME
Remove of Box macro feature V9_3_0a2
authormpv <mpv@opencascade.com>
Thu, 7 Mar 2019 07:40:24 +0000 (10:40 +0300)
committermpv <mpv@opencascade.com>
Thu, 7 Mar 2019 07:40:24 +0000 (10:40 +0300)
17 files changed:
src/PythonAddons/CMakeLists.txt
src/PythonAddons/PythonAddons_msg_en.ts
src/PythonAddons/addons_Features.py
src/PythonAddons/addons_Features.xml.in
src/PythonAddons/doc/addons_Features.rst
src/PythonAddons/doc/boxFeature.rst [deleted file]
src/PythonAddons/doc/examples/box/feature.py [deleted file]
src/PythonAddons/doc/examples/box/widget.xml [deleted file]
src/PythonAddons/doc/images/Boxes.png [deleted file]
src/PythonAddons/doc/images/box_ico.png [deleted file]
src/PythonAddons/doc/images/box_property_panel.png [deleted file]
src/PythonAddons/doc/pyFile_boxFeature.rst [deleted file]
src/PythonAddons/doc/xmlFile_boxFeature.rst [deleted file]
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]

index 2cbae61b2c49034d9ffefbee8aea4c27757e036b..4dad90f28d3c1816f5045b49ca784f04f81b969b 100644 (file)
@@ -38,7 +38,7 @@ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/addons_Features.xml DESTINATION ${SHAP
 
 INSTALL(FILES __init__.py DESTINATION ${SHAPER_INSTALL_ADDONS})
 INSTALL(DIRECTORY macros DESTINATION ${SHAPER_INSTALL_ADDONS})
-INSTALL(DIRECTORY macros/box/icons/ macros/rectangle/icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Addons)
+INSTALL(DIRECTORY macros/rectangle/icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Addons)
 INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES})
 
 INCLUDE(UnitTest)
index 6807ced78c65853a60480e3d656344bd2bdfec88..305ed4131767bf8eecf7e9502b42a027cc6122ac 100644 (file)
@@ -1,116 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.0" language="en_US">
-<context>
-  <name>Box:Model_FeatureValidator</name>
-  <message>
-    <source>Attribute "height" is not initialized.</source>
-    <translation>Height of the box is not defined.</translation>
-  </message>
-</context>
-<context>
-  <name>Box:height:GeomValidators_Positive</name>
-  <message>
-    <source>Double is not initialized.</source>
-    <translation>Height of the box is not defined.</translation>
-  </message>
-</context>
-<context>
-  <name>Box:height:GeomValidators_Positive</name>
-  <message>
-    <source>Value is too small.</source>
-    <translation>Height of the box is too small.</translation>
-  </message>
-</context>
-<context>
-  <name>Box:height:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not initialized.</source>
-    <translation>Height of the box is not defined.</translation>
-  </message>
-</context>
-<context>
-  <name>Box:height:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not positive.</source>
-    <translation>Height of the box is too small.</translation>
-  </message>
-</context>
-<context>
-  <name>Box:Model_FeatureValidator</name>
-  <message>
-    <source>Attribute "width" is not initialized.</source>
-    <translation>Set the box width</translation>
-  </message>
-</context>
-<context>
-  <name>Box:Model_FeatureValidator</name>
-  <message>
-    <source>Attribute "length" is not initialized.</source>
-    <translation>Set the box length</translation>
-  </message>
-</context>
-<context>
-  <name>Box:Model_FeatureValidator</name>
-  <message>
-    <source>Attribute "height" is not initialized.</source>
-    <translation>Set the box height</translation>
-  </message>
-</context>
-<context>
-  <name>Box:width:GeomValidators_Positive</name>
-  <message>
-    <source>Double is not initialized.</source>
-    <translation>Set the box width</translation>
-  </message>
-</context>
-<context>
-  <name>Box:width:GeomValidators_Positive</name>
-  <message>
-    <source>Value is too small.</source>
-    <translation>The box width is too small</translation>
-  </message>
-</context>
-<context>
-  <name>Box:width:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not initialized.</source>
-    <translation></translation>
-  </message>
-</context>
-<context>
-  <name>Box:width:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not positive.</source>
-    <translation></translation>
-  </message>
-</context>
-<context>
-  <name>Box:length:GeomValidators_Positive</name>
-  <message>
-    <source>Double is not initialized.</source>
-    <translation>Set the box length</translation>
-  </message>
-</context>
-<context>
-  <name>Box:length:GeomValidators_Positive</name>
-  <message>
-    <source>Value is too small.</source>
-    <translation>The box width is too small</translation>
-  </message>
-</context>
-<context>
-  <name>Box:length:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not initialized.</source>
-    <translation></translation>
-  </message>
-</context>
-<context>
-  <name>Box:length:GeomValidators_Positive</name>
-  <message>
-    <source>Integer is not positive.</source>
-    <translation></translation>
-  </message>
-</context>
 </TS>
index 50f82085613d827d7c11ab3f21fe9c2ed81fba0e..d28db61ab6a461154707c619d61ac6819bf3d976 100644 (file)
@@ -21,7 +21,6 @@
 """
 
 import ModelAPI
-from macros.box.feature       import BoxFeature
 from macros.rectangle.feature import SketchPlugin_Rectangle
 
 
@@ -42,10 +41,7 @@ class PythonFeaturesPlugin(ModelAPI.ModelAPI_Plugin):
         """Override ModelAPI_Plugin.createFeature()"""
         aFeature = None
 
-        if theFeatureID == BoxFeature.ID():
-            aFeature = BoxFeature().__disown__()
-
-        elif theFeatureID == SketchPlugin_Rectangle.ID():
+        if theFeatureID == SketchPlugin_Rectangle.ID():
             aFeature = SketchPlugin_Rectangle().__disown__()
 
         else:
index 68b168192ba00062ffa07df219d63249ca44bd4f..f0190ba6293862a1e5b75a7a4ecc628fcc3a7dcb 100644 (file)
@@ -1,4 +1,3 @@
 <plugin>
-  <source path="@ADDONS_FOLDER_PATH@/macros/box/widget.xml"/>
   <source path="@ADDONS_FOLDER_PATH@/macros/rectangle/widget.xml"/>
 </plugin>
index da4b661b878b16347e152d53025dd43818c1f930..ddeac8f89dfcf1b87f8fcac560c834953ec1f8ea 100644 (file)
@@ -19,5 +19,4 @@ Two examples of already created custom features are:
    :titlesonly:
    :maxdepth: 1
 
-   boxFeature.rst
    rectangleFeature.rst
diff --git a/src/PythonAddons/doc/boxFeature.rst b/src/PythonAddons/doc/boxFeature.rst
deleted file mode 100644 (file)
index 28d0d5d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-Box
-===
-
-Custom files for  **Box** feature are:
-
--  empty __init__.py,
-- :ref:`create_custom_box_py`,
-- :ref:`create_custom_box_xml`,
-- icon.png located at sub-folder */icons*.
-
-.. image:: images/box_ico.png
-   :align: center
-
-.. centered::
-   File icon.png
-
-The custom  **Box** feature creates a box solid by extrusion of rectangle.
-
-To create a Box in the active part:
-
-#. select in the Main Menu *Macros - > Box* item  or
-#. click **Box** button in the Macros toolbar corresponding to file icon.png:
-
-The following property panel appears. 
-
-.. image:: images/box_property_panel.png
-  :align: center
-
-.. centered::
-  Create a box
-
-Input fields: 
-
-- **Width**, **Length**, **Height** are sizes of the box along the corresponding coordinate axes. The box will be created starting from the origin.   
-
-Result
-""""""
-
-The Result of operation will be Extrusion and Sketch. 
-
-The edges of the box will be parallel to the coordinate axes.
-
-.. image:: images/Boxes.png
-          :align: center
-                  
-.. centered::
-   Created box
\ No newline at end of file
diff --git a/src/PythonAddons/doc/examples/box/feature.py b/src/PythonAddons/doc/examples/box/feature.py
deleted file mode 100644 (file)
index c669ec0..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-"""
-Box macro-feature
-Authors: Renaud Nedelec - Daniel Brunier-Coulin
-"""
-
-from salome.shaper import model
-from salome.shaper import geom
-
-
-class BoxFeature(model.Feature):
-    """An example of Box feature implementation.
-
-    BoxFeature() -> Box
-    """
-
-# 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)
-
-# 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/doc/examples/box/widget.xml b/src/PythonAddons/doc/examples/box/widget.xml
deleted file mode 100644 (file)
index b9752fa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<source>
-  <workbench id="Macros" document="Part">
-    <group id="Samples">
-
-      <feature id="Box_script" title="Box" tooltip="Create a box parallel to xyz by extruding a rectangular" icon="icons/Addons/box_ico.png"
-            helpfile="boxFeature.html">
-        <doublevalue id="width"  label="Width: " min="0" step="1.0" default="50" tooltip="Box width">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-        <doublevalue id="length" label="Length: " min="0" step="1.0" default="50" tooltip="Box length">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-        <doublevalue id="height" label="Height: " min="0" step="1.0" default="50" tooltip="Box height">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-      </feature>
-
-    </group>
-  </workbench>
-</source>
diff --git a/src/PythonAddons/doc/images/Boxes.png b/src/PythonAddons/doc/images/Boxes.png
deleted file mode 100644 (file)
index 01ccf5f..0000000
Binary files a/src/PythonAddons/doc/images/Boxes.png and /dev/null differ
diff --git a/src/PythonAddons/doc/images/box_ico.png b/src/PythonAddons/doc/images/box_ico.png
deleted file mode 100644 (file)
index 104a1ed..0000000
Binary files a/src/PythonAddons/doc/images/box_ico.png and /dev/null differ
diff --git a/src/PythonAddons/doc/images/box_property_panel.png b/src/PythonAddons/doc/images/box_property_panel.png
deleted file mode 100644 (file)
index dfe6774..0000000
Binary files a/src/PythonAddons/doc/images/box_property_panel.png and /dev/null differ
diff --git a/src/PythonAddons/doc/pyFile_boxFeature.rst b/src/PythonAddons/doc/pyFile_boxFeature.rst
deleted file mode 100644 (file)
index dd2f5fa..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-  .. _create_custom_box_py:
-
-File feature.py 
-===============
-
-.. literalinclude:: examples/box/feature.py   
-    :linenos:
-    :language: python
-
-:download:`Download this script <examples/box/feature.py>`
\ No newline at end of file
diff --git a/src/PythonAddons/doc/xmlFile_boxFeature.rst b/src/PythonAddons/doc/xmlFile_boxFeature.rst
deleted file mode 100644 (file)
index cd3e5c8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-  .. _create_custom_box_xml:
-
-File widget.xml 
-===============
-
-.. literalinclude:: examples/box/widget.xml    
-    :linenos:
-    :language: html
-
-:download:`Download this script <examples/box/widget.xml>`
\ No newline at end of file
diff --git a/src/PythonAddons/macros/box/__init__.py b/src/PythonAddons/macros/box/__init__.py
deleted file mode 100644 (file)
index 0d18652..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2015-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
diff --git a/src/PythonAddons/macros/box/feature.py b/src/PythonAddons/macros/box/feature.py
deleted file mode 100644 (file)
index c669ec0..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright (C) 2014-2019  CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-
-"""
-Box macro-feature
-Authors: Renaud Nedelec - Daniel Brunier-Coulin
-"""
-
-from salome.shaper import model
-from salome.shaper import geom
-
-
-class BoxFeature(model.Feature):
-    """An example of Box feature implementation.
-
-    BoxFeature() -> Box
-    """
-
-# 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)
-
-# 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 b9752fa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<source>
-  <workbench id="Macros" document="Part">
-    <group id="Samples">
-
-      <feature id="Box_script" title="Box" tooltip="Create a box parallel to xyz by extruding a rectangular" icon="icons/Addons/box_ico.png"
-            helpfile="boxFeature.html">
-        <doublevalue id="width"  label="Width: " min="0" step="1.0" default="50" tooltip="Box width">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-        <doublevalue id="length" label="Length: " min="0" step="1.0" default="50" tooltip="Box length">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-        <doublevalue id="height" label="Height: " min="0" step="1.0" default="50" tooltip="Box height">
-          <validator id="GeomValidators_Positive"/>
-        </doublevalue>
-      </feature>
-
-    </group>
-  </workbench>
-</source>