1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0025235: Draw Harness - improve commands vdimension and vdimparam

Make commands syntax to meet coding rules.
Correct angle dimension initialization to allow ellipse input geometry with equal radii.
Change default value of arrow angle for dimensions (from 20 to 12 degrees).
Add arlength, arangle, textmode, textsize to vdimension and vdimparam Draw commands.
Add color parameter to vdimension and vdimparam.
Display dimensions by default.

Add dimensions demo script samples/tcl/dimensions.tcl.

Add file for test case for issue CR25235
This commit is contained in:
aba
2014-10-02 14:02:20 +04:00
committed by bugmaster
parent 52d4584155
commit 0499eb0670
23 changed files with 667 additions and 526 deletions

View File

@@ -11,8 +11,7 @@ pload VISUALIZATION
vinit
vpoint lengthP1 0 0 0
vpoint lengthP2 50 50 50
vdimension length name=dim1 plane=xoy lengthP1 lengthP2
vdisplay dim1
vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2
vfit
vmoveto 82 254

View File

@@ -12,8 +12,7 @@ vinit
vpoint angleP1 0 0 0
vpoint angleP2 50 50 50
vpoint angleP3 50 50 100
vdimension angle name=dim1 angleP1 angleP2 angleP3
vdisplay dim1
vdimension dim1 -angle -shapes angleP1 angleP2 angleP3
vfit
vmoveto 249 206
@@ -27,8 +26,7 @@ if { $stat != 1 } {
}
vinit Viewer2/View2
vdisplay angleP1 angleP2 angleP3
vdimension angle name=dim2 text=3d angleP1 angleP2 angleP3
vdisplay dim2
vdimension dim2 -angle -text 3d -shapes angleP1 angleP2 angleP3
vfit
vmoveto 263 251

View File

