3e05329c |
1 | puts "========" |
2 | puts "Capping plane perserving material" |
3 | puts "========" |
4 | |
5 | set aHatch [locate_data_file images/hatch_1.png] |
6 | |
7 | pload MODELING VISUALIZATION |
8 | |
9 | puts "Create the geometry" |
10 | box b0sole 10 10 0 30 30 70 |
11 | box b0hole 20 20 -10 10 10 90 |
12 | bcut b0 b0sole b0hole |
13 | box b1 40 20 0 10 30 70 |
14 | box b2 20 40 0 20 10 70 |
15 | box b3 0 40 0 20 10 70 |
16 | box b4 0 10 0 10 30 70 |
17 | box b5 0 0 0 30 10 70 |
18 | |
19 | set aNbParts 6 |
20 | set aColors { RED YELLOW GREEN GRAY MAGENTA1 ORANGE } |
21 | |
22 | compound b0 b1 b2 b3 b4 b5 cc |
23 | |
24 | puts "Create the viewer" |
25 | vclear |
26 | vclose ALL |
27 | vinit name=View1 w=512 h=512 |
28 | |
29 | vpoint p0 0 0 0 |
30 | vzbufftrihedron |
31 | |
32 | puts "Display the geometry as dedicated objects" |
33 | for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } { |
34 | vdisplay -noupdate -dispMode 1 b${aPartIter} |
35 | set aColor [lindex $aColors $aPartIter] |
36 | vsetcolor -noupdate b${aPartIter} $aColor |
37 | } |
38 | |
39 | puts "Display the geometry as sole object" |
40 | vdisplay -noupdate -dispMode 1 cc |
41 | for { set aPartIter 0 } { $aPartIter < $aNbParts } { incr aPartIter } { |
42 | set aColor [lindex $aColors $aPartIter] |
43 | vaspects -noupdate cc -subShapes b${aPartIter} -setColor $aColor |
44 | } |
45 | # show also connected interactive object |
46 | vconnectto co -70 0 0 cc |
47 | vsetdispmode co 1 |
48 | vsetlocation cc 70 0 0 |
49 | vfit |
50 | |
51 | |
52 | set aPln1Z 40 |
53 | set aPln2Y 15 |
54 | |
55 | vremove -noupdate p1 p2 p3 pp1 pp2 |
56 | vpoint p1 0 0 1 |
57 | vpoint p2 1 0 1 |
58 | vpoint p3 0 1 1 |
59 | vplane pp1 p1 p2 p3 |
60 | vsetlocation -noupdate pp1 25 0 [expr $aPln1Z - 1] |
61 | vremove -noupdate p1 p2 p3 |
62 | |
63 | vpoint p1 0 1 0 |
64 | vpoint p2 1 1 0 |
65 | vpoint p3 0 1 1 |
66 | vplane pp2 p1 p2 p3 |
67 | vsetlocation -noupdate pp2 25 $aPln2Y 35 |
68 | vremove -noupdate p1 p2 p3 |
69 | verase pp1 pp2 |
70 | vfit |
71 | vdisplay pp1 pp2 |
72 | vzoom 0.8 |
73 | |
74 | puts "Enable capping planes" |
75 | vclipplane pln1 -set -equation 0 0 -1 $aPln1Z -capping 1 -color 0.5 0.5 0.5 -texname $aHatch -texscale 0.02 -0.02 -useObjMaterial 1 |
76 | vclipplane pln2 -set -equation 0 1 0 [expr -$aPln2Y] -capping 1 -color 0.8 0.8 0.9 -texname $aHatch -texscale 0.02 -0.02 |