return ComputeValue();
case TOL_Value:
{
- /*Standard_PCharacter aCString;
- myLabel.ToUTF8CString (aCString);
- return atof (aCString);*/
return myCustomValue;
}
case TOL_Text:
//function : GetGeometryType
//purpose :
//=======================================================================
-const Standard_Integer AIS_Dimension::GetGeometryType () const
+const Standard_Integer AIS_Dimension::GetGeometryType() const
{
return myGeometryType;
}
if (hasLabel && myLeaderSegmentLength > 0 && myIsTextAligned)
{
gp_Lin aSegmentLine (anExtEnd, aTextDir);
- Standard_Real aSegmentLength = isShortLine ? myLeaderSegmentLength : theLabelWidth + myLeaderSegmentLength;
+ Standard_Real aSegmentLength = (theLabelPosition & LabelPosition_VCenter) ? myLeaderSegmentLength : theLabelWidth + myLeaderSegmentLength;
aSegmentPoint = ElCLib::Value (aSegmentLength, aSegmentLine);
- DrawText (thePresentation,
- aSegmentPoint,
- aTextDir,
- theLabelString,
- theLabelPosition);
+ aTextPos = (theLabelPosition & LabelPosition_VCenter) ? aSegmentPoint : ElCLib::Value (myLeaderSegmentLength, aSegmentLine);
}
- else
- {
- DrawText (thePresentation,
- aTextPos,
- aTextDir,
- theLabelString,
- theLabelPosition);
- }
-
+ DrawText (thePresentation,
+ aTextPos,
+ aTextDir,
+ theLabelString,
+ theLabelPosition);
}
if (theMode != ComputeMode_All && theMode != ComputeMode_Line)
: (aCenterLineBegin.XYZ() + aCenterLineEnd.XYZ()) * 0.5;
// Choose a text direction
- gp_Dir aTextDir = aDimensionLine.Direction();
+ gp_Dir aTextDir = myIsTextAligned
+ ? myTextDir
+ : aDimensionLine.Direction();
// add text primitives
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
Prs3d_Root::NewGroup (thePresentation);
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
- if (!theIsOneSide && theToDrawDimensionLine)
+ if (!theIsOneSide && (theToDrawDimensionLine || (!isArrowsExternal && !theToDrawDimensionLine) ))
{
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
}
Prs3d_Root::NewGroup (thePresentation);
DrawArrow (thePresentation, aSecondArrowBegin, aSecondArrowDir);
- if (!theIsOneSide && theToDrawDimensionLine)
+ if (!theIsOneSide && (theToDrawDimensionLine || (!theToDrawDimensionLine && !isArrowsExternal) ))
{
DrawArrow (thePresentation, aFirstArrowBegin, aFirstArrowDir);
}
theCommands.Add("vdimension",
"vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]\n"
"[-text 3d|2d wf|sh|wireframe|shading IntegerSize]\n"
- "[-label left|right|hcenter|hfit top|bottom|vcenter|vfit]\n"
+ "[-label left|right|hcenter|hfit above|below|vcenter|vfit]\n"
"[-arrow external|internal|fit]\n"
"[{-arrowlength|-arlen} RealArrowLength]\n"
"[{-arrowangle|-arangle} ArrowAngle(degrees)]\n"
vpoint lengthP1 0 0 0
vpoint lengthP2 50 100 0
vpoint lengthP3 -50 100 0
+vpoint lengthP4 0 200 0
# Text in center - custom aligment does not taken into account
vdimension dim1 -length -plane xoy -shapes lengthP1 lengthP2 -text 3d -aligntext 1.0 0.0 0.0 -flyout -10
# Text on the right side - it is aligned
-vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext 1.0 0.0 0.0 -segment 15 -label right
+vdimension dim2 -length -plane xoy -shapes lengthP1 lengthP3 -text 3d -aligntext 1.0 0.0 0.0 -segment 0 -label right
# Text on the left side - it is aligned
-vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 10 -label left
+vdimension dim3 -length -plane xoy -shapes lengthP2 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 5 -label left
+# Text on the left side - it is aligned
+vdimension dim4 -length -plane xoy -shapes lengthP2 lengthP4 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -segment 25 -label left
+# Text on the left side - it is aligned
+vdimension dim5 -length -plane xoy -shapes lengthP4 lengthP3 -text 3d -flyout -10 -aligntext 1.0 0.0 0.0 -label left above -segment 10
vfit
#finalize and dump
set only_screen 1
\ No newline at end of file
#Check all text and arrow positions
vdimension aDim1 -radius -shapes aCircle -circleparam 10 -text 3d -label right -arrow external -hidedimline -valuetext "+2.0\n-3.0\nThickness" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
-vdimension aDim2 -diameter -shapes aCircle -circleparam 5 -text 3d -label right -arrow external -hidedimline -valuetext "+4.0\n -6.0" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
+vdimension aDim2 -diameter -shapes aCircle -circleparam 5 -text 3d -label left -arrow external -hidedimline -valuetext "+4.0\n -6.0" -aligntext 1.0 0.0 0.0 -segment 15 -label left firstline
vdimension aDim3 -radius -shapes aCircle -circleparam 20 -text 3d -plane zox -label right -arrow external -hidedimline
vdimension aDim4 -radius -shapes aCircle -circleparam 40 -text 3d -plane zox -label vcenter -arrow internal -hidedimline
vdimparam aDim3 -text 6