352ffd73 |
1 | puts "================" |
2 | puts "OCC1029" |
3 | puts "================" |
4 | puts "" |
5 | # |
6 | # Note: Numerical control of setting transparency |
7 | # |
8 | |
9 | pload QAcommands |
10 | |
11 | NewDocument D MDTV-Standard |
12 | UndoLimit D 100 |
13 | NewCommand D |
14 | |
15 | # Create two boxis |
16 | box aBox1 100 200 300 |
17 | set aLabel1 0:2 |
18 | SetShape D ${aLabel1} aBox1 |
19 | |
20 | box aBox2 50 50 0 100 200 300 |
21 | set aLabel2 0:3 |
22 | SetShape D ${aLabel2} aBox2 |
23 | |
24 | # Initialize 3D viewer |
25 | AISInitViewer D |
26 | |
27 | # Add AISPresentation attribute with parameter NS |
28 | AISSet D ${aLabel1} NS |
29 | AISSet D ${aLabel2} NS |
30 | |
31 | # Set shading mode |
32 | vsetdispmode 1 |
33 | |
34 | # Set a color of the second shape as NOC_GREEN |
35 | AISColor D ${aLabel2} 229 |
36 | |
37 | # Display presentation of NamedShape in the viewer |
38 | AISDisplay D ${aLabel1} |
39 | AISDisplay D ${aLabel2} |
40 | |
41 | # Close/Open transaction |
42 | NewCommand D |
43 | |
44 | # Set a transparency of the second shape |
45 | set SetTransparency 0.9 |
46 | OCC1029_AISTransparency D ${aLabel2} ${SetTransparency} |
47 | |
48 | set list [OCC1029_AISTransparency D ${aLabel2}] |
49 | set Transparency1 [lindex ${list} [expr [llength ${list}] - 1] ] |
50 | |
51 | # Close/Open transaction |
52 | NewCommand D |
53 | |
54 | # Undo |
55 | Undo D |
56 | |
57 | # Update the viewer |
58 | AISRepaint D |
59 | |
60 | set list [OCC1029_AISTransparency D ${aLabel2}] |
61 | set Transparency2 [lindex ${list} [expr [llength ${list}] - 1] ] |
62 | |
63 | # Redo |
64 | Redo D |
65 | |
66 | # Update the viewer |
67 | AISRepaint D |
68 | |
69 | set list [OCC1029_AISTransparency D ${aLabel2}] |
70 | set Transparency3 [lindex ${list} [expr [llength ${list}] - 1] ] |
71 | |
72 | # Check the transparency |
73 | puts "Transparency1 = ${Transparency1}" |
74 | puts "Transparency2 = ${Transparency2}" |
75 | puts "Transparency3 = ${Transparency3}" |
76 | |
77 | set status 0 |
78 | if { ${Transparency1} != ${SetTransparency} } { |
79 | puts "OCC1029_Transparency command: Error (case 1)" |
80 | set status 1 |
81 | } |
82 | |
83 | if { ${Transparency2} != 0. } { |
84 | puts "OCC1029_Transparency command: Error (case 2)" |
85 | set status 1 |
86 | } |
87 | |
88 | if { ${Transparency3} != ${SetTransparency} } { |
89 | puts "OCC1029_Transparency command: Error (case 3)" |
90 | set status 1 |
91 | } |
92 | |
93 | if { ${status} == 0} { |
94 | puts "OCC1029_Transparency command: OK" |
95 | } |
96 | |