1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +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

BIN
data/images/hatch_1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

100
samples/tcl/dimensions.tcl Normal file
View File

@ -0,0 +1,100 @@
# Demo script for dimensions
puts "Dimensions demo: it shows capability of OCC to create different kinds "
puts "of dimensions (linear and angular) with 2D or 3D text."
set dispScriptFile [file normalize [info script]]
set scriptFolder [file dirname $dispScriptFile]
set aTopLoc [locate_data_file occ/Top.brep]
set aBotLoc [locate_data_file occ/Bottom.brep]
set aHatch [locate_data_file images/hatch_1.png]
if { ![file exist "$aTopLoc"] || ![file exist "$aBotLoc"] } {
puts "No model file in current directory!"
puts "Please put Bottom.brep and Top.brep in current directory and try again"
}
pload MODELING VISUALIZATION
restore $aTopLoc a
restore $aBotLoc b
vinit View1 w=768 h=768
vclear
vsetdispmode 0
vsetcolorbg 255 255 255
vbottom
# Get cut projection
box bb -150 -250 0 150 250 100
bsection bs b bb
bsection as a bb
vdisplay bs as
vfit
set anAEdges [explode as E]
set aBEbges [explode bs E]
#foreach e [concat $anAEdges $aBEbges] { vdisplay $e }
set anArrAngle [expr 3.14 * 12.0 / 180.0]
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}
vdimension dbs_19 -length -shapes bs_19 -plane xoy -color black -flyout -15
vdimension dbs_6 -length -shapes bs_6 -plane xoy -color black -flyout 15
vdimension dbs_27 -length -shapes bs_27 -plane xoy -color black -label right -flyout -27
vdimension das_7 -length -shapes as_7 -plane xoy -color black -flyout -20
vdimension das_25 -length -shapes as_25 -plane xoy -color black -flyout -15
vdimension das_26 -length -shapes as_26 -plane xoy -color black -flyout 30
vdimension dbs_22 -length -shapes bs_22 -plane xoy -color black -flyout -20
vdimension das_43 -length -shapes as_43 -plane xoy -color black -flyout 55 -label right
vdimension das_12 -length -shapes as_12 -plane xoy -color black -flyout 35 -label right
vdimension das_41 -length -shapes as_41 -plane xoy -color black -flyout 15
vdimension dbs_39 -radius -shapes bs_39 -color black -label right
vdimension dbs_59 -radius -shapes bs_59 -color black
vdimension das_3944 -angle -shapes as_39 as_44 -color black
vdimension dbs_1826 -angle -shapes bs_18 bs_26 -color black
vdimension das_4843 -angle -shapes as_48 as_43 -color black
foreach i $aList {
vdimparam $i text=3d textsize=6 textmode=s arlength=4 arangle=$anArrAngle
}
# Final fit
foreach e [concat $anAEdges $aBEbges] {
vremove $e
}
vfit
vdisplay a b
vsetdispmode a 1
vsetdispmode b 1
vaspects a -setmaterial steel
vaspects b -setmaterial bronze
# set clipping plane
vclipplane create pa
vclipplane change pa equation 0 0 1 0
vclipplane change pa capping on
vclipplane change pa capping color 0.9 0.9 0.9
#vclipplane change pa capping hatch on
vclipplane set pa object a
vclipplane create pb
vclipplane change pb equation 0 0 1 0
vclipplane change pb capping on
vclipplane change pb capping color 1.0 0.8 0.0
#vclipplane change pb capping hatch on
vclipplane set pb object b
vsettexturemode Driver1/Viewer1/View1 2
vclipplane change pa capping texname $aHatch
vclipplane change pa capping texscale 0.05 -0.05
vclipplane change pb capping texname $aHatch
vclipplane change pb capping texscale 0.05 0.05
# nice view
vbottom
vrotate -0.3 -0.3 0
vfit
vzoom 1.2

View File

