0028095: Draw Harness, ViewerTest - use RGBA format instead of BGRA within vreadpixel
[occt.git] / tests / caf / named_shape / D2
1 #INTERFACE CAF
2 # NamedShape
3 #
4 # Testing attribute: TNaming_NamedShape
5 #
6 # Testing command:   SelectGeometry (FACE)
7 #
8
9 puts "caf002-D2"
10 set QA_DUP 0
11
12 set ter _*
13 foreach OS [directory [concat aBox1$ter]] {
14         unset $OS
15 }
16
17 # Create a box
18 set aSetX1 10
19 set aSetY1 20
20 set aSetZ1 30
21 set aSetDX1 100
22 set aSetDY1 200
23 set aSetDZ1 300
24
25 box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
26
27 # Create a label
28 set aLabel 0:3
29 Label D ${aLabel}
30
31 # Set a shape to the label
32 ImportShape D ${aLabel} aBox1
33
34 # Close/Open transaction
35 NewCommand D
36
37 # Select all the sub-shapes of type <aType>
38 # aType = FACE
39 set aType f
40 explode ${aBox1} ${aType}
41
42 set i 0
43 set iSubLabel 2000
44 foreach S [directory [concat $aBox1$ter]] {
45         incr i
46         incr iSubLabel
47         puts "SubShape=$S"
48
49         #Memorize a bounding box of the selected sub-shape
50         set aBoundingBox1 [bounding ${S}]
51         set X1_Box1 [lindex ${aBoundingBox1} 0]
52         set Y1_Box1 [lindex ${aBoundingBox1} 1]
53         set Z1_Box1 [lindex ${aBoundingBox1} 2]
54         set X2_Box1 [lindex ${aBoundingBox1} 3]
55         set Y2_Box1 [lindex ${aBoundingBox1} 4]
56         set Z2_Box1 [lindex ${aBoundingBox1} 5]
57
58         # Select a sub-shape
59         set LABEL [Label D 0:$iSubLabel]
60         SelectGeometry D ${LABEL} ${S} ${aBox1}
61
62         # Solve selected sub-shape
63         SolveSelection D ${LABEL}
64
65         # Get selected (and solved) sub-shape
66         GetShape D ${LABEL} aSubShape
67         
68         # Get bounding box
69         set aBoundingBox2 [bounding aSubShape]
70         set X1_Box2 [lindex ${aBoundingBox2} 0]
71         set Y1_Box2 [lindex ${aBoundingBox2} 1]
72         set Z1_Box2 [lindex ${aBoundingBox2} 2]
73         set X2_Box2 [lindex ${aBoundingBox2} 3]
74         set Y2_Box2 [lindex ${aBoundingBox2} 4]
75         set Z2_Box2 [lindex ${aBoundingBox2} 5]
76         
77         if {${X1_Box1} != ${X1_Box2} || ${Y1_Box1} != ${Y1_Box2} || ${Z1_Box1} != ${Z1_Box2} || ${X2_Box1} != ${X2_Box2} || ${Y2_Box1} != ${Y2_Box2} || ${Z2_Box1} != ${Z2_Box2}} {
78                 puts "SelectGeometry command (${i}): Error"
79         }
80 }
81
82 puts "SelectGeometry command: OK"