@@ -14,8 +14,7 @@ vpoint radP2 50 50 0
vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
verase radP1 radP2 radP3
vdimension radius name=dim1 circle
vdisplay dim1
vdimension dim1 -radius -shapes circle
vfit
vmoveto 123 158
@@ -30,8 +29,7 @@ if { $stat != 1 } {
vinit Viewer2/View2
vdisplay circle
vdimension radius name=dim2 text=3d circle
vdisplay dim2
vdimension dim2 -radius -text 3d -shapes circle
vfit
vmoveto 191 196

View File

@@ -14,8 +14,7 @@ vpoint diamP2 50 50 0
vpoint diamP3 100 0 0
vcircle circle diamP1 diamP2 diamP3 0
verase diamP1 diamP2 diamP3
vdimension diameter name=dim1 circle
vdisplay dim1
vdimension dim1 -diameter -shapes circle
vfit
vmoveto 208 205
@@ -30,8 +29,7 @@ if { $stat != 1 } {
vinit Viewer2/View2
vdisplay circle
vdimension diameter name=dim2 text=3d circle
vdisplay dim2
vdimension dim2 -diameter -text 3d -shapes circle
vfit
vmoveto 208 205

View File

@@ -17,8 +17,7 @@ vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdimension radius name=dim text=3d circle
vdisplay dim
vdimension dim -radius -text 3d -shapes circle
vfit
vmoveto 110 111

View File

@@ -17,8 +17,7 @@ vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdimension radius name=dim text=3d circle
vdisplay dim
vdimension dim -radius -text 3d -shapes circle
vfit
vmoveto 110 111

View File

@@ -17,8 +17,7 @@ vpoint radP3 100 0 0
vcircle circle radP1 radP2 radP3 0
vrotate 0 -$m_pi2 0
verase radP1 radP2 radP3
vdimension radius name=dim text=3d circle
vdisplay dim
vdimension dim -radius -text 3d -shapes circle
vfit
vmoveto 110 111

View File

@@ -8,8 +8,7 @@ puts ""
vinit View1
vpoint lengthP1 0 0 0
vpoint lengthP2 10 10 10
vdimension length name=dim1 plane=xoy lengthP1 lengthP2
vdisplay dim1
vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2
vfit
vmoveto 202 191

View File

@@ -30,18 +30,17 @@ vpoint arrow_p7 0 0 50
vpoint arrow_p8 10 0 50
# test forced internal arrow orientation
vdimension length name=arrow_d1 text=3d plane=zox label=hfit flyout=10.0 arrows=internal arrow_p1 arrow_p2
vdimension arrow_d1 -length -shapes arrow_p1 arrow_p2 -text 3d -plane zox -label hfit -flyout 10.0 -arrow internal
# test forced external arrow orientation
vdimension length name=arrow_d2 text=3d plane=zox label=hfit flyout=10.0 arrows=external arrow_p3 arrow_p4
vdimension arrow_d2 -length -shapes arrow_p3 arrow_p4 -text 3d -plane zox -label hfit -flyout 10.0 -arrow external
# test that auto-fit for arrow places them externally for small geometry
vdimension length name=arrow_d3 text=3d plane=zox label=hcenter flyout=10.0 arrows=fit arrow_p5 arrow_p6
vdimension arrow_d3 -length -shapes arrow_p5 arrow_p6 -text 3d -plane zox -label hcenter -flyout 10.0 -arrow fit
# test that auto-fit for text places the label externally for small geometry
vdimension length name=arrow_d4 text=3d plane=zox label=hfit flyout=10.0 arrows=fit arrow_p7 arrow_p8
vdimension arrow_d4 -length -shapes arrow_p7 arrow_p8 -text 3d -plane zox -label hfit -flyout 10.0 -arrow fit
vdisplay arrow_d1 arrow_d2 arrow_d3 arrow_d4
vfit
# ------------------------------------------------
@@ -63,7 +62,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension d_$idx
vdimension length name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=10.0 $point1 $point2
vdimension $dimension -length -shapes $point1 $point2 -text 3d -plane zox -label [lindex $hpos $c] [lindex $vpos $r] -arrow external -flyout 10.0
vdisplay $dimension
incr idx

View File

@@ -22,30 +22,29 @@ vpoint circle1_p1 0 0 30
vpoint circle1_p2 30 0 0
vpoint circle1_p3 60 0 30
vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0
vdimension diameter name=diam1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1
vdimension diam1 -diameter -shapes circle1 -text 3d -plane zox -label hfit -flyout 0 -arrow internal
# test forced external arrow orientation
vpoint circle2_p1 100 0 30
vpoint circle2_p2 130 0 0
vpoint circle2_p3 160 0 30
vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0
vdimension diameter name=diam2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2
vdimension diam2 -diameter -shapes circle2 -text 3d -plane zox -label hfit -flyout 0 -arrow external
# test that auto-fit for arrow places them externally for small geometry
vpoint circle3_p1 0 0 102
vpoint circle3_p2 22 0 80
vpoint circle3_p3 44 0 102
vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0
vdimension diameter name=diam3 text=3d plane=zox label=hcenter flyout=0 label=hfit arrows=fit circle3
vdimension diam3 -diameter -shapes circle3 -text 3d -plane zox -label hcenter -flyout 0 -label hfit -arrow fit
# test that auto-fit for text places the label externally for small geometry
vpoint circle4_p1 100 0 92
vpoint circle4_p2 112 0 80
vpoint circle4_p3 124 0 92
vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0
vdimension diameter name=diam4 text=3d plane=zox label=hfit flyout=0 label=hfit arrows=fit circle4
vdimension diam4 -diameter -shapes circle4 -text 3d -plane zox -label hfit -flyout 0 -label hfit -arrow fit
vdisplay diam1 diam2 diam3 diam4
vfit
# ------------------------------------------------
@@ -71,7 +70,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension d_$idx
vdimension diameter name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=0.0 $circle
vdimension $dimension -diameter -shapes $circle -text 3d -plane zox -label [lindex $hpos $c] [lindex $vpos $r] -arrow external -flyout 0.0
vdisplay $dimension
incr idx

View File

@@ -22,30 +22,28 @@ vpoint circle1_p1 0 0 30
vpoint circle1_p2 30 0 0
vpoint circle1_p3 60 0 30
vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0
vdimension radius name=rad1 text=3d plane=zox label=hfit flyout=0 arrows=internal circle1
vdimension rad1 -radius -shapes circle1 -text 3d -plane zox -label hfit -flyout 0 -arrow internal
# test forced external arrow orientation
vpoint circle2_p1 100 0 35
vpoint circle2_p2 135 0 0
vpoint circle2_p3 170 0 35
vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0
vdimension radius name=rad2 text=3d plane=zox label=hfit flyout=0 arrows=external circle2
vdimension rad2 -radius -shapes circle2 -text 3d -plane zox -label hfit -flyout 0 -arrow external
# test that auto-fit for arrow places them externally for small geometry
vpoint circle3_p1 0 0 113
vpoint circle3_p2 33 0 80
vpoint circle3_p3 66 0 113
vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0
vdimension radius name=rad3 text=3d plane=zox label=hcenter flyout=0 arrows=fit circle3
vdimension rad3 -radius -shapes circle3 -text 3d -plane zox -label hcenter -flyout 0 -arrow fit
# test that auto-fit for text places the label externally for small geometry
vpoint circle4_p1 120 0 95
vpoint circle4_p2 135 0 80
vpoint circle4_p3 150 0 95
vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0
vdimension radius name=rad4 text=3d plane=zox label=hfit flyout=0 arrows=fit circle4
vdisplay rad1 rad2 rad3 rad4
vdimension rad4 -radius -shapes circle4 -text 3d -plane zox -label hfit -flyout 0 -arrow fit
vfit
# ------------------------------------------------
@@ -71,7 +69,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension r_$idx
vdimension radius name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=0.0 $circle
vdimension $dimension -radius -shapes $circle -text 3d -plane zox -label [lindex $hpos $c] [lindex $vpos $r] -arrow external -flyout 0.0
vdisplay $dimension
incr idx

View File

@@ -21,25 +21,25 @@ set vpos "above vcenter below"
vpoint angle1_p1 0 0 40
vpoint angle1_p2 0 0 0
vpoint angle1_p3 40 0 0
vdimension angle name=ang1 text=3d plane=zox label=hfit flyout=40.0 arrows=internal angle1_p1 angle1_p2 angle1_p3
vdimension ang1 -angle -shapes angle1_p1 angle1_p2 angle1_p3 -text 3d -plane zox -label hfit -flyout 40.0 -arrow internal
# test forced external arrow orientation
vpoint angle2_p1 80 0 40
vpoint angle2_p2 80 0 0
vpoint angle2_p3 120 0 0
vdimension angle name=ang2 text=3d plane=zox label=hfit flyout=40.0 arrows=external angle2_p1 angle2_p2 angle2_p3
vdimension ang2 -angle -shapes angle2_p1 angle2_p2 angle2_p3 -text 3d -plane zox -label hfit -flyout 40.0 -arrow external
# test that auto-fit for arrow places them externally for small geometry
vpoint angle3_p1 0 0 100
vpoint angle3_p2 0 0 80
vpoint angle3_p3 20 0 80
vdimension angle name=ang3 text=3d plane=zox label=hcenter flyout=20.0 arrows=fit angle3_p1 angle3_p2 angle3_p3
vdimension ang3 -angle -shapes angle3_p1 angle3_p2 angle3_p3 -text 3d -plane zox -label hcenter -flyout 20.0 -arrow fit
# test that auto-fit for text places the label externally for small geometry
vpoint angle4_p1 85 0 100
vpoint angle4_p2 85 0 85
vpoint angle4_p3 100 0 85
vdimension angle name=ang4 text=3d plane=zox label=hfit flyout=15.0 arrows=fit angle4_p1 angle4_p2 angle4_p3
vdimension ang4 -angle -shapes angle4_p1 angle4_p2 angle4_p3 -text 3d -plane zox -label hfit -flyout 15.0 -arrow fit
vdisplay ang1 ang2 ang3 ang4
vfit
@@ -65,7 +65,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension r_$idx
vdimension angle name=$dimension text=3d plane=zox label=[lindex $hpos $c],[lindex $vpos $r] arrows=external flyout=40.0 $point1 $point2 $point3
vdimension $dimension -angle -shapes $point1 $point2 $point3 -text 3d -plane zox -label [lindex $hpos $c] [lindex $vpos $r] -arrow external -flyout 40.0
vdisplay $dimension
incr idx

View File

@@ -9,8 +9,7 @@ box b 100 100 100
explode b e
vdisplay b
vdisplay b_9
vdimension length name=dim1 b_9 text=3d plane=zox
vdisplay dim1
vdimension dim1 -length -shapes b_9 -text 3d -plane zox
vselmode b 2 1
vselmode dim1 2 1
vfit

View File

@@ -23,15 +23,14 @@ vpoint len_p1 0 0 0
vpoint len_p2 40 0 0
verase len_p1 len_p2
vdimension length name=len1 text=3d plane=xoy flyout=20 arrows=external label=left len_p1 len_p2
vdimension length name=len2 text=3d plane=xoy flyout=-20 arrows=external label=right len_p1 len_p2
vdimension len1 -length -text 3d -plane xoy -flyout 20 -arrow external -label left -shapes len_p1 len_p2
vdimension len2 -length -text 3d -plane xoy -flyout -20 -arrow external -label right -shapes len_p1 len_p2
vpoint len_p3 0 20 0
vpoint len_p4 40 20 0
verase len_p3 len_p4
vdimension length name=len3 text=3d plane=xoy flyout=20 arrows=internal label=hcenter len_p3 len_p4
vdisplay len1 len2 len3
vdimension len3 -length -text 3d -plane xoy -flyout 20 -arrow internal -label hcenter -shapes len_p3 len_p4
# diameter
@@ -40,22 +39,21 @@ vpoint diam_p2 120 0 0
vpoint diam_p3 105 -15 0
verase diam_p1 diam_p2 diam_p3
vcircle diam_c1 diam_p1 diam_p2 diam_p3 0
vdimension diameter name=diam1 text=3d plane=xoy arrows=external label=left diam_c1
vdimension diam1 -diameter -text 3d -plane xoy -arrow external -label left -shapes diam_c1
vpoint diam_p4 90 40 0
vpoint diam_p5 120 40 0
vpoint diam_p6 105 25 0
verase diam_p4 diam_p5 diam_p6
vcircle diam_c2 diam_p4 diam_p5 diam_p6 0
vdimension diameter name=diam2 text=3d plane=xoy arrows=external label=right diam_c2
vdimension diam2 -diameter -text 3d -plane xoy -arrow external -label right -shapes diam_c2
vpoint diam_p7 80 -40 0
vpoint diam_p8 120 -40 0
vpoint diam_p9 100 -60 0
verase diam_p7 diam_p8 diam_p9
vcircle diam_c3 diam_p7 diam_p8 diam_p9 0
vdimension diameter name=diam3 text=3d plane=xoy arrows=external label=hcenter flyout=30 diam_c3
vdisplay diam1 diam2 diam3
vdimension diam3 -diameter -text 3d -plane xoy -arrow external -label hcenter -flyout 30 -shapes diam_c3
# radius
@@ -64,15 +62,14 @@ vpoint rad_p2 180 -45 0
vpoint rad_p3 220 -5 0
verase rad_p1 rad_p2 rad_p3
vcircle rad_c1 rad_p1 rad_p2 rad_p3 0
vdimension radius name=rad1 text=3d plane=xoy arrows=internal label=hcenter flyout=0 rad_c1
vdimension rad1 -radius -text 3d -plane xoy -arrow internal -label hcenter -flyout 0 -shapes rad_c1
vpoint rad_p4 180 -70 0
vpoint rad_p5 160 -90 0
vpoint rad_p6 140 -70 0
verase rad_p4 rad_p5 rad_p6
vcircle rad_c2 rad_p4 rad_p5 rad_p6 0
vdimension radius name=rad2 text=3d plane=xoy arrows=external label=left rad_c2
vdisplay rad1 rad2
vdimension rad2 -radius -text 3d -plane xoy -arrow external -label left -shapes rad_c2
# angles
@@ -80,21 +77,20 @@ vpoint ang_p1 0 -50 0
vpoint ang_p2 25 -75 0
vpoint ang_p3 0 -100 0
verase ang_p1 ang_p2 ang_p3
vdimension angle name=ang1 text=3d plane=xoy arrows=internal label=hcenter flyout=35 ang_p1 ang_p2 ang_p3
vdimension ang1 -angle -text 3d -plane xoy -arrow internal -label hcenter -flyout 35 -shapes ang_p1 ang_p2 ang_p3
vpoint ang_p4 0 -120 0
vpoint ang_p5 30 -80 0
vpoint ang_p6 30 -120 0
verase ang_p4 ang_p5 ang_p6
vdimension angle name=ang2 text=3d plane=xoy arrows=external label=left flyout=55 ang_p4 ang_p5 ang_p6
vdimension ang2 -angle -text 3d -plane xoy -arrow external -label left -flyout 55 -shapes ang_p4 ang_p5 ang_p6
vpoint ang_p8 55 -120 0
vpoint ang_p9 55 -80 0
vpoint ang_p10 95 -120 0
verase ang_p8 ang_p9 ang_p10
vdimension angle name=ang3 text=3d plane=xoy arrows=external label=right flyout=55 ang_p8 ang_p9 ang_p10
vdimension ang3 -angle -text 3d -plane xoy -arrow external -label right -flyout 55 -shapes ang_p8 ang_p9 ang_p10
vdisplay ang1 ang2 ang3
vpoint fit1 -75 0 0
vpoint fit2 235 0 0
vfit

View File

@@ -17,8 +17,7 @@ vpoint circ_p2 30 10 0
vpoint circ_p3 60 10 30
vcircle circ circ_p1 circ_p2 circ_p3 0
vdisplay circ
vdimension diameter name=diam circ
vdisplay diam
vdimension diam -diameter -shapes circ
# Change text position
vmovedim diam 15 15 15
vfit
@@ -34,7 +33,7 @@ if { $stat != 1 } {
vdump $anImage1
# Update dimension parameters and set automatic text positioning
vdimparam diam flyout=-5
vdimparam diam -flyout -5
vfit
# Check that text position was changed according to flyout

View File

@@ -15,8 +15,7 @@ vinit Viewer1/View1
vpoint ang_p1 0 0 30
vpoint ang_p2 30 0 0
vpoint ang_p3 60 0 30
vdimension angle name=ang ang_p1 ang_p2 ang_p3
vdisplay ang
vdimension ang -angle -shapes ang_p1 ang_p2 ang_p3
vmovedim ang 5 0 5
vfit
@@ -32,7 +31,7 @@ vdump $anImage1
# Update dimension parameters and set automatic text positioning
vdimparam ang flyout=-5
vdimparam ang -flyout -5
vfit
# Check that text position was changed according to flyout