TestRotation.py
TestRotation_ErrorMsg.py
TestMultiRotation_Part.py
+ TestMultiRotation_ErrorMsg.py
TestMultiTranslation_Part.py
+ TestMultiTranslation_ErrorMsg.py
TestSymmetry_Part.py
TestBoolean1.py
TestBoolean2.py
TestBooleanFuse_CompSolid_CompSolid.py
TestBooleanFuse_CompSolidCompound_CompSolidCompound.py
TestFillet.py
+ TestFillet1.py
TestFillet_ErrorMsg.py
Test1816.py
Test2631.py
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiRotation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
GeomAPI_ShapeIterator anIt(aShape);
anEdge = anIt.current()->edge();
}
- else
- {
- setError(aSelectionError);
- return;
- }
if (!anEdge.get())
{
AttributeSelectionListPtr anObjectsSelList =
selectionList(FeaturesPlugin_MultiTranslation::OBJECTS_LIST_ID());
if (anObjectsSelList->size() == 0) {
+ setError("Error: empty selection list");
return;
}
for(int anObjectsIndex = 0; anObjectsIndex < anObjectsSelList->size(); anObjectsIndex++) {
GeomAPI_ShapeIterator anIt(aShape);
anEdge = anIt.current()->edge();
}
- else
- {
- setError(aSelectionError);
- return;
- }
if (!anEdge.get())
{
GeomAPI_ShapeIterator anIt(aShape);
anEdge = anIt.current()->edge();
}
- else
- {
- setError(aSelectionError);
- return;
- }
if (!anEdge.get())
{
--- /dev/null
+## Copyright (C) 2018-20xx 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<mailto:webmaster.salome@opencascade.com>
+##
+
+from salome.shaper import model
+from GeomAPI import GeomAPI_Shape
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+
+Fillet_1 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Box_1")], 2)
+assert(Fillet_1.feature().error() == "")
+
+model.testNbResults(Fillet_1, 1)
+model.testNbSubResults(Fillet_1, [0])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.FACE, [26])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.EDGE, [104])
+model.testNbSubShapes(Fillet_1, GeomAPI_Shape.VERTEX, [208])
+model.testResultsVolumes(Fillet_1, [907.704992710141368661425076425])
+
+Sketch_1 = model.addSketch(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+SketchCircle_1 = Sketch_1.addCircle(20, -15, 5)
+SketchCircle_2 = Sketch_1.addCircle(30, 10, 3)
+model.do()
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_1")], model.selection(), 10, 0)
+
+Fillet_2 = model.addFillet(Part_1_doc, [model.selection("EDGE", "all-in-Extrusion_1")], 2)
+assert(Fillet_2.feature().error() != "")
+
+model.end()
--- /dev/null
+## Copyright (C) 2018-20xx 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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+anAngularCopy1 = aPart.addFeature("AngularCopy")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("COMPOUND", "Compound_1_1")
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+anAngularCopy1.selection("axis_angular").selectSubShape("EDGE", "PartSet/OX")
+anAngularCopy1.integer("nb_angular").setValue(0)
+anAngularCopy1.execute()
+assert(anAngularCopy1.error() != "")
+aSession.finishOperation()
--- /dev/null
+## Copyright (C) 2018-20xx 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<mailto:webmaster.salome@opencascade.com>
+##
+
+
+from ModelAPI import *
+aSession = ModelAPI_Session.get()
+aDocument = aSession.moduleDocument()
+
+# Create a part
+aSession.startOperation()
+aPartFeature = aDocument.addFeature("Part")
+aSession.finishOperation()
+aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
+aPart = aPartResult.partDoc()
+
+# Create auxiliary box
+aSession.startOperation()
+aBox = aPart.addFeature("Box")
+aBox.string("CreationMethod").setValue("BoxByDimensions")
+aBox.real("dx").setValue(50)
+aBox.real("dy").setValue(50)
+aBox.real("dz").setValue(50)
+aSession.finishOperation()
+
+# Create auxiliary compound
+aSession.startOperation()
+aCompound = aPart.addFeature("Compound")
+aCompound.selectionList("base_objects").append("Box_1_1", "SOLID")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy1 = aPart.addFeature("LinearCopy")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy1.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy1.integer("nb_first_dir").setValue(2)
+aLinearCopy1.execute()
+assert(aLinearCopy1.error() != "")
+aSession.finishOperation()
+
+
+aSession.startOperation()
+aLinearCopy2 = aPart.addFeature("LinearCopy")
+aLinearCopy2.string("use_second_dir").setValue("true")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selectionList("main_objects").append("Compound_1_1", "COMPOUND")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_first_dir").selectSubShape("EDGE", "PartSet/OX")
+aLinearCopy2.selection("axis_second_dir").selectSubShape("COMPOUND", "Compound_1_1")
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.selection("axis_second_dir").selectSubShape("EDGE", "PartSet/OY")
+aLinearCopy2.integer("nb_first_dir").setValue(0)
+aLinearCopy2.integer("nb_second_dir").setValue(0)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()
+
+aSession.startOperation()
+aLinearCopy2.integer("nb_first_dir").setValue(2)
+aLinearCopy2.integer("nb_second_dir").setValue(2)
+aLinearCopy2.execute()
+assert(aLinearCopy2.error() != "")
+aSession.finishOperation()