2 Test case for GDML Primitive Cone Segment feature.
5 from salome.shaper import model
8 partSet = model.moduleDocument()
9 Part_1 = model.addPart(partSet)
10 Part_1_doc = Part_1.document()
13 model.addParameter(Part_1_doc, "rmin1", "7")
14 model.addParameter(Part_1_doc, "rmax1", "11")
15 model.addParameter(Part_1_doc, "rmin2", "5")
16 model.addParameter(Part_1_doc, "rmax2", "8")
17 model.addParameter(Part_1_doc, "z", "12")
18 model.addParameter(Part_1_doc, "startphi", "0")
19 model.addParameter(Part_1_doc, "deltaphi", "270")
22 CS1 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0 , 270)
23 CS2 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, 45 , 180)
24 CS3 = model.addConeSegment(Part_1_doc, 5, 10, 7, 15, 15, -45 , 180)
25 CS4 = model.addConeSegment(Part_1_doc, 0, 10, 2, 7, 3, 0 , 270)
26 CS5 = model.addConeSegment(Part_1_doc, 5, 8, 0, 6, 10, 45 , 270)
27 CS6 = model.addConeSegment(Part_1_doc, 0, 6, 0, 4, 17, 0 , 270)
28 CS7 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 0 , 360)
29 CS8 = model.addConeSegment(Part_1_doc, -5, 11, 5, 8, 12, 0 , 270)
30 CS9 = model.addConeSegment(Part_1_doc, 11, 7, 5, 8, 12, 0 , 270)
31 CS10 = model.addConeSegment(Part_1_doc, 7, 11, 8, 5, 12, 0 , 270)
32 CS11 = model.addConeSegment(Part_1_doc, 7, 11, -3, 5, 12, 0 , 270)
33 CS12 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 0, 0 , 270)
34 CS13 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, -10, 0 , 270)
35 CS14 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, -45 , -45)
36 CS15 = model.addConeSegment(Part_1_doc, 7, 11, 5, 8, 12, 45 , 450)
37 CS16 = model.addConeSegment(Part_1_doc, "rmin1", "rmax1", "rmin2", "rmax2", "z", "startphi" , "deltaphi")
42 from GeomAPI import GeomAPI_Shape
44 model.testNbResults(CS1, 1)
45 model.testNbSubResults(CS1, [0])
46 model.testNbSubShapes(CS1, GeomAPI_Shape.SOLID, [1])
47 model.testNbSubShapes(CS1, GeomAPI_Shape.FACE, [6])
48 model.testHaveNamingFaces(CS1, model, Part_1_doc)
50 model.testNbResults(CS2, 1)
51 model.testNbSubResults(CS2, [0])
52 model.testNbSubShapes(CS2, GeomAPI_Shape.SOLID, [1])
53 model.testNbSubShapes(CS2, GeomAPI_Shape.FACE, [6])
54 model.testHaveNamingFaces(CS2, model, Part_1_doc)
56 model.testNbResults(CS3, 1)
57 model.testNbSubResults(CS3, [0])
58 model.testNbSubShapes(CS3, GeomAPI_Shape.SOLID, [1])
59 model.testNbSubShapes(CS3, GeomAPI_Shape.FACE, [6])
60 model.testHaveNamingFaces(CS3, model, Part_1_doc)
62 model.testNbResults(CS4, 1)
63 model.testNbSubResults(CS4, [0])
64 model.testNbSubShapes(CS4, GeomAPI_Shape.SOLID, [1])
65 model.testNbSubShapes(CS4, GeomAPI_Shape.FACE, [6])
66 model.testHaveNamingFaces(CS4, model, Part_1_doc)
68 model.testNbResults(CS5, 1)
69 model.testNbSubResults(CS5, [0])
70 model.testNbSubShapes(CS5, GeomAPI_Shape.SOLID, [1])
71 model.testNbSubShapes(CS5, GeomAPI_Shape.FACE, [6])
72 model.testHaveNamingFaces(CS5, model, Part_1_doc)
74 model.testNbResults(CS6, 1)
75 model.testNbSubResults(CS6, [0])
76 model.testNbSubShapes(CS6, GeomAPI_Shape.SOLID, [1])
77 model.testNbSubShapes(CS6, GeomAPI_Shape.FACE, [5])
78 model.testHaveNamingFaces(CS6, model, Part_1_doc)
80 model.testNbResults(CS7, 1)
81 model.testNbSubResults(CS7, [0])
82 model.testNbSubShapes(CS7, GeomAPI_Shape.SOLID, [1])
83 model.testNbSubShapes(CS7, GeomAPI_Shape.FACE, [4])
84 model.testHaveNamingFaces(CS7, model, Part_1_doc)
86 model.testNbResults(CS16, 1)
87 model.testNbSubResults(CS16, [0])
88 model.testNbSubShapes(CS16, GeomAPI_Shape.SOLID, [1])
89 model.testNbSubShapes(CS16, GeomAPI_Shape.FACE, [6])
90 model.testHaveNamingFaces(CS16, model, Part_1_doc)
92 model.testNbResults(CS8, 0)
93 assert(CS8.feature().error() == "Cone Segment builder :: rmin1 is negative.")
95 model.testNbResults(CS9, 0)
96 assert(CS9.feature().error() == "Cone Segment builder :: rmin1 is larger than rmax1.")
98 model.testNbResults(CS10, 0)
99 assert(CS10.feature().error() == "Cone Segment builder :: rmin2 is larger than rmax2.")
101 model.testNbResults(CS11, 0)
102 assert(CS11.feature().error() == "Cone Segment builder :: rmin2 is negative.")
104 model.testNbResults(CS12, 0)
105 assert(CS12.feature().error() == "Cone Segment builder :: z is negative or null.")
107 model.testNbResults(CS13, 0)
108 assert(CS13.feature().error() == "Cone Segment builder :: z is negative or null.")
110 model.testNbResults(CS14, 0)
111 assert(CS14.feature().error() == "Cone Segment builder :: deltaphi is negative or null.")
113 model.testNbResults(CS15, 0)
114 assert(CS15.feature().error() == "Cone Segment builder :: deltaphi is larger than 360 degree.")