@ -68,6 +68,7 @@
#include <TCollection_ExtendedString.hxx> #include <TCollection_ExtendedString.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <Units.hxx> #include <Units.hxx>
#include <Units_UnitsDictionary.hxx> #include <Units_UnitsDictionary.hxx>
@ -1019,6 +1020,48 @@ Standard_Boolean AIS_Dimension::CircleFromPlanarFace (const TopoDS_Face& theFace
return Standard_False; return Standard_False;
} }
//=======================================================================
//function : CircleFromEdge
//purpose : if possible computes circle from edge
//=======================================================================
Standard_Boolean AIS_Dimension::CircleFromEdge (const TopoDS_Edge& theEdge,
gp_Circ& theCircle,
gp_Pnt& theFirstPoint,
gp_Pnt& theLastPoint)
{
BRepAdaptor_Curve anAdaptedCurve (theEdge);
switch (anAdaptedCurve.GetType())
{
case GeomAbs_Circle:
{
theCircle = anAdaptedCurve.Circle();
break;
}
case GeomAbs_Ellipse:
{
gp_Elips anEll = anAdaptedCurve.Ellipse();
if ((anEll.MinorRadius() - anEll.MajorRadius()) >= Precision::Confusion())
{
return Standard_False;
}
theCircle = gp_Circ(anEll.Position(),anEll.MinorRadius());
break;
}
case GeomAbs_Line:
case GeomAbs_Hyperbola:
case GeomAbs_Parabola:
case GeomAbs_BezierCurve:
case GeomAbs_BSplineCurve:
case GeomAbs_OtherCurve:
default:
return Standard_False;
}
theFirstPoint = anAdaptedCurve.Value (anAdaptedCurve.FirstParameter());
theLastPoint = anAdaptedCurve.Value (anAdaptedCurve.LastParameter());
return Standard_True;
}
//======================================================================= //=======================================================================
//function : InitCircularDimension //function : InitCircularDimension
//purpose : //purpose :
@ -1036,122 +1079,126 @@ Standard_Boolean AIS_Dimension::InitCircularDimension (const TopoDS_Shape& theSh
Standard_Real aFirstParam = 0.0; Standard_Real aFirstParam = 0.0;
Standard_Real aLastParam = 0.0; Standard_Real aLastParam = 0.0;
// discover circular geometry // Discover circular geometry
if (theShape.ShapeType() == TopAbs_FACE) switch (theShape.ShapeType())
{ {
AIS::GetPlaneFromFace (TopoDS::Face (theShape), aPln, aBasisSurf, aSurfType, anOffset); case TopAbs_FACE:
if (aSurfType == AIS_KOS_Plane)
{ {
Handle(Geom_Curve) aCurve; AIS::GetPlaneFromFace (TopoDS::Face (theShape), aPln, aBasisSurf, aSurfType, anOffset);
if (!CircleFromPlanarFace (TopoDS::Face (theShape), aCurve, aFirstPoint, aLastPoint))
{
return Standard_False;
}
theCircle = Handle(Geom_Circle)::DownCast (aCurve)->Circ(); if (aSurfType == AIS_KOS_Plane)
}
else
{
gp_Pnt aCurPos;
BRepAdaptor_Surface aSurf1 (TopoDS::Face (theShape));
Standard_Real aFirstU = aSurf1.FirstUParameter();
Standard_Real aLastU = aSurf1.LastUParameter();
Standard_Real aFirstV = aSurf1.FirstVParameter();
Standard_Real aLastV = aSurf1.LastVParameter();
Standard_Real aMidU = (aFirstU + aLastU) * 0.5;
Standard_Real aMidV = (aFirstV + aLastV) * 0.5;
aSurf1.D0 (aMidU, aMidV, aCurPos);
Handle (Adaptor3d_HCurve) aBasisCurve;
Standard_Boolean isExpectedType = Standard_False;
if (aSurfType == AIS_KOS_Cylinder)
{ {
isExpectedType = Standard_True; Handle(Geom_Curve) aCurve;
} if (!CircleFromPlanarFace (TopoDS::Face (theShape), aCurve, aFirstPoint, aLastPoint))
else
{
if (aSurfType == AIS_KOS_Revolution)
{ {
aBasisCurve = aSurf1.BasisCurve(); return Standard_False;
if (aBasisCurve->GetType() == GeomAbs_Line)
{
isExpectedType = Standard_True;
}
} }
else if (aSurfType == AIS_KOS_Extrusion)
{
aBasisCurve = aSurf1.BasisCurve();
if (aBasisCurve->GetType() == GeomAbs_Circle)
{
isExpectedType = Standard_True;
}
}
}
if (!isExpectedType)
{
return Standard_False;
}
Handle(Geom_Curve) aCurve;
aCurve = aBasisSurf->VIso(aMidV);
if (aCurve->DynamicType() == STANDARD_TYPE (Geom_Circle))
{
theCircle = Handle(Geom_Circle)::DownCast (aCurve)->Circ(); theCircle = Handle(Geom_Circle)::DownCast (aCurve)->Circ();
} }
else if (aCurve->DynamicType() == STANDARD_TYPE (Geom_TrimmedCurve))
{
Handle(Geom_TrimmedCurve) aTrimmedCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve);
aFirstU = aTrimmedCurve->FirstParameter();
aLastU = aTrimmedCurve->LastParameter();
if (aTrimmedCurve->BasisCurve()->DynamicType() == STANDARD_TYPE (Geom_Circle))
{
theCircle = Handle(Geom_Circle)::DownCast(aTrimmedCurve->BasisCurve())->Circ();
}
}
else else
{ {
// Compute a circle from 3 points on "aCurve" gp_Pnt aCurPos;
gp_Pnt aP1, aP2; BRepAdaptor_Surface aSurf1 (TopoDS::Face (theShape));
aSurf1.D0 (aFirstU, aMidV, aP1); Standard_Real aFirstU = aSurf1.FirstUParameter();
aSurf1.D0 (aLastU, aMidV, aP2); Standard_Real aLastU = aSurf1.LastUParameter();
GC_MakeCircle aMkCirc (aP1, aCurPos, aP2); Standard_Real aFirstV = aSurf1.FirstVParameter();
theCircle = aMkCirc.Value()->Circ(); Standard_Real aLastV = aSurf1.LastVParameter();
} Standard_Real aMidU = (aFirstU + aLastU) * 0.5;
Standard_Real aMidV = (aFirstV + aLastV) * 0.5;
aSurf1.D0 (aMidU, aMidV, aCurPos);
Handle (Adaptor3d_HCurve) aBasisCurve;
Standard_Boolean isExpectedType = Standard_False;
if (aSurfType == AIS_KOS_Cylinder)
{
isExpectedType = Standard_True;
}
else
{
if (aSurfType == AIS_KOS_Revolution)
{
aBasisCurve = aSurf1.BasisCurve();
if (aBasisCurve->GetType() == GeomAbs_Line)
{
isExpectedType = Standard_True;
}
}
else if (aSurfType == AIS_KOS_Extrusion)
{
aBasisCurve = aSurf1.BasisCurve();
if (aBasisCurve->GetType() == GeomAbs_Circle)
{
isExpectedType = Standard_True;
}
}
}
aFirstPoint = ElCLib::Value (aFirstU, theCircle); if (!isExpectedType)
aLastPoint = ElCLib::Value (aLastU, theCircle); {
return Standard_False;
}
Handle(Geom_Curve) aCurve = aBasisSurf->VIso(aMidV);
if (aCurve->DynamicType() == STANDARD_TYPE (Geom_Circle))
{
theCircle = Handle(Geom_Circle)::DownCast (aCurve)->Circ();
}
else if (aCurve->DynamicType() == STANDARD_TYPE (Geom_TrimmedCurve))
{
Handle(Geom_TrimmedCurve) aTrimmedCurve = Handle(Geom_TrimmedCurve)::DownCast (aCurve);
aFirstU = aTrimmedCurve->FirstParameter();
aLastU = aTrimmedCurve->LastParameter();
if (aTrimmedCurve->BasisCurve()->DynamicType() == STANDARD_TYPE (Geom_Circle))
{
theCircle = Handle(Geom_Circle)::DownCast(aTrimmedCurve->BasisCurve())->Circ();
}
}
else
{
// Compute a circle from 3 points on "aCurve"
gp_Pnt aP1, aP2;
aSurf1.D0 (aFirstU, aMidV, aP1);
aSurf1.D0 (aLastU, aMidV, aP2);
GC_MakeCircle aMkCirc (aP1, aCurPos, aP2);
theCircle = aMkCirc.Value()->Circ();
}
aFirstPoint = ElCLib::Value (aFirstU, theCircle);
aLastPoint = ElCLib::Value (aLastU, theCircle);
}
break;
} }
} case TopAbs_WIRE:
else // TopAbs_EDGE | TopAbs_WIRE
{
TopoDS_Edge anEdge;
if (theShape.ShapeType() == TopAbs_WIRE)
{ {
TopoDS_Edge anEdge;
TopExp_Explorer anIt (theShape, TopAbs_EDGE); TopExp_Explorer anIt (theShape, TopAbs_EDGE);
if (anIt.More()) if (anIt.More())
{ {
anEdge = TopoDS::Edge (anIt.Current()); anEdge = TopoDS::Edge (anIt.Current());
} }
if (!AIS_Dimension::CircleFromEdge (anEdge, theCircle, aFirstPoint, aLastPoint))
{
return Standard_False;
}
break;
} }
else if (theShape.ShapeType() == TopAbs_EDGE) case TopAbs_EDGE:
{ {
anEdge = TopoDS::Edge (theShape); TopoDS_Edge anEdge = TopoDS::Edge (theShape);
if (!AIS_Dimension::CircleFromEdge (anEdge, theCircle, aFirstPoint, aLastPoint))
{
return Standard_False;
}
break;
} }
else // Unexpected type of shape case TopAbs_COMPOUND:
{ case TopAbs_COMPSOLID:
case TopAbs_SOLID:
case TopAbs_SHELL:
case TopAbs_VERTEX:
case TopAbs_SHAPE:
default:
return Standard_False; return Standard_False;
}
BRepAdaptor_Curve anAdaptedCurve (anEdge);
if (anAdaptedCurve.GetType() != GeomAbs_Circle)
{
return Standard_False;
}
theCircle = anAdaptedCurve.Circle();
aFirstPoint = anAdaptedCurve.Value (anAdaptedCurve.FirstParameter());
aLastPoint = anAdaptedCurve.Value (anAdaptedCurve.LastParameter());
} }
theIsClosed = aFirstPoint.IsEqual (aLastPoint, Precision::Confusion()); theIsClosed = aFirstPoint.IsEqual (aLastPoint, Precision::Confusion());

