TestFolder_Stability.py
TestFolder_CustomName.py
TestFolder_Empty.py
+ TestFolder_Sketch.py
Test2358_1.py
Test2358_2.py
Test2396.py
model.do()
Part_1 = model.addPart(partSet)
Part_1_doc = Part_1.document()
-Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/Edge-SketchLine_3"), 360, 0)
+Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "PartSet/Sketch_1")], model.selection("EDGE", "PartSet/Sketch_1/SketchLine_3"), 360, 0)
model.end()
+from GeomAPI import GeomAPI_Shape
+
+model.testNbResults(Revolution_1, 1)
+model.testNbSubResults(Revolution_1, [0])
+model.testNbSubShapes(Revolution_1, GeomAPI_Shape.SOLID, [1])
+model.testNbSubShapes(Revolution_1, GeomAPI_Shape.FACE, [2])
+model.testNbSubShapes(Revolution_1, GeomAPI_Shape.EDGE, [8])
+model.testNbSubShapes(Revolution_1, GeomAPI_Shape.VERTEX, [16])
+model.testResultsVolumes(Revolution_1, [17830100])
+
assert(model.checkPythonDump())
Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
SketchCircle_1 = Sketch_1.addCircle(50, 50, 25)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2f")], model.selection(), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_1_2r")], model.selection(), 50, 0)
Sketch_2 = model.addSketch(Part_1_doc, model.standardPlane("XOY"))
SketchCircle_2 = Sketch_2.addCircle(100, -100, 50)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection(), 10, 0)
ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [], model.selection(), 0, 10, [model.selection("SOLID", "Extrusion_2_1")])
Sketch_3 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_2_1/To_Face_1"))
-SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_1__cc"), False)
+SketchProjection_1 = Sketch_3.addProjection(model.selection("VERTEX", "[Extrusion_2_1/Generated_Face&Sketch_3/SketchCircle_2_2][Extrusion_2_1/To_Face]__cc"), False)
SketchPoint_1 = SketchProjection_1.createdFeature()
SketchCircle_3 = Sketch_3.addCircle(100, -100, 25)
SketchConstraintCoincidence_1 = Sketch_3.setCoincident(SketchPoint_1.result(), SketchCircle_3.center())
TestSketcherSetFixed.py
TestSketcherSetLength.py
TestSketcherSetRadius.py
- #TestSketcherSetAngle.py
+ TestSketcherSetAngle.py
TestSketcherSetEqual.py
TestSketcherSetFillet.py
TestFeatures.py
TestFeaturesExtrusion.py
- #TestFeaturesRevolution.py
+ TestFeaturesRevolution.py
TestPrimitivesBox.py
SketchConstraintCoincidence_3 = Sketch_1.setCoincident(SketchLine_3.endPoint(), SketchLine_4.startPoint())
SketchConstraintCoincidence_4 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchLine_4.endPoint())
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchLine_1r-SketchLine_2r-SketchLine_3r-SketchLine_4r")], model.selection("EDGE", "PartSet/OZ"), 50, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Face-SketchLine_4r-SketchLine_3r-SketchLine_2r-SketchLine_1r_wire")], model.selection("EDGE", "PartSet/OZ"), 50, 0)
model.do()
Extrusion_1.setDirection(model.selection("EDGE", "OX"))
model.do()
base = base_sketch.selectFace()
axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
- axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ axis_object = model.addAxis(self.part, axis_point1, axis_point2).result()
- self.revolution = model.addRevolution(self.part, base, axis_object[0],
- 0, 180)
+ self.revolution = model.addRevolution(self.part, base, axis_object, 0, 180)
model.do()
base = base_sketch.selectFace()
axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
- axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ axis_object = model.addAxis(self.part, axis_point1, axis_point2).result()
- revolution = model.addRevolution(self.part, base, axis_object[0],
- 0, 180)
+ revolution = model.addRevolution(self.part, base, axis_object, 0, 180)
self.assertEqual(revolution.creationMethod().value(), "ByAngles")
self.assertEqual(revolution.toAngle().value(), 0)
self.assertEqual(revolution.fromAngle().value(), 180)
self.assertEqual(revolution.toObject().context(), None)
- self.assertEqual(revolution.toOffset().value(), 0)
self.assertEqual(revolution.fromObject().context(), None)
- self.assertEqual(revolution.fromOffset().value(), 0)
def test_add_revolution_by_face_and_planes(self):
# base
base = base_sketch.selectFace()
axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
- axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ axis_object = model.addAxis(self.part, axis_point1, axis_point2).result()
to_obejct = to_sketch.selectFace()[0]
from_object = from_sketch.selectFace()[0]
- revolution = model.addRevolution(self.part, base, axis_object[0],
- to_obejct, 15,
- from_object, 20)
+ self.revolution = model.addRevolution(self.part, base, axis_object,
+ to_obejct, 15,
+ from_object, 20)
- self.assertEqual(revolution.creationMethod().value(), "ByPlanesAndOffsets")
- self.assertEqual(revolution.toAngle().value(), 0)
- self.assertEqual(revolution.fromAngle().value(), 0)
-# self.assertEqual(revolution.getToObject().context(),
-# to_sketch.result())
- self.assertEqual(revolution.toOffset().value(), 15)
-# self.assertEqual(revolution.getFromObject().context(),
-# from_sketch.result())
- self.assertEqual(revolution.fromOffset().value(), 20)
+ self.assertEqual(self.revolution.creationMethod().value(), "ByPlanesAndOffsets")
+ self.assertNotEqual(self.revolution.toObject().context(), None)
+ self.assertEqual(self.revolution.toOffset().value(), 15)
+ self.assertNotEqual(self.revolution.fromObject().context(), None)
+ self.assertEqual(self.revolution.fromOffset().value(), 20)
class FeaturesRevolutionTestCase(FeaturesRevolutionFixture):
self.assertEqual(self.revolution.toAngle().value(), 90)
self.assertEqual(self.revolution.fromAngle().value(), 270)
self.assertEqual(self.revolution.toObject().context(), None)
- self.assertEqual(self.revolution.toOffset().value(), 0)
self.assertEqual(self.revolution.fromObject().context(), None)
- self.assertEqual(self.revolution.fromOffset().value(), 0)
def test_revolution_set_planes_and_offsets(self):
# base
base = base_sketch.selectFace()
axis_point1 = model.addPoint(self.part, 20, -10, 0).result()
axis_point2 = model.addPoint(self.part, 20, 10, 0).result()
- axis_object = model.addAxis(self.part, axis_point1[0], axis_point2[0]).result()
+ axis_object = model.addAxis(self.part, axis_point1, axis_point2).result()
to_obejct = to_sketch.selectFace()[0]
from_object = from_sketch.selectFace()[0]
+ self.revolution = model.addRevolution(self.part, base, axis_object, 0, 180)
self.revolution.setPlanesAndOffsets(to_obejct, 15, from_object, 20)
self.assertEqual(self.revolution.creationMethod().value(), "ByPlanesAndOffsets")
- # self.assertEqual(self.revolution.toAngle().value(), 0)
- # self.assertEqual(self.revolution.fromAngle().value(), 0)
-# self.assertEqual(self.revolution.getToObject().context(), None)
+ self.assertNotEqual(self.revolution.toObject().context(), None)
self.assertEqual(self.revolution.toOffset().value(), 15)
-# self.assertEqual(self.revolution.getFromObject().context(), None)
+ self.assertNotEqual(self.revolution.fromObject().context(), None)
self.assertEqual(self.revolution.fromOffset().value(), 20)
fillAttribute(SketcherPrs_Tools::ANGLE_DIRECT,
aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID()));
// fill the value before llines to avoid calculation of angle value by the Angle feature
- fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
aFeature->execute();
return InterfacePtr(new ModelHighAPI_Interface(aFeature));
}
compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID());
fillAttribute(SketcherPrs_Tools::ANGLE_COMPLEMENTARY,
aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID()));
- fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
-// fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
aFeature->execute();
return InterfacePtr(new ModelHighAPI_Interface(aFeature));
}
compositeFeature()->addFeature(SketchPlugin_ConstraintAngle::ID());
fillAttribute(SketcherPrs_Tools::ANGLE_BACKWARD,
aFeature->integer(SketchPlugin_ConstraintAngle::TYPE_ID()));
- fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
fillAttribute(theLine1, aFeature->refattr(SketchPlugin_Constraint::ENTITY_A()));
fillAttribute(theLine2, aFeature->refattr(SketchPlugin_Constraint::ENTITY_B()));
-// fillAttribute(theValue, aFeature->real(SketchPlugin_Constraint::VALUE()));
+ fillAttribute(theValue, aFeature->real(SketchPlugin_ConstraintAngle::ANGLE_VALUE_ID()));
aFeature->execute();
return InterfacePtr(new ModelHighAPI_Interface(aFeature));
}
Test case for issue #1061 "Distance constraint using for points with equal coordinates"
"""
-import math
from salome.shaper import model
model.begin()
# check distance between points
aDist2 = (SketchLine_1.endPoint().x() - SketchLine_2.startPoint().x())**2 + (SketchLine_1.endPoint().y() - SketchLine_2.startPoint().y())**2
-assert(math.fabs(aDist2 - DISTANCE**2) > 1e-12)
+assert(aDist2 < 1e-12)
+assert(Sketch_1.solverError() != "")
model.end()
-
-assert(model.checkPythonDump())
SketchConstraintTangent_10.setName("SketchConstraintTangent_13")
SketchConstraintAngle_2 = Sketch_1.setAngle(SketchLine_11.result(), SketchLine_10.result(), 45)
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_13r-SketchLine_14f-SketchLine_2f-SketchArc_1_2f-SketchArc_2_2f-SketchLine_5r-SketchArc_3_2f-SketchCircle_1_2r-SketchCircle_2_2r-SketchCircle_3_2r-SketchArc_4_2f-SketchArc_5_2r-SketchArc_6_2r-SketchLine_21r-SketchCircle_4_2r")], model.selection(), "height", 0)
-Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_14"))
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchArc_1_2f-SketchLine_2f-SketchArc_3_2f-SketchLine_5r-SketchArc_2_2f-SketchArc_4_2f-SketchLine_21r-SketchArc_6_2r-SketchLine_14f-SketchArc_5_2r-SketchLine_13r-SketchCircle_2_2r-SketchCircle_1_2r-SketchCircle_4_2r-SketchCircle_3_2r")], model.selection(), "height", 0)
+Sketch_2 = model.addSketch(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2"))
SketchLine_12 = Sketch_2.addLine(38.24999999999999, 6.5, 13.75, 6.5)
-SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "Extrusion_1_1/Generated_Face_14&Extrusion_1_1/To_Face_1"))
+SketchLine_13 = Sketch_2.addLine(model.selection("EDGE", "[Extrusion_1_1/Generated_Face&Sketch_1/SketchLine_2][Extrusion_1_1/To_Face_1]"))
SketchLine_13.setName("SketchLine_15")
SketchLine_13.result().setName("SketchLine_15")
SketchConstraintCoincidence_25 = Sketch_2.setCoincident(SketchLine_12.endPoint(), SketchLine_13.result())
SketchConstraintDistance_13 = Sketch_2.setDistance(SketchLine_13.endPoint(), SketchLine_16.result(), "width_hole/2")
SketchConstraintDistance_13.setName("SketchConstraintDistance_17")
model.do()
-ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12f-SketchLine_16f-SketchLine_17f-SketchLine_18f")], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")])
+ExtrusionCut_1 = model.addExtrusionCut(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchLine_12r-SketchLine_16f-SketchLine_17f-SketchLine_18f")], model.selection(), 0, 100, [model.selection("SOLID", "Extrusion_1_1")])
model.do()
# check ExtrusionCut_1 is valid
model.do()
Sketch_2 = model.addSketch(partSet, model.defaultPlane("YOZ"))
-SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/Vertex-SketchLine_1s"), True)
+SketchProjection_1 = Sketch_2.addProjection(model.selection("VERTEX", "Sketch_1/SketchLine_1_StartVertex"), True)
model.do()
# change the feature projected (no crash expected)
-SketchProjection_1.setExternalFeature(model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+SketchProjection_1.setExternalFeature(model.selection("EDGE", "Sketch_1/SketchLine_1"))
model.do()
model.end()
+
+from GeomAPI import GeomAPI_Shape
+
+model.testNbSubShapes(Sketch_2, GeomAPI_Shape.EDGE, [1])
SketchConstraintDistance_9 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "length/8")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_1_2r-SketchArc_2_2r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchArc_3_2f")], model.selection(), 500, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r")], model.selection(), 500, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 500, -400)
Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 100, 0)
model.do()
SketchConstraintDistance_9 = Sketch_1.setDistance(SketchPoint_2.coordinates(), SketchPoint_1.coordinates(), 50, True)
SketchConstraintLength_1 = Sketch_1.setLength(SketchLine_1.result(), "length/8")
model.do()
-Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1f-SketchArc_1_2r-SketchArc_2_2r-SketchLine_2r-SketchLine_3r-SketchLine_4r-SketchLine_5r-SketchLine_6r-SketchLine_7r-SketchLine_8r-SketchLine_9r-SketchArc_3_2f")], model.selection(), 500, 0)
+Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2r-SketchLine_9r-SketchLine_8r-SketchLine_7r-SketchLine_6r-SketchLine_5r-SketchLine_4r-SketchArc_3_2f-SketchLine_3r-SketchLine_2r-SketchArc_2_2r")], model.selection(), 500, 0)
Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 500, -400)
Extrusion_3 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), model.selection("FACE", "Sketch_1/Face-SketchCircle_2_2f")], model.selection(), 100, 0)
model.do()