1 # Demo script for dimensions
2 puts "Dimensions demo: it shows capability of OCC to create different kinds "
3 puts "of dimensions (linear and angular) with 2D or 3D text."
5 set dispScriptFile [file normalize [info script]]
6 set scriptFolder [file dirname $dispScriptFile]
8 set aTopLoc [locate_data_file occ/Top.brep]
9 set aBotLoc [locate_data_file occ/Bottom.brep]
10 set aHatch [locate_data_file images/hatch_1.png]
12 if { ![file exist "$aTopLoc"] || ![file exist "$aBotLoc"] } {
13 puts "No model file in current directory!"
14 puts "Please put Bottom.brep and Top.brep in current directory and try again"
17 pload MODELING VISUALIZATION
20 vinit View1 w=768 h=768
23 vsetcolorbg 255 255 255
27 box bb -150 -250 0 150 250 100
33 set anAEdges [explode as E]
34 set aBEbges [explode bs E]
36 #foreach e [concat $anAEdges $aBEbges] { vdisplay $e }
37 set anArrAngle [expr 3.14 * 12.0 / 180.0]
39 set aList {das_7 dbs_27 dbs_6 dbs_19 das_25 das_26 dbs_22 das_43 das_12 das_41 dbs_39 dbs_59 das_3944 dbs_1826 das_4843}
41 vdimension dbs_19 -length -shapes bs_19 -plane xoy -color black -flyout -15
42 vdimension dbs_6 -length -shapes bs_6 -plane xoy -color black -flyout 15
43 vdimension dbs_27 -length -shapes bs_27 -plane xoy -color black -label right -flyout -27
44 vdimension das_7 -length -shapes as_7 -plane xoy -color black -flyout -20
45 vdimension das_25 -length -shapes as_25 -plane xoy -color black -flyout -15
46 vdimension das_26 -length -shapes as_26 -plane xoy -color black -flyout 30
47 vdimension dbs_22 -length -shapes bs_22 -plane xoy -color black -flyout -20
48 vdimension das_43 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
49 vdimension das_12 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
50 vdimension das_41 -length -shapes as_41 -plane xoy -color black -flyout 15
52 vdimension dbs_39 -radius -shapes bs_39 -color black -label right
53 vdimension dbs_59 -radius -shapes bs_59 -color black
55 vdimension das_3944 -angle -shapes as_39 as_44 -color black
56 vdimension dbs_1826 -angle -shapes bs_18 bs_26 -color black
57 vdimension das_4843 -angle -shapes as_48 as_43 -color black
60 vdimparam $i text=3d textsize=6 textmode=s arlength=4 arangle=$anArrAngle
64 foreach e [concat $anAEdges $aBEbges] {
72 vaspects a -setmaterial steel
73 vaspects b -setmaterial bronze
77 vclipplane change pa equation 0 0 1 0
78 vclipplane change pa capping on
79 vclipplane change pa capping color 0.9 0.9 0.9
80 #vclipplane change pa capping hatch on
81 vclipplane set pa object a
84 vclipplane change pb equation 0 0 1 0
85 vclipplane change pb capping on
86 vclipplane change pb capping color 1.0 0.8 0.0
87 #vclipplane change pb capping hatch on
88 vclipplane set pb object b
90 vsettexturemode Driver1/Viewer1/View1 2
91 vclipplane change pa capping texname $aHatch
92 vclipplane change pa capping texscale 0.05 -0.05
93 vclipplane change pb capping texname $aHatch
94 vclipplane change pb capping texscale 0.05 0.05