View File

@ -37,6 +37,7 @@
#include <Standard.hxx> #include <Standard.hxx>
#include <TCollection_ExtendedString.hxx> #include <TCollection_ExtendedString.hxx>
#include <TColgp_HSequenceOfPnt.hxx> #include <TColgp_HSequenceOfPnt.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <NCollection_Sequence.hxx> #include <NCollection_Sequence.hxx>
@ -451,16 +452,6 @@ protected:
const gp_Pnt& theFirstPoint, const gp_Pnt& theFirstPoint,
const gp_Pnt& theSecondPoint); const gp_Pnt& theSecondPoint);
//! If it is possible extracts circle from planar face.
//! @param theFace [in] the planar face.
//! @param theCurve [out] the circular curve.
//! @param theFirstPoint [out] the point of the first parameter of the circlular curve.
//! @param theSecondPoint [out] the point of the last parameter of the circlular curve.
//! @return TRUE in case of successful circle extraction.
Standard_EXPORT Standard_Boolean CircleFromPlanarFace (const TopoDS_Face& theFace,
Handle(Geom_Curve)& theCurve,
gp_Pnt& theFirstPoint,
gp_Pnt& theLastPoint);
//! Performs initialization of circle and middle arc point from the passed //! Performs initialization of circle and middle arc point from the passed
//! shape which is assumed to contain circular geometry. //! shape which is assumed to contain circular geometry.
@ -532,6 +523,30 @@ protected:
gp_Pln& thePlane, gp_Pln& thePlane,
Standard_Boolean& theIsPlaneOld) const; Standard_Boolean& theIsPlaneOld) const;
protected: //! @name Static auxilliary methods for geometry extraction
//! If it is possible extracts circle from planar face.
//! @param theFace [in] the planar face
//! @param theCurve [out] the circular curve
//! @param theFirstPoint [out] the point of the first parameter of the circlular curve
//! @param theSecondPoint [out] the point of the last parameter of the circlular curve
//! @return TRUE in case of successful circle extraction
static Standard_Boolean CircleFromPlanarFace (const TopoDS_Face& theFace,
Handle(Geom_Curve)& theCurve,
gp_Pnt& theFirstPoint,
gp_Pnt& theLastPoint);
//! If it is possible extracts circle from the edge.
//! @param theEdge [in] input edge to extract circle from
//! @param theCircle [out] circle
//! @param theFirstPoint [out] the point of the first parameter of the circlular curve
//! @param theSecondPoint [out] the point of the last parameter of the circlular curve
//! @return TRUE in case of successful circle extraction.
static Standard_Boolean CircleFromEdge (const TopoDS_Edge& theEdge,
gp_Circ& theCircle,
gp_Pnt& theFirstPoint,
gp_Pnt& theLastPoint);
protected: //! @name Behavior to implement protected: //! @name Behavior to implement
//! Override this method to compute automatically dimension plane //! Override this method to compute automatically dimension plane

View File

@ -44,7 +44,7 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER); myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
myArrowAspect = new Prs3d_ArrowAspect; myArrowAspect = new Prs3d_ArrowAspect;
myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN); myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
myArrowAspect->SetAngle (M_PI * 20.0 / 180.0); myArrowAspect->SetAngle (M_PI * 12.0 / 180.0);
myArrowAspect->SetLength (6.0); myArrowAspect->SetLength (6.0);
myExtensionSize = 6.0; myExtensionSize = 6.0;
myArrowTailSize = 6.0; myArrowTailSize = 6.0;

View File

