3 # It shows capability of OCC to create different kinds
4 # of dimensions (linear and angular) with 2D or 3D text.
6 #Category: Visualization
7 #Title: Dimensions in 3d viewer
9 set aTopLoc [locate_data_file occ/Top.brep]
10 set aBotLoc [locate_data_file occ/Bottom.brep]
11 set aHatch [locate_data_file images/hatch_1.png]
13 pload MODELING VISUALIZATION
15 puts "Importing shapes..."
19 vinit View1 w=768 h=768
22 vsetcolorbg 255 255 255
25 puts "Getting cut projection..."
26 box bb -150 -250 0 150 250 100
32 set anAEdges [explode as E]
33 set aBEbges [explode bs E]
35 set anArrAngle [expr 3.14 * 12.0 / 180.0]
37 # Form dimension names list to set parameters with vdimparam command
38 set aList {rd_1 rd_2 ad_1 ad_2 ad_3}
39 for {set i 1} {$i <= 10} {incr i} {
43 puts "Creating dimensions..."
44 vdimension ld_1 -length -shapes bs_27 -plane xoy -color black -flyout -15
45 vdimension ld_2 -length -shapes bs_14 -plane xoy -color black -flyout 15
46 vdimension ld_3 -length -shapes bs_28 -plane xoy -color black -label right -flyout -27
47 vdimension ld_4 -length -shapes as_7 -plane xoy -color black -flyout -20
48 vdimension ld_5 -length -shapes as_28 -plane xoy -color black -flyout -15
49 vdimension ld_6 -length -shapes as_18 -plane xoy -color black -flyout 30
50 vdimension ld_7 -length -shapes bs_20 -plane xoy -color black -flyout -20
51 vdimension ld_8 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
52 vdimension ld_9 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
53 vdimension ld_10 -length -shapes as_40 -plane xoy -color black -flyout 15
55 vdimension rd_1 -radius -shapes bs_45 -color black -label right
56 vdimension rd_2 -radius -shapes bs_63 -color black
58 vdimension ad_1 -angle -shapes as_38 as_49 -color black
59 vdimension ad_2 -angle -shapes bs_24 bs_25 -color black
60 vdimension ad_3 -angle -shapes as_48 as_43 -color black
62 puts "Changing text and arrow paramaters of dimensions..."
64 vdimparam $i -text 3d sh 6 -arrowlength 4 -arrowangle $anArrAngle
69 puts "Displaying exported shapes..."
73 vaspects a -setmaterial steel
74 vaspects b -setmaterial bronze
76 puts "Clipping shapes for better view..."
78 vclipplane change pa equation 0 0 1 0
79 vclipplane change pa capping on
80 vclipplane change pa capping color 0.9 0.9 0.9
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 set pb object b
89 vsettexturemode Driver1/Viewer1/View1 2
90 vclipplane change pa capping texname $aHatch
91 vclipplane change pa capping texscale 0.05 -0.05
92 vclipplane change pb capping texname $aHatch
93 vclipplane change pb capping texscale 0.05 0.05