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 blue}
13 foreach aMatIter $::THE_MATERIALS {
14 vdrawtext "$aMatIter" "$aMatIter" -pos $x $y 0 -color GRAY10 -halign right -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
19 foreach aColIter $::THE_COLORS {
20 set aLabColor "$aColIter"
21 if { "$aColIter" == "default" } { set aLabColor BLACK }
22 vdrawtext "$aColIter" "$aColIter" -pos $x $y 0 -color "$aLabColor" -halign center -valign center -angle 000 -zoom 0 -height 14 -aspect regular -font Arial
23 incr x $::THE_ROW_DIST
27 proc drawObjects {theRow theColor} {
31 set x [expr 30 + $theRow * $::THE_ROW_DIST]
33 foreach aMatIter $::THE_MATERIALS {
34 set aSph s${theRow}_${aCounter}
35 set aBox b${theRow}_${aCounter}
36 uplevel #0 psphere $aSph $aSize
37 uplevel #0 box $aBox $aCtr $aCtr $aCtr $aSize $aSize $aSize
38 uplevel #0 ttranslate $aSph $x $y 0
39 uplevel #0 ttranslate $aBox [expr $x + 10] $y 0
40 uplevel #0 vdisplay -noredraw -dispMode 1 $aSph $aBox
41 uplevel #0 vsetmaterial -noredraw $aSph $aBox $aMatIter
42 if {$theColor != ""} {
43 uplevel #0 vsetcolor -noredraw $aSph $aBox $theColor
50 # setup 3D viewer content
51 pload MODELING VISUALIZATION
55 vinit View1 w=768 h=768
58 vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
60 vlight -change 0 -dir 0.577 -0.577 -0.577
63 # adjust scene bounding box
64 box bnd 0 0 0 180 210 1
65 vdisplay -noredraw -dispMode 0 bnd
69 # draw spheres and boxes with different materials