1 # Script displays properties of different materials available in OCCT
3 #Category: Visualization
4 #Title: Material properties in viewer
6 set THE_MATERIALS {brass bronze copper gold jade neon_phc pewter obsidian plaster plastic satin silver steel stone chrome aluminium water glass diamond charcoal}
7 set THE_COLORS {default red green blue1}
16 foreach aMatIter $::THE_MATERIALS {
17 vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color $r $g $b -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
22 foreach aColIter $::THE_COLORS {
23 if { $aColIter == "red" } {
27 } elseif { $aColIter == "green" } {
31 } elseif { $aColIter == "blue1" } {
36 vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color $r $g $b -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
37 incr x $::THE_ROW_DIST
41 proc drawObjects {theRow theColor} {
45 set x [expr 30 + $theRow * $::THE_ROW_DIST]
47 foreach aMatIter $::THE_MATERIALS {
48 set aSph s${theRow}_${aCounter}
49 set aBox b${theRow}_${aCounter}
50 uplevel #0 psphere $aSph $aSize
51 uplevel #0 box $aBox $aCtr $aCtr $aCtr $aSize $aSize $aSize
52 uplevel #0 ttranslate $aSph $x $y 0
53 uplevel #0 ttranslate $aBox [expr $x + 10] $y 0
54 uplevel #0 vdisplay -noredraw $aSph $aBox
55 uplevel #0 vsetmaterial -noredraw $aSph $aBox $aMatIter
56 if {$theColor != ""} {
57 uplevel #0 vsetcolor -noredraw $aSph $aBox $theColor
64 # setup 3D viewer content
65 pload MODELING VISUALIZATION
67 catch { vclose View1 }
68 vinit View1 w=768 h=768
72 vsetgradientbg 180 200 255 180 180 180 2
73 vlight change 0 pos -1 1 1
77 # adjust scene bounding box
78 box bnd 0 0 0 180 210 1
79 vdisplay -noredraw bnd
84 # draw spheres and boxes with different materials