0026342: No materials are read from STEP
[occt.git] / tests / bugs / xde / bug22776
1 puts "================"
2 puts "OCC22776"
3 puts "================"
4 puts ""
5 #######################################################################################
6 # XCAFPrs_AISObject does not support transparency
7 ######################################################################################
8
9 catch {pload DCAF}
10 pload QAcommands
11
12 NewDocument D BinXCAF
13 UndoLimit D 100
14 NewCommand D
15
16 #Set NamedShape attribute
17 box Box 100 200 300
18 set Label 0:2
19 SetShape D ${Label} Box
20
21 # Initialize 3D viewer
22 AISInitViewer D
23
24 # Add AISPresentation attribute with parameter NS
25 AISSet D ${Label} NS
26
27 # Set shading mode
28 vsetdispmode 1
29
30 # Display presentation of NamedShape in the viewer
31 AISDisplay D ${Label}
32
33 # Close/Open transaction
34 NewCommand D
35
36 set list [OCC1031_AISMaterial D ${Label}]
37 regexp {Material = ([-0-9.+eE]+)} $list full AISMaterial1
38
39 # Set a material of the shape as NOM_COPPER
40 set CopperMaterial 2
41 OCC1031_AISMaterial D ${Label} ${CopperMaterial}
42
43 set list [OCC1031_AISMaterial D ${Label}]
44 regexp {Material = ([-0-9.+eE]+)} $list full AISMaterial2
45
46 # Close/Open transaction
47 NewCommand D
48
49 set list [OCC1032_AISWidth D ${Label}]
50 regexp {Width = ([-0-9.+eE]+)} $list full AISWidth1
51
52 # Set a width
53 set Width 10
54 OCC1032_AISWidth D ${Label} ${Width}
55
56 set list [OCC1032_AISWidth D ${Label}]
57 regexp {Width = ([-0-9.+eE]+)} $list full AISWidth2
58
59 # Close/Open transaction
60 NewCommand D
61
62 set list [OCC1029_AISTransparency D ${Label}]
63 regexp {Transparency = ([-0-9.+eE]+)} $list full Transparency1
64
65 # Set a transparency
66 set Transparency 0.9
67 XSetTransparency D ${Transparency} ${Label}
68
69 set list [OCC1029_AISTransparency D ${Label}]
70 regexp {Transparency = ([-0-9.+eE]+)} $list full Transparency2
71
72 # Update the viewer
73 AISRepaint D
74
75
76 # Check the material
77 puts "AISMaterial1 = ${AISMaterial1}"
78 puts "AISMaterial2 = ${AISMaterial2}"
79 set DefaultAISMaterial 0
80 set status 0
81 if { ${AISMaterial1} != ${DefaultAISMaterial} } {
82         puts "Default material is wrong: Error"
83         set status 1
84 }
85 if { ${AISMaterial2} != ${CopperMaterial} } {
86         puts "OCC1031_AISMaterial command: Error"
87         set status 1
88 }
89
90 # Check the width
91 puts "AISWidth1 = ${AISWidth1}"
92 puts "AISWidth2 = ${AISWidth2}"
93 set DefaultAISWidth 0
94 if { ${AISWidth1} != ${DefaultAISWidth} } {
95         puts "Default width is wrong: Error"
96         set status 1
97 }
98 if { ${AISWidth2} != ${Width} } {
99         puts "OCC1032_AISWidth command: Error"
100         set status 1
101 }
102
103 # Check the transparency
104 puts "Transparency1 = ${Transparency1}"
105 puts "Transparency2 = ${Transparency2}"
106 set DefaultAISTransparency 0
107 if { ${Transparency1} != ${DefaultAISTransparency} } {
108         puts "Default transparency is worng: Error"
109         set status 1
110 }
111
112 if { ${Transparency2} != ${Transparency} } {
113         puts "XSetTransparency command: Error"
114         set status 1
115 }
116
117
118 if { ${status} == 0} {
119         puts "OK"
120 } else {
121         puts "FAULTY"
122 }
123
124 set 3dviewer 1