@ -165,213 +165,286 @@ static Standard_Boolean Get3DPointAtMousePosition (const gp_Pnt& theFirstPoint,
return Standard_True; return Standard_True;
} }
//=======================================================================
//function : ParseDimensionParams
//purpose : Auxilliary function: sets aspect parameters for
// length, angle, radius and diameter dimension.
//
//draw args: -text [3d|2d] [wf|sh|wireframe|shading] [Size]
// -label [left|right|hcenter|hfit] [top|bottom|vcenter|vfit]
// -arrow [external|internal|fit] [Length(int)]
// -arrowangle ArrowAngle(degrees)
// -plane xoy|yoz|zox
// -flyout FloatValue -extension FloatValue
//
// Warning! flyout is not an aspect value, it is for dimension parameter
// likewise text position, but text position override other paramaters
// For this use 'vmovedim'.
//=======================================================================
static int ParseDimensionParams (Standard_Integer theArgNum,
const char** theArgVec,
Standard_Integer theStartIndex,
const Handle(Prs3d_DimensionAspect)& theAspect,
Standard_Boolean& theIsCustomPlane,
gp_Pln& thePlane,
Standard_Boolean& theIsCustomFlyout,
Standard_Real& theFlyoutSize,
NCollection_List<Handle(AIS_InteractiveObject)>* theShapeList = NULL)
{
theIsCustomPlane = Standard_False;
theIsCustomFlyout = Standard_False;
// Begin from the second parameter: the first on eis dimension name
for (Standard_Integer anIt = theStartIndex; anIt < theArgNum; ++anIt)
{
TCollection_AsciiString aParam (theArgVec[anIt]);
aParam.LowerCase();
if (aParam.Search ("-") == -1)
{
continue;
}
// Before all non-boolean flags parsing check if a flag have at least one value.
if (anIt + 1 >= theArgNum)
{
std::cerr << "Error: "<< aParam <<" flag should have value.\n";
return 1;
}
// Non-boolean flags
if (aParam.IsEqual ("-shape")
|| aParam.IsEqual ("-shapes"))
{
if (!theShapeList)
{
std::cerr << "Error: unknown parameter '" << aParam << "'\n";
return 1;
}
do
{
anIt++;
TCollection_AsciiString anArgString = theArgVec[anIt];
Handle(AIS_InteractiveObject) anAISObject;
Standard_CString aStr = anArgString.ToCString();
TopoDS_Shape aShape = DBRep::Get (aStr);
if (!aShape.IsNull())
{
anAISObject = new AIS_Shape (aShape);
}
else
{
if (!GetMapOfAIS().IsBound2 (anArgString))
{
std::cerr << "Error: shape with name '" << aStr << "' is not found.\n";
return 1;
}
anAISObject = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anArgString));
if (anAISObject.IsNull())
{
std::cerr << "Error: " << aStr <<" is not a shape.\n";
return 1;
}
}
theShapeList->Append (anAISObject);
}
while (anIt + 1 < theArgNum && theArgVec[anIt + 1][0] != '-');
}
else if (aParam.IsEqual ("-text"))
{
do
{
anIt++;
TCollection_AsciiString aValue (theArgVec[anIt]);
aValue.LowerCase();
if (aValue.IsEqual ("3d"))
{
theAspect->MakeText3d (Standard_True);
}
else if (aValue.IsEqual ("2d"))
{
theAspect->MakeText3d (Standard_False);
}
else if (aValue.IsEqual ("wf") || aValue.IsEqual ("wireframe"))
{
theAspect->MakeTextShaded (Standard_False);
}
else if ( aValue.IsEqual ("sh") || aValue.IsEqual ("shading"))
{
theAspect->MakeTextShaded (Standard_True);
}
else if (aValue.IsIntegerValue()) // text size
{
theAspect->TextAspect()->SetHeight (Draw::Atoi (aValue.ToCString()));
}
}
while (anIt + 1 < theArgNum && theArgVec[anIt + 1][0] != '-');
}
else if (aParam.IsEqual ("-label"))
{
do
{
anIt++;
TCollection_AsciiString aParamValue (theArgVec[anIt]);
aParamValue.LowerCase();
if (aParamValue == "left") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left); }
else if (aParamValue == "right") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right); }
else if (aParamValue == "hcenter") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center);}
else if (aParamValue == "hfit") { theAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit); }
else if (aParamValue == "above") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Above); }
else if (aParamValue == "below") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Below); }
else if (aParamValue == "vcenter") { theAspect->SetTextVerticalPosition (Prs3d_DTVP_Center);}
else
{
std::cerr << "Error: invalid label position: '" << aParamValue << "'.\n";
return 1;
}
}
while (anIt + 1 < theArgNum && theArgVec[anIt+1][0] != '-');
}
else if (aParam.IsEqual ("-arrow"))
{
do
{
anIt++;
TCollection_AsciiString aParam (theArgVec[anIt]);
aParam.LowerCase();
if (aParam == "external") { theAspect->SetArrowOrientation (Prs3d_DAO_External); }
if (aParam == "internal") { theAspect->SetArrowOrientation (Prs3d_DAO_Internal); }
if (aParam == "fit") { theAspect->SetArrowOrientation (Prs3d_DAO_Fit); }
if (aParam.IsRealValue()) { theAspect->ArrowAspect()->SetLength (Draw::Atof (aParam.ToCString())); }
}
while (anIt + 1 < theArgNum && theArgVec[anIt + 1][0] != '-');
}
else if (aParam.IsEqual ("-arrowangle"))
{
TCollection_AsciiString aValue (theArgVec[++anIt]);
if (!aValue.IsRealValue())
{
std::cerr << "Error: arrow angle should be float degree value.\n";
return 1;
}
theAspect->ArrowAspect()->SetAngle (Draw::Atof (aValue.ToCString()));
}
else if (aParam.IsEqual ("-plane"))
{
TCollection_AsciiString aValue (theArgVec[++anIt]);
aValue.LowerCase();
if (aValue == "xoy")
{
theIsCustomPlane = Standard_True;
thePlane = gp_Pln (gp_Ax3 (gp::XOY()));
}
else if (aValue == "zox")
{
theIsCustomPlane = Standard_True;
thePlane = gp_Pln (gp_Ax3 (gp::ZOX()));
}
else if (aValue == "yoz")
{
theIsCustomPlane = Standard_True;
thePlane = gp_Pln (gp_Ax3 (gp::YOZ()));
}
else
{
std::cerr << "Error: wrong plane '" << aValue << "'.\n";
return 1;
}
}
else if (aParam.IsEqual ("-flyout"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
if (!aParam.IsRealValue())
{
std::cerr << "Error: flyout for dimension should be real value.\n";
return 1;
}
theIsCustomFlyout = Standard_True;
theFlyoutSize = Draw::Atoi (aParam.ToCString());
}
else if (aParam.IsEqual ("-color"))
{
theAspect->SetCommonColor (Quantity_Color (ViewerTest::GetColorFromName (theArgVec[++anIt])));
}
else if (aParam.IsEqual ("-extension"))
{
TCollection_AsciiString aParam (theArgVec[++anIt]);
if (!aParam.IsRealValue())
{
std::cerr << "Error: extension size for dimension should be real value.\n";
return 1;
}
theAspect->SetExtensionSize (Draw::Atof (aParam.ToCString()));
}
else
{
std::cerr << "Error: unknown parameter '" << aParam << "'.\n";
return 1;
}
}
return 0;
}
//======================================================================= //=======================================================================
//function : VDimBuilder //function : VDimBuilder
//purpose : Command for building dimension presentations: angle, //purpose : Command for building dimension presentations: angle,
// length, radius, diameter // length, radius, diameter
//======================================================================= //=======================================================================
static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, const char** theArgs) static int VDimBuilder (Draw_Interpretor& /*theDi*/,
Standard_Integer theArgsNb,
const char** theArgs)
{ {
if (theArgsNb < 2) if (theArgsNb < 2)
{ {
std::cerr << theArgs[0] << ": command argument is required. Type help for more information.\n"; std::cerr << "Error: wrong number of arguments.\n";
return 1; return 1;
} }
// Parse parameters // Parse parameters
TCollection_AsciiString aDimType(theArgs[1]); TCollection_AsciiString aName (theArgs[1]);
NCollection_List<Handle(AIS_InteractiveObject)> aShapes;
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
Standard_Boolean isPlaneCustom = Standard_False;
gp_Pln aWorkingPlane;
Standard_Boolean isCustomFlyout = Standard_False;
Standard_Real aCustomFlyout = 0.0;
TCollection_AsciiString aDimType(theArgs[2]);
aDimType.LowerCase();
AIS_KindOfDimension aKindOfDimension; AIS_KindOfDimension aKindOfDimension;
if (aDimType == "length") if (aDimType == "-length")
{ {
aKindOfDimension = AIS_KOD_LENGTH; aKindOfDimension = AIS_KOD_LENGTH;
} }
else if (aDimType == "angle") else if (aDimType == "-angle")
{ {
aKindOfDimension = AIS_KOD_PLANEANGLE; aKindOfDimension = AIS_KOD_PLANEANGLE;
} }
else if (aDimType == "radius") else if (aDimType == "-radius")
{ {
aKindOfDimension = AIS_KOD_RADIUS; aKindOfDimension = AIS_KOD_RADIUS;
} }
else if (aDimType == "diameter" || aDimType == "diam") else if (aDimType == "-diameter" || aDimType == "-diam")
{ {
aKindOfDimension = AIS_KOD_DIAMETER; aKindOfDimension = AIS_KOD_DIAMETER;
} }
else else
{ {
std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; std::cerr << "Error: wrong type of dimension.\n";
return 1; return 1;
} }
NCollection_List<Handle(AIS_InteractiveObject)> aShapes;
Handle(Prs3d_DimensionAspect) anAspect = new Prs3d_DimensionAspect;
Standard_Boolean isPlaneCustom = Standard_False;
TCollection_AsciiString aName;
gp_Pln aWorkingPlane;
Standard_Boolean isCustomFlyout = Standard_False;
Standard_Real aCustomFlyout = 0.0;
for (Standard_Integer anIt = 2; anIt < theArgsNb; ++anIt)
{
TCollection_AsciiString anArgString = theArgs[anIt];
TCollection_AsciiString aParamName;
TCollection_AsciiString aParamValue;
if (ViewerTest::SplitParameter (anArgString, aParamName, aParamValue))
{
aParamName.LowerCase();
aParamValue.LowerCase();
if (aParamName == "text") ParseDimensionParams (theArgsNb, theArgs, 3,
{ anAspect,isPlaneCustom,aWorkingPlane,
anAspect->MakeText3d (aParamValue == "3d"); isCustomFlyout,aCustomFlyout, &aShapes);
}
else if (aParamName == "name")
{
if (aParamValue.IsEmpty())
{
std::cerr << theArgs[0] << ": no name for dimension.\n";
return 1;
}
aName = aParamValue;
}
else if (aParamName == "plane")
{
if (aParamValue == "xoy")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::XOY()));
}
else if (aParamValue == "zox")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::ZOX()));
}
else if (aParamValue == "yoz")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::YOZ()));
}
else
{
std::cerr << theArgs[0] << ": wrong plane.\n";
return 1;
}
isPlaneCustom = Standard_True;
}
else if (aParamName == "label")
{
NCollection_List<TCollection_AsciiString> aListOfLabelVals;
while (aParamValue.Length() > 0)
{
TCollection_AsciiString aValue = aParamValue;
Standard_Integer aSeparatorPos = aParamValue.Search (",");
if (aSeparatorPos >= 0)
{
aValue.Trunc (aSeparatorPos - 1);
aParamValue.Remove (aSeparatorPos, 1);
}
aListOfLabelVals.Append (aValue);
aParamValue.Remove (1, aValue.Length());
}
NCollection_List<TCollection_AsciiString>::Iterator aLabelValueIt (aListOfLabelVals);
for ( ; aLabelValueIt.More(); aLabelValueIt.Next())
{
aParamValue = aLabelValueIt.Value();
if (aParamValue == "left")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left);
}
else if (aParamValue == "right")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right);
}
else if (aParamValue == "hcenter")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center);
}
else if (aParamValue == "hfit")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit);
}
else if (aParamValue == "above")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Above);
}
else if (aParamValue == "below")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Below);
}
else if (aParamValue == "vcenter")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Center);
}
else
{
std::cerr << theArgs[0] << ": invalid label position: \"" << aParamValue << "\".\n";
return 1;
}
}
}
else if (aParamName == "flyout")
{
if (!aParamValue.IsRealValue())
{
std::cerr << theArgs[0] << ": numeric value expected for flyout.\n";
return 1;
}
aCustomFlyout = aParamValue.RealValue();
isCustomFlyout = Standard_True;
}
else if (aParamName == "arrows")
{
if (aParamValue == "external")
{
anAspect->SetArrowOrientation (Prs3d_DAO_External);
}
else if (aParamValue == "internal")
{
anAspect->SetArrowOrientation (Prs3d_DAO_Internal);
}
else if (aParamValue == "fit")
{
anAspect->SetArrowOrientation (Prs3d_DAO_Fit);
}
}
else
{
std::cerr << theArgs[0] << ": unknow parameter: \"" << aParamName << "\".\n";
return 1;
}
}
else // Shape
{
if (!GetMapOfAIS().IsBound2 (anArgString))
{
std::cerr << theArgs[0] << ": wrong name of shape. May be here is a wrong parameter.\n";
return 1;
}
Handle(AIS_InteractiveObject) aShape = Handle(AIS_InteractiveObject)::DownCast (GetMapOfAIS().Find2 (anArgString));
if (aShape.IsNull())
{
std::cerr << theArgs[0] << ": wrong name of shape. Not a shape.\n";
return 1;
}
aShapes.Append (aShape);
}
}
if (aName.IsEmpty())
{
std::cerr << theArgs[0] << ": no name for dimension.\n";
return 1;
}
// Build dimension // Build dimension
Handle(AIS_Dimension) aDim; Handle(AIS_Dimension) aDim;
@ -387,26 +460,33 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
if (aShapes.Extent() == 1) if (aShapes.Extent() == 1)
{ {
if (aShapes.First()->Type() == AIS_KOI_Shape if (aShapes.First()->Type() == AIS_KOI_Shape
&& (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE) && (Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape().ShapeType() != TopAbs_EDGE)
{ {
std::cerr << theArgs[0] << ": wrong shape type.\n"; std::cerr << theArgs[0] << ": wrong shape type.\n";
return 1; return 1;
} }
aDim = new AIS_LengthDimension (TopoDS::Edge ((Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape()), aWorkingPlane); // Adjust working plane
TopoDS_Edge anEdge = TopoDS::Edge ((Handle(AIS_Shape)::DownCast(aShapes.First()))->Shape());
TopoDS_Vertex aFirst, aSecond;
TopExp::Vertices (anEdge, aFirst, aSecond);
aWorkingPlane.SetLocation (BRep_Tool::Pnt(aFirst));
aDim = new AIS_LengthDimension (anEdge, aWorkingPlane);
} }
else if (aShapes.Extent() == 2) else if (aShapes.Extent() == 2)
{ {
if (aShapes.First()->Type() == AIS_KOI_Shape && aShapes.Last()->Type() == AIS_KOI_Shape) if (aShapes.First()->Type() == AIS_KOI_Shape && aShapes.Last()->Type() == AIS_KOI_Shape)
aDim = new AIS_LengthDimension ((Handle(AIS_Shape)::DownCast(aShapes.First ()))->Shape(), aDim = new AIS_LengthDimension ((Handle(AIS_Shape)::DownCast(aShapes.First ()))->Shape(),
(Handle(AIS_Shape)::DownCast(aShapes.Last ()))->Shape(), (Handle(AIS_Shape)::DownCast(aShapes.Last ()))->Shape(),
aWorkingPlane); aWorkingPlane);
else// AIS_Point else// AIS_Point
{ {
Handle(AIS_Point) aPoint1 = Handle(AIS_Point)::DownCast(aShapes.First ()); Handle(AIS_Point) aPoint1 = Handle(AIS_Point)::DownCast(aShapes.First ());
Handle(AIS_Point) aPoint2 = Handle(AIS_Point)::DownCast(aShapes.Last ()); Handle(AIS_Point) aPoint2 = Handle(AIS_Point)::DownCast(aShapes.Last ());
// Adjust working plane
aWorkingPlane.SetLocation (BRep_Tool::Pnt(aPoint1->Vertex()));
aDim = new AIS_LengthDimension (aPoint1->Component()->Pnt(), aDim = new AIS_LengthDimension (aPoint1->Component()->Pnt(),
aPoint2->Component()->Pnt(), aPoint2->Component()->Pnt(),
aWorkingPlane); aWorkingPlane);
} }
} }
else else
@ -417,7 +497,6 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
break; break;
} }
case AIS_KOD_PLANEANGLE: case AIS_KOD_PLANEANGLE:
{ {
if (aShapes.Extent() == 1 && aShapes.First()->Type()==AIS_KOI_Shape) if (aShapes.Extent() == 1 && aShapes.First()->Type()==AIS_KOI_Shape)
@ -431,8 +510,8 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
Handle(AIS_Shape) aShape1 = Handle(AIS_Shape)::DownCast(aShapes.First()); Handle(AIS_Shape) aShape1 = Handle(AIS_Shape)::DownCast(aShapes.First());
Handle(AIS_Shape) aShape2 = Handle(AIS_Shape)::DownCast(aShapes.Last()); Handle(AIS_Shape) aShape2 = Handle(AIS_Shape)::DownCast(aShapes.Last());
if (!aShape1.IsNull() && !aShape2.IsNull() if (!aShape1.IsNull() && !aShape2.IsNull()
&& aShape1->Shape().ShapeType() == TopAbs_EDGE && aShape1->Shape().ShapeType() == TopAbs_EDGE
&& aShape2->Shape().ShapeType() == TopAbs_EDGE) && aShape2->Shape().ShapeType() == TopAbs_EDGE)
aDim = new AIS_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape())); aDim = new AIS_AngleDimension (TopoDS::Edge(aShape1->Shape()),TopoDS::Edge(aShape2->Shape()));
else else
{ {
@ -467,14 +546,26 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
break; break;
} }
case AIS_KOD_RADIUS: // radius of the circle case AIS_KOD_RADIUS: // radius of the circle
{ {
if (aShapes.Extent() == 1) if (aShapes.Extent() == 1)
{ {
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First()); if (aShapes.First()->DynamicType() == STANDARD_TYPE(AIS_Circle))
gp_Circ aCircle = aShape->Circle()->Circ(); {
aDim = new AIS_RadiusDimension (aCircle); Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
aDim = new AIS_RadiusDimension (aCircle);
}
else
{
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (aShapes.First());
if (aShape.IsNull())
{
std::cerr << "Error: shape for radius is of wrong type.\n";
return 1;
}
aDim = new AIS_RadiusDimension (aShape->Shape());
}
} }
else else
{ {
@ -484,14 +575,26 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
break; break;
} }
case AIS_KOD_DIAMETER: case AIS_KOD_DIAMETER:
{ {
if (aShapes.Extent() == 1) if (aShapes.Extent() == 1)
{ {
Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First()); if (aShapes.First()->DynamicType() == STANDARD_TYPE(AIS_Circle))
gp_Circ aCircle = aShape->Circle()->Circ(); {
aDim = new AIS_DiameterDimension (aCircle); Handle(AIS_Circle) aShape = Handle(AIS_Circle)::DownCast (aShapes.First());
gp_Circ aCircle = aShape->Circle()->Circ();
aDim = new AIS_DiameterDimension (aCircle);
}
else
{
Handle(AIS_Shape) aShape = Handle(AIS_Shape)::DownCast (aShapes.First());
if (aShape.IsNull())
{
std::cerr << "Error: shape for radius is of wrong type.\n";
return 1;
}
aDim = new AIS_DiameterDimension (aShape->Shape());
}
} }
else else
{ {
@ -501,7 +604,6 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
break; break;
} }
default: default:
{ {
std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n"; std::cerr << theArgs[0] << ": wrong type of dimension. Type help for more information.\n";
@ -509,6 +611,14 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
} }
} }
// Check dimension geometry
if (!aDim->IsValid())
{
std::cerr << theArgs[0] << ":dimension geometry is invalid, " << aDimType.ToCString()
<< " dimension can't be build on input shapes.\n";
return 1;
}
aDim->SetDimensionAspect (anAspect); aDim->SetDimensionAspect (anAspect);
if (isCustomFlyout) if (isCustomFlyout)
@ -516,16 +626,7 @@ static int VDimBuilder(Draw_Interpretor& theDi, Standard_Integer theArgsNb, cons
aDim->SetFlyout (aCustomFlyout); aDim->SetFlyout (aCustomFlyout);
} }
if (GetMapOfAIS().IsBound2(aName)) VDisplayAISObject (aName,aDim);
{
theDi << theArgs[0] << ": shape with name " << aName.ToCString ()<< " already exists. It will be replaced\n";
Handle(AIS_InteractiveObject) anObj =
Handle(AIS_InteractiveObject)::DownCast(GetMapOfAIS().Find2(aName));
TheAISContext()->Remove(anObj, Standard_False);
GetMapOfAIS().UnBind2(aName);
}
GetMapOfAIS().Bind (aDim,aName);
return 0; return 0;
} }
@ -2330,8 +2431,7 @@ static int VSymmetricBuilder(Draw_Interpretor& di, Standard_Integer argc, const
//======================================================================= //=======================================================================
//function : VDimParam //function : VDimParam
//purpose : Moves dimension or relation text label to defined or picked //purpose : Sets aspect parameters to dimension.
// position and updates the object.
//======================================================================= //=======================================================================
static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const char** theArgVec) static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const char** theArgVec)
{ {
@ -2341,8 +2441,14 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
return 1; return 1;
} }
// Get dimension name
TCollection_AsciiString aName (theArgVec[1]); TCollection_AsciiString aName (theArgVec[1]);
gp_Pln aWorkingPlane;
Standard_Real aCustomFlyout = 0.0;
Standard_Boolean isCustomPlane = Standard_False;
Standard_Boolean isCustomFlyout = Standard_False;
Standard_Boolean toUpdate = Standard_True;
if (!GetMapOfAIS().IsBound2 (aName)) if (!GetMapOfAIS().IsBound2 (aName))
{ {
theDi << theArgVec[0] << "error: no object with this name.\n"; theDi << theArgVec[0] << "error: no object with this name.\n";
@ -2355,152 +2461,36 @@ static int VDimParam (Draw_Interpretor& theDi, Standard_Integer theArgNum, const
theDi << theArgVec[0] << "error: no dimension with this name.\n"; theDi << theArgVec[0] << "error: no dimension with this name.\n";
return 1; return 1;
} }
Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject); Handle(AIS_Dimension) aDim = Handle(AIS_Dimension)::DownCast (anObject);
Handle(Prs3d_DimensionAspect) anAspect = aDim->DimensionAspect(); Handle(Prs3d_DimensionAspect) anAspect = aDim->DimensionAspect();
// Parse parameters ParseDimensionParams (theArgNum, theArgVec, 2, anAspect,
gp_Pln aWorkingPlane; isCustomPlane, aWorkingPlane,
Standard_Real aCustomFlyout = 0.0; isCustomFlyout, aCustomFlyout);
for (Standard_Integer anIt = 2; anIt < theArgNum; ++anIt) if (isCustomPlane)
{ {
TCollection_AsciiString anArgString = theArgVec[anIt]; aDim->SetCustomPlane (aWorkingPlane);
TCollection_AsciiString aParamName; }
TCollection_AsciiString aParamValue;
if (ViewerTest::SplitParameter (anArgString, aParamName, aParamValue))
{
aParamName.LowerCase();
aParamValue.LowerCase();
if (aParamName == "text") if (isCustomFlyout)
{ {
anAspect->MakeText3d (aParamValue == "3d"); aDim->SetFlyout (aCustomFlyout);
} }
else if (aParamName == "name")
{
if (aParamValue.IsEmpty())
{
std::cerr << theArgVec[0] << ": no name for dimension.\n";
return 1;
}
aName = aParamValue; if (!aDim->IsValid())
} {
else if (aParamName == "plane") std::cerr << "Error: Dimension geometry or plane is not valid.\n";
{ return 1;
if (aParamValue == "xoy")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::XOY()));
}
else if (aParamValue == "zox")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::ZOX()));
}
else if (aParamValue == "yoz")
{
aWorkingPlane = gp_Pln (gp_Ax3 (gp::YOZ()));
}
else
{
std::cerr << theArgVec[0] << ": wrong plane.\n";
return 1;
}
}
else if (aParamName == "label")
{
NCollection_List<TCollection_AsciiString> aListOfLabelVals;
while (aParamValue.Length() > 0)
{
TCollection_AsciiString aValue = aParamValue;
Standard_Integer aSeparatorPos = aParamValue.Search (",");
if (aSeparatorPos >= 0)
{
aValue.Trunc (aSeparatorPos - 1);
aParamValue.Remove (aSeparatorPos, 1);
}
aListOfLabelVals.Append (aValue);
aParamValue.Remove (1, aValue.Length());
}
NCollection_List<TCollection_AsciiString>::Iterator aLabelValueIt (aListOfLabelVals);
for ( ; aLabelValueIt.More(); aLabelValueIt.Next())
{
aParamValue = aLabelValueIt.Value();
if (aParamValue == "left")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Left);
}
else if (aParamValue == "right")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Right);
}
else if (aParamValue == "hcenter")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Center);
}
else if (aParamValue == "hfit")
{
anAspect->SetTextHorizontalPosition (Prs3d_DTHP_Fit);
}
else if (aParamValue == "above")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Above);
}
else if (aParamValue == "below")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Below);
}
else if (aParamValue == "vcenter")
{
anAspect->SetTextVerticalPosition (Prs3d_DTVP_Center);
}
else
{
std::cerr << theArgVec[0] << ": invalid label position: \"" << aParamValue << "\".\n";
return 1;
}
}
}
else if (aParamName == "flyout")
{
if (!aParamValue.IsRealValue())
{
std::cerr << theArgVec[0] << ": numeric value expected for flyout.\n";
return 1;
}
aCustomFlyout = aParamValue.RealValue();
aDim->SetFlyout (aCustomFlyout);
}
else if (aParamName == "arrows")
{
if (aParamValue == "external")
{
anAspect->SetArrowOrientation (Prs3d_DAO_External);
}
else if (aParamValue == "internal")
{
anAspect->SetArrowOrientation (Prs3d_DAO_Internal);
}
else if (aParamValue == "fit")
{
anAspect->SetArrowOrientation (Prs3d_DAO_Fit);
}
}
else
{
std::cerr << theArgVec[0] << ": unknow parameter: \"" << aParamName << "\".\n";
return 1;
}
}
} }
// Redisplay a dimension after parameter changing. // Redisplay a dimension after parameter changing.
ViewerTest::GetAISContext()->Redisplay (aDim); if (ViewerTest::GetAISContext()->IsDisplayed (aDim))
{
ViewerTest::GetAISContext()->Redisplay (aDim, toUpdate);
}
return 0; return 0;
} }
@ -2681,18 +2671,24 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
const char *group = "AISRelations"; const char *group = "AISRelations";
theCommands.Add("vdimension", theCommands.Add("vdimension",
"vdimension {angle|length|radius|diameter} name={Dim_Name} shape1 [shape2 [shape3]]\n" "vdimension name {-angle|-length|-radius|-diameter} -shapes shape1 [shape2 [shape3]]\n"
" [text={2d|3d}] [plane={xoy|yoz|zox}]\n" "[-text 3d|2d,wf|sh|wireframe|shading,Size]\n"
" [label={left|right|hcenter|hfit},{above|below|vcenter}]\n" "[-label left|right|hcenter|hfit,top|bottom|vcenter|vfit]\n"
" [flyout=value] [arrows={external|internal|fit}]\n" "[-arrow external|internal|fit,Length(int)]\n"
"[-arrowangle ArrowAngle(degrees)]\n"
"[-plane xoy|yoz|zox]\n"
"[-flyout FloatValue -extension FloatValue]\n"
" -Builds angle, length, radius and diameter dimensions.\n", " -Builds angle, length, radius and diameter dimensions.\n",
__FILE__,VDimBuilder,group); __FILE__,VDimBuilder,group);
theCommands.Add("vdimparam", theCommands.Add("vdimparam",
"vdimparam Dim_Name" "vdimparam name"
" [text={2d|3d}] [plane={xoy|yoz|zox}]\n" "[-text 3d|2d,wf|sh|wireframe|shading,Size]\n"
" [label={left|right|hcenter|hfit},{above|below|vcenter}]\n" "[-label left|right|hcenter|hfit,top|bottom|vcenter|vfit]\n"
" [flyout=value] [arrows={external|internal|fit}]\n" "[-arrow external|internal|fit,Length(int)]\n"
"[-arrowangle ArrowAngle(degrees)]\n"
"[-plane xoy|yoz|zox]\n"
"[-flyout FloatValue -extension FloatValue]\n"
" -Sets parameters for angle, length, radius and diameter dimensions.\n", " -Sets parameters for angle, length, radius and diameter dimensions.\n",
__FILE__,VDimParam,group); __FILE__,VDimParam,group);
@ -2754,7 +2750,8 @@ void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
__FILE__,VSymmetricBuilder ,group); __FILE__,VSymmetricBuilder ,group);
theCommands.Add("vmovedim", theCommands.Add("vmovedim",
"vmovedim [name] : move Mouse in the viewer; click MB1 to stop motion...", "vmovedim [name] [x y z]: moves picked or named (if name defined) "
"dimension to picked mouse position or input point.",
__FILE__,VMoveDim,group); __FILE__,VMoveDim,group);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,18 +30,17 @@ vpoint arrow_p7 0 0 50
vpoint arrow_p8 10 0 50 vpoint arrow_p8 10 0 50
# test forced internal arrow orientation # 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 # 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 # 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 # 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 vfit
# ------------------------------------------------ # ------------------------------------------------
@ -63,7 +62,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension d_$idx 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 vdisplay $dimension
incr idx incr idx

