40093367 |
1 | #INTERFACE CAF |
2 | # Presentation attributes |
3 | # |
4 | # Testing attribute: TPrsStd_AISPresentation |
5 | # |
6 | # Testing command: AISDefaultMaterial |
7 | # Testing command: AISHasOwnMaterial |
8 | # Note: After call of AISDefaultMaterial-command : AISHasOwnMaterial = false ( int 0 ) |
9 | # |
10 | |
11 | puts "caf003-E1" |
12 | |
13 | # Set NamedShape attribute |
14 | box aBox1 100 200 300 |
15 | set aLabel 0:2 |
16 | SetShape D ${aLabel} aBox1 |
17 | |
18 | # Initialize 3D viewer |
19 | AISInitViewer D |
20 | |
21 | # Add AISPresentation attribute with parameter NS |
22 | AISSet D ${aLabel} NS |
23 | |
24 | # Set shading mode |
25 | vsetdispmode 1 |
26 | |
27 | # Display presentation of NamedShape in the viewer |
28 | AISDisplay D ${aLabel} |
29 | |
30 | # Close/Open transaction |
31 | NewCommand D |
32 | |
33 | # Set a material of the shape as NOM_JADE |
34 | set JadeMaterial 18 |
35 | AISMaterial D ${aLabel} ${JadeMaterial} |
36 | |
37 | # Close/Open transaction |
38 | NewCommand D |
39 | |
40 | # Check own material of the shape |
41 | set HasOwnMaterial1 [AISHasOwnMaterial D ${aLabel}] |
42 | |
43 | # Get current material of the shape |
44 | set aMaterial [lindex [AISMaterial D ${aLabel}] 0] |
45 | |
46 | # Set default material of the shape |
47 | AISDefaultMaterial D ${aLabel} |
48 | |
49 | # Close/Open transaction |
50 | NewCommand D |
51 | |
52 | # Undo |
53 | Undo D |
54 | |
55 | # Update the viewer |
56 | AISRepaint D |
57 | |
58 | # Redo |
59 | Redo D |
60 | |
61 | # Update the viewer |
62 | AISRepaint D |
63 | |
64 | # Check own material of the shape |
65 | set HasOwnMaterial2 [AISHasOwnMaterial D ${aLabel}] |
66 | |
67 | puts "It is not necessary to have the photo for this case." |
68 | |
69 | if { ${HasOwnMaterial1} == 0 || |
70 | ${HasOwnMaterial2} > 0 } { |
71 | puts "HasOwnMaterial1=${HasOwnMaterial1} HasOwnMaterial2=${HasOwnMaterial2}" |
72 | puts "AISDefaultMaterial command: Error" |
73 | return |
74 | } |
75 | puts "AISDefaultMaterial command: OK" |