0032351: Visualization, PrsDim_LengthDimension - add NULL checks for handling non...
[occt.git] / tests / v3d / dimensions / bug24351_3
1 puts "============"
2 puts "CR24351: Test AIS Radius dimensions: label position and arrow orientation"
3 puts "============"
4 puts ""
5
6 pload VISUALIZATION
7 vfont add [locate_data_file DejaVuSans.ttf] SansFont
8
9 vinit View1
10 vfront
11
12 set hpos "left hcenter"
13 set vpos "above vcenter below"
14
15 # ---------------------------------------------------------------------
16 # create dimensions with different arrow orientation and fit algorithm
17 # ---------------------------------------------------------------------
18
19 # test forced internal arrow orientation
20 vpoint  circle1_p1 0  0 30
21 vpoint  circle1_p2 30 0  0
22 vpoint  circle1_p3 60 0 30
23 vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0
24 vdimension rad1 -radius -shapes circle1 -text 3d -plane zox -label hfit -flyout 0 -arrow internal -font SansFont
25
26 # test forced external arrow orientation
27 vpoint  circle2_p1 100 0 35
28 vpoint  circle2_p2 135 0  0
29 vpoint  circle2_p3 170 0 35
30 vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0
31 vdimension rad2 -radius -shapes circle2 -text 3d -plane zox -label hfit -flyout 0 -arrow external -font SansFont
32
33 # test that auto-fit for arrow places them externally for small geometry
34 vpoint  circle3_p1 0  0 113
35 vpoint  circle3_p2 33 0  80
36 vpoint  circle3_p3 66 0 113
37 vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0
38 vdimension rad3 -radius -shapes circle3 -text 3d -plane zox -label hcenter -flyout 0 -arrow fit -font SansFont
39
40 # test that auto-fit for text places the label externally for small geometry
41 vpoint  circle4_p1 120 0 95
42 vpoint  circle4_p2 135 0 80
43 vpoint  circle4_p3 150 0 95
44 vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0
45 vdimension rad4 -radius -shapes circle4 -text 3d -plane zox -label hfit -flyout 0 -arrow fit -font SansFont
46 vfit
47
48 # ------------------------------------------------
49 # create dimension with different label positions
50 # ------------------------------------------------
51
52 vinit Viewer2/View2
53 vfront
54
55 set idx 0
56 for {set r 0} {$r < 3} {incr r} {
57   for {set c 0} {$c < 2} {incr c} {
58
59     set point1 p_[expr "$idx * 3 + 0"]
60     set point2 p_[expr "$idx * 3 + 1"]
61     set point3 p_[expr "$idx * 3 + 2"]
62     set circle c_[expr "$idx"]
63
64     vpoint $point1 [expr "90.0 * $c +  0"] 0.0 [expr "80.0 * $r + 33"]
65     vpoint $point2 [expr "90.0 * $c + 33"] 0.0 [expr "80.0 * $r +  0"]
66     vpoint $point3 [expr "90.0 * $c + 66"] 0.0 [expr "80.0 * $r + 33"]
67     vcircle $circle $point1 $point2 $point3 0
68
69     set dimension r_$idx
70
71     vdimension $dimension -radius -shapes $circle -text 3d -plane zox -label [lindex $hpos $c] [lindex $vpos $r] -arrow external -flyout 0.0 -font SansFont
72     vdisplay $dimension
73
74     incr idx
75   }
76 }
77 vfit
78
79 vdump $imagedir/${casename}.png