View File

@ -22,30 +22,29 @@ vpoint circle1_p1 0 0 30
vpoint circle1_p2 30 0 0 vpoint circle1_p2 30 0 0
vpoint circle1_p3 60 0 30 vpoint circle1_p3 60 0 30
vcircle circle1 circle1_p1 circle1_p2 circle1_p3 0 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 # test forced external arrow orientation
vpoint circle2_p1 100 0 30 vpoint circle2_p1 100 0 30
vpoint circle2_p2 130 0 0 vpoint circle2_p2 130 0 0
vpoint circle2_p3 160 0 30 vpoint circle2_p3 160 0 30
vcircle circle2 circle2_p1 circle2_p2 circle2_p3 0 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 # test that auto-fit for arrow places them externally for small geometry
vpoint circle3_p1 0 0 102 vpoint circle3_p1 0 0 102
vpoint circle3_p2 22 0 80 vpoint circle3_p2 22 0 80
vpoint circle3_p3 44 0 102 vpoint circle3_p3 44 0 102
vcircle circle3 circle3_p1 circle3_p2 circle3_p3 0 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 # test that auto-fit for text places the label externally for small geometry
vpoint circle4_p1 100 0 92 vpoint circle4_p1 100 0 92
vpoint circle4_p2 112 0 80 vpoint circle4_p2 112 0 80
vpoint circle4_p3 124 0 92 vpoint circle4_p3 124 0 92
vcircle circle4 circle4_p1 circle4_p2 circle4_p3 0 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 vfit
# ------------------------------------------------ # ------------------------------------------------
@ -71,7 +70,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension d_$idx 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 vdisplay $dimension
incr idx incr idx

