From 47e9bb1f056795b564dfa39bf8935ee0e4f220b5 Mon Sep 17 00:00:00 2001 From: dbv Date: Mon, 11 Apr 2016 11:02:47 +0300 Subject: [PATCH] Commented PythonAPI Extrusion and Revolution tests --- src/PythonAPI/Test/TestFeatures.py | 14 +- .../model/features/extrusion_sketch.py | 122 --------------- .../model/features/revolution_sketch.py | 140 ------------------ 3 files changed, 8 insertions(+), 268 deletions(-) delete mode 100644 src/PythonAPI/model/features/extrusion_sketch.py delete mode 100644 src/PythonAPI/model/features/revolution_sketch.py diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index edd7d86b5..6d553d0cd 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -30,8 +30,10 @@ class FeaturesTestCase(FeaturesFixture): "addPoint", "addAxis", "addPlane", "addImport", "exportToFile", "addAddition", "addSubtraction", "addIntersection", - "addExtrusion", "addExtrusionCut", "addExtrusionFuse", "addExtrusionSketch", - "addRevolution", "addRevolutionCut", "addRevolutionFuse", "addRevolutionSketch", + "addExtrusion", + # "addExtrusionCut", "addExtrusionFuse", + "addRevolution", + # "addRevolutionCut", "addRevolutionFuse", "addPlacement", "addRotation", "addTranslation", "addGroup", "addParameter", @@ -53,11 +55,11 @@ class FeaturesTestCase(FeaturesFixture): model.features.boolean.Boolean(self.part.addFeature("Boolean")) model.features.extrusion.Extrusion(self.part.addFeature("Extrusion")) - model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut")) - model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse")) + # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut")) + # model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse")) model.features.revolution.Revolution(self.part.addFeature("Revolution")) - model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut")) - model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse")) + # model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut")) + # model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse")) model.features.placement.Placement(self.part.addFeature("Placement")) model.features.rotation.Rotation(self.part.addFeature("Rotation")) model.features.translation.Translation(self.part.addFeature("Translation")) diff --git a/src/PythonAPI/model/features/extrusion_sketch.py b/src/PythonAPI/model/features/extrusion_sketch.py deleted file mode 100644 index 0838948ee..000000000 --- a/src/PythonAPI/model/features/extrusion_sketch.py +++ /dev/null @@ -1,122 +0,0 @@ -"""ExtrusionSketch Interfaces -Author: Sergey Pokhodenko -Copyright (C) 2014-20xx CEA/DEN, EDF R&D -""" - -from .roots import CompositeSketch - - -def addExtrusionSketch(part, *args): - """Add an ExtrusionSketch feature to the Part. - - .. function:: addExtrusionSketch(part, sketch, sketch_selection, to_size, from_size) - - Args: - part (ModelAPI_Document): part document - sketch (ModelAPI_Object): sketch feature - sketch_selection (Selection): sketch objects - to_size (double): upper size of the extrusion - from_size (double): lower size of the extrusion - - .. function:: addExtrusionSketch(part, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) - - Args: - part (ModelAPI_Document): part document - sketch (ModelAPI_Object): sketch feature - sketch_selection (Selection): sketch objects - to_object (Selection): upper plane - to_offset (double): offset from upper plane - from_object (Selection): lower plane - from_offset (double): offset from lower plane - - Returns: - ExtrusionSketch: extrusion sketch object - """ - assert(args) - feature = part.addFeature("ExtrusionSketch") - return ExtrusionSketch(feature, *args) - - -class ExtrusionSketch(CompositeSketch): - """Interface class for ExtrusionSketch feature. - - .. function:: ExtrusionSketch(feature) - - Create interface for the feature without initialization. - - .. function:: ExtrusionSketch(feature, sketch, sketch_selection, to_size, from_size) - - Create interface for the feature and initialize the feature with arguments. - - .. function:: ExtrusionSketch(feature, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) - - Create interface for the feature and initialize the feature with arguments. - """ - def __init__(self, feature, *args): - """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" - CompositeSketch.__init__(self, feature, *args[:2]) - args = args[2:] - - self._CreationMethod = self._feature.string("CreationMethod") - self._to_size = self._feature.data().real("to_size") - self._from_size = self._feature.data().real("from_size") - self._to_object = self._feature.data().selection("to_object") - self._to_offset = self._feature.data().real("to_offset") - self._from_object = self._feature.data().selection("from_object") - self._from_offset = self._feature.data().real("from_offset") - - assert(self._CreationMethod) - assert(self._to_size) - assert(self._from_size) - assert(self._to_object) - assert(self._to_offset) - assert(self._from_object) - assert(self._from_offset) - - if not args: - return - - assert(len(args) in (2, 4)) - if len(args) == 4: - self.setPlanesAndOffsets(*args) - elif len(args) == 2: - self.setSizes(*args) - - self.execute() - pass - - def __clear(self): - self._CreationMethod.setValue("BySizes") - self._fillAttribute(self._to_size, 0) - self._fillAttribute(self._from_size, 0) - self._fillAttribute(self._to_object, None) - self._fillAttribute(self._to_offset, 0) - self._fillAttribute(self._from_object, None) - self._fillAttribute(self._from_offset, 0) - pass - - def setSizes(self, to_size, from_size): - """Modify the to_size, from_size attributes of the feature. - - See __init__. - """ - self.__clear() - self._CreationMethod.setValue("BySizes") - self._fillAttribute(self._to_size, to_size) - self._fillAttribute(self._from_size, from_size) - pass - - def setPlanesAndOffsets(self, to_object, to_offset, - from_object, from_offset): - """Modify planes and offsets attributes of the feature. - - See __init__. - """ - self.__clear() - self._CreationMethod.setValue("ByPlanesAndOffsets") - self._fillAttribute(self._to_object, to_object) - self._fillAttribute(self._to_offset, to_offset) - self._fillAttribute(self._from_object, from_object) - self._fillAttribute(self._from_offset, from_offset) - pass - diff --git a/src/PythonAPI/model/features/revolution_sketch.py b/src/PythonAPI/model/features/revolution_sketch.py deleted file mode 100644 index 1e0c9a6f6..000000000 --- a/src/PythonAPI/model/features/revolution_sketch.py +++ /dev/null @@ -1,140 +0,0 @@ -"""RevolutionSketch Interface -Author: Sergey Pokhodenko -Copyright (C) 2014-20xx CEA/DEN, EDF R&D -""" - -from .roots import CompositeSketch - - -def addRevolutionSketch(part, *args): - """Add a RevolutionSketch feature to the Part. - - .. function:: addRevolutionSketch(part, sketch, sketch_selection, axis_object, to_angle, from_angle) - - Args: - part (ModelAPI_Document): part document - sketch (ModelAPI_Object): sketch feature - sketch_selection (Selection): sketch objects - axis_object (Selection): axis object - to_size (double): upper size of the extrusion - from_size (double): lower size of the extrusion - - .. function:: addRevolutionSketch(part, sketch, sketch_selection, axis_object, to_object, to_offset, from_object, from_offset) - - Args: - part (ModelAPI_Document): part document - sketch (ModelAPI_Object): sketch feature - sketch_selection (Selection): sketch objects - axis_object (Selection): axis object - to_object (Selection): upper plane - to_offset (double): offset from upper plane - from_object (Selection): lower plane - from_offset (double): offset from lower plane - - Returns: - RevolutionSketch: revolution sketch object - """ - assert(args) - feature = part.addFeature("RevolutionSketch") - return RevolutionSketch(feature, *args) - - -class RevolutionSketch(CompositeSketch): - """Interface class for RevolutionSketch features. - - .. function:: RevolutionSketch(feature) - - Create interface for the feature without initialization. - - .. function:: RevolutionSketch(feature, sketch, sketch_selection, to_size, from_size) - - Create interface for the feature and initialize the feature with arguments. - - .. function:: RevolutionSketch(feature, sketch, sketch_selection, to_object, to_offset, from_object, from_offset) - - Create interface for the feature and initialize the feature with arguments. - """ - - def __init__(self, feature, *args): - """x.__init__(...) initializes x; see x.__class__.__doc__ for signature""" - CompositeSketch.__init__(self, feature, *args[:2]) - args = args[2:] - - self._axis_object = self._feature.data().selection("axis_object") - self._CreationMethod = self._feature.string("CreationMethod") - self._to_angle = self._feature.data().real("to_angle") - self._from_angle = self._feature.data().real("from_angle") - self._to_object = self._feature.data().selection("to_object") - self._to_offset = self._feature.data().real("to_offset") - self._from_object = self._feature.data().selection("from_object") - self._from_offset = self._feature.data().real("from_offset") - - assert(self._axis_object) - assert(self._CreationMethod) - assert(self._to_angle) - assert(self._from_angle) - assert(self._to_object) - assert(self._to_offset) - assert(self._from_object) - assert(self._from_offset) - - if not args: - return - - assert(len(args) in (3, 5)) - axis_object = args[0] - args = args[1:] - - self.setAxisObject(axis_object) - - if len(args) == 4: - self.setPlanesAndOffsets(*args) - elif len(args) == 2: - self.setAngles(*args) - - self.execute() - pass - - def __clear(self): - self._CreationMethod.setValue("ByAngles") - self._fillAttribute(self._to_angle, 0) - self._fillAttribute(self._from_angle, 0) - self._fillAttribute(self._to_object, None) - self._fillAttribute(self._to_offset, 0) - self._fillAttribute(self._from_object, None) - self._fillAttribute(self._from_offset, 0) - pass - - def setAxisObject(self, axis_object): - """Modify axis_object attribute of the feature. - - See __init__. - """ - self._fillAttribute(self._axis_object, axis_object) - pass - - def setAngles(self, to_angle, from_angle): - """Modify the to_angle, from_angle attributes of the feature. - - See __init__. - """ - self.__clear() - self._CreationMethod.setValue("ByAngles") - self._fillAttribute(self._to_angle, to_angle) - self._fillAttribute(self._from_angle, from_angle) - pass - - def setPlanesAndOffsets(self, to_object, to_offset, - from_object, from_offset): - """Modify planes and offsets attributes of the feature. - - See __init__. - """ - self.__clear() - self._CreationMethod.setValue("ByPlanesAndOffsets") - self._fillAttribute(self._to_object, to_object) - self._fillAttribute(self._to_offset, to_offset) - self._fillAttribute(self._from_object, from_object) - self._fillAttribute(self._from_offset, from_offset) - pass - -- 2.39.2