c1c71b673c036f56f416f1586e227db6c210a294
[occt.git] / tests / caf / presentation / G1
1 #INTERFACE CAF
2 # Presentation attributes
3 #
4 # Testing attribute: TPrsStd_AISPresentation
5 #
6 # Testing command:   AISDefaultTransparency
7 # Testing command:   AISHasOwnTransparency
8 # Note:   After call of  AISDefaultTransparency-command : AISHasOwnTransparency = false ( int 0 )
9 #
10
11 puts "caf003-G1"
12
13 # Create two boxis
14 box aBox1 100 200 300
15 set aLabel1 0:2
16 SetShape D ${aLabel1} aBox1
17
18 box aBox2 50 50 0 100 200 300
19 set aLabel2 0:3
20 SetShape D ${aLabel2} aBox2
21
22 # Initialize 3D viewer
23 AISInitViewer D
24
25 # Add AISPresentation attribute with parameter NS
26 AISSet D ${aLabel1} NS
27 AISSet D ${aLabel2} NS
28
29 # Set shading mode
30 vsetdispmode 1
31
32 # Set a color of the second shape as NOC_GREEN
33 AISColor D ${aLabel2} 229
34
35 # Display presentation of NamedShape in the viewer
36 AISDisplay D ${aLabel1}
37 AISDisplay D ${aLabel2}
38
39 # Close/Open transaction
40 NewCommand D
41
42 # Set a transparency of the second shape 
43 set SetTransparency 0.9
44 AISTransparency D ${aLabel2} ${SetTransparency}
45
46 # Close/Open transaction
47 NewCommand D
48
49 # Check own transparency of the shape 
50 set HasOwnTransparency1 [AISHasOwnTransparency D ${aLabel2}]
51
52 # Get current transparency of the shape 
53 ###set aTransparency [lindex [AISTransparency D ${aLabel2}] 0]
54 set list [AISTransparency D ${aLabel2}]
55 set aTransparency [lindex ${list} [expr [llength ${list}] - 1] ]
56
57 # Set default transparency of the shape
58 AISDefaultTransparency D ${aLabel2}
59
60 # Close/Open transaction
61 NewCommand D
62
63 # Undo
64 Undo D
65
66 # Update the viewer
67 AISRepaint D
68
69 # Redo
70 Redo D
71
72 # Update the viewer
73 AISRepaint D
74
75 # Check own transparency of the shape 
76 set HasOwnTransparency2 [AISHasOwnTransparency D ${aLabel2}]
77
78 puts "It is not necessary to have the photo for this case."
79
80 if { ${HasOwnTransparency1} == 0 || 
81      ${HasOwnTransparency2} > 0 } {
82         puts "HasOwnTransparency1=${HasOwnTransparency1} HasOwnTransparency2=${HasOwnTransparency2}"
83         puts "AISDefaultTransparency command: Error"
84         return
85 }
86 puts "AISDefaultTransparency command: OK"