View File

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

View File

@ -21,25 +21,25 @@ set vpos "above vcenter below"
vpoint angle1_p1 0 0 40 vpoint angle1_p1 0 0 40
vpoint angle1_p2 0 0 0 vpoint angle1_p2 0 0 0
vpoint angle1_p3 40 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 # test forced external arrow orientation
vpoint angle2_p1 80 0 40 vpoint angle2_p1 80 0 40
vpoint angle2_p2 80 0 0 vpoint angle2_p2 80 0 0
vpoint angle2_p3 120 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 # test that auto-fit for arrow places them externally for small geometry
vpoint angle3_p1 0 0 100 vpoint angle3_p1 0 0 100
vpoint angle3_p2 0 0 80 vpoint angle3_p2 0 0 80
vpoint angle3_p3 20 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 # test that auto-fit for text places the label externally for small geometry
vpoint angle4_p1 85 0 100 vpoint angle4_p1 85 0 100
vpoint angle4_p2 85 0 85 vpoint angle4_p2 85 0 85
vpoint angle4_p3 100 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 vdisplay ang1 ang2 ang3 ang4
vfit vfit
@ -65,7 +65,7 @@ for {set r 0} {$r < 3} {incr r} {
set dimension r_$idx 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 vdisplay $dimension
incr idx incr idx

View File

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

View File

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

View File

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

View File

@ -0,0 +1,4 @@
source $env(CASROOT)/samples/tcl/dimensions.tcl
vdump $imagedir/${test_image}.png
puts "TEST COMPLETED"