mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
0029967: Draw Harness - command bounding has annoying syntax
Bnd_OBB constructor from Bnd_Box is fixed for VOID input. DRAW command bounding command is adjusted: - Support of old syntax 'bounding shape'is restored. - Exception on VOID bounding box is avoided. - Arguments are handled in case-insensitive way. - Options -s, -perfmeter, and ability to set result as first argument are removed as redundant. - Help is moved to command definition. Separate command OCC29311 is added (in QADraw) to do the same as option -perfmeter did; tests are updated.
This commit is contained in:
parent
3dc5809557
commit
1f26f80bb7
@ -41,7 +41,7 @@ tcopy bxx b10
|
||||
|
||||
# make some boxes hollow
|
||||
for {set i 1} {$i <= 1} {incr i} {
|
||||
set dim [bounding -s b$i -save xmin ymin zmin xmax ymax zmax]
|
||||
set dim [bounding b$i -save xmin ymin zmin xmax ymax zmax]
|
||||
set dx [dval xmax-xmin]
|
||||
set x1 [dval xmin+0.1*$dx]
|
||||
set x2 [dval ymin+0.1*$dx]
|
||||
|
@ -135,7 +135,7 @@ vfit
|
||||
|
||||
# add dimension:
|
||||
# detect vertices extremal in X direction
|
||||
bounding -s snowflake -save x1 y1 z1 x2 y2 z2
|
||||
bounding snowflake -save x1 y1 z1 x2 y2 z2
|
||||
plane f1 x1 0 0 1 0 0
|
||||
plane f2 x2 0 0 1 0 0
|
||||
mkface f1 f1
|
||||
|
@ -66,6 +66,12 @@ Standard_IMPORT Draw_Viewer dout;
|
||||
static void ConvertBndToShape(const Bnd_OBB& theBox,
|
||||
const char* const theName)
|
||||
{
|
||||
if (theBox.IsVoid())
|
||||
{
|
||||
DBRep::Set (theName, TopoDS_Shape());
|
||||
return;
|
||||
}
|
||||
|
||||
const gp_Pnt &aBaryCenter = theBox.Center();
|
||||
const gp_XYZ &aXDir = theBox.XDirection(),
|
||||
&aYDir = theBox.YDirection(),
|
||||
@ -455,6 +461,29 @@ static Standard_Integer getcoords(Draw_Interpretor& di,Standard_Integer n,const
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Parse 6 real values for defining AABB.
|
||||
static Standard_Boolean parseMinMax (const char** theArgVec, Bnd_Box& theBox)
|
||||
{
|
||||
const TCollection_AsciiString aMin[3] = { theArgVec[0], theArgVec[1], theArgVec[2] };
|
||||
const TCollection_AsciiString aMax[3] = { theArgVec[3], theArgVec[4], theArgVec[5] };
|
||||
if (!aMin[0].IsRealValue()
|
||||
|| !aMin[1].IsRealValue()
|
||||
|| !aMin[2].IsRealValue()
|
||||
|| !aMax[0].IsRealValue()
|
||||
|| !aMax[1].IsRealValue()
|
||||
|| !aMax[2].IsRealValue())
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
const gp_Pnt aPntMin (aMin[0].RealValue(), aMin[1].RealValue(), aMin[2].RealValue());
|
||||
const gp_Pnt aPntMax (aMax[0].RealValue(), aMax[1].RealValue(), aMax[2].RealValue());
|
||||
theBox.SetVoid();
|
||||
theBox.Add (aPntMin);
|
||||
theBox.Add (aPntMax);
|
||||
return Standard_True;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BoundBox
|
||||
//purpose :
|
||||
@ -463,200 +492,132 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
|
||||
Standard_Integer theNArg,
|
||||
const char** theArgVal)
|
||||
{
|
||||
if(theNArg < 2)
|
||||
{
|
||||
theDI << "Use: " << theArgVal[0] << " {-s shape | -c xmin ymin zmin xmax ymax zmax} "
|
||||
"[-obb]\n\t\t[-shape name] [-dump] [-notriangulation]\n\t\t"
|
||||
"[-perfmeter name NbIters] [-nodraw] [-optimal] [-exttoler]\n\t\t"
|
||||
"[-save xmin ymin zmin xmax ymax zmax]\n\n\n";
|
||||
|
||||
theDI << "Computes a bounding box (BndBox). Two types of the source data are supported:\n";
|
||||
theDI << " * \"-s\"-option sets the shape, which will be circumscribed by the BndBox;\n";
|
||||
theDI << " * \"-c\"-option sets two opposite corners (having (xmin, ymin, zmin) and\n\t"
|
||||
"(xmax, ymax, zmax) coordinates) of the resulting\n\taxis-aligned BndBox (AABB).\n";
|
||||
theDI << "\nThe following options are supported:\n";
|
||||
theDI << " * \"-obb\". If it is switched on then the oriented BndBox (OBB) will "
|
||||
"be\n\tcreated. Otherwise, AABB will be created.\n";
|
||||
theDI << " * \"-shape\". If it is switched on then the resulting BndBox will be "
|
||||
"stored\n\tas a shape (solid) with specified name.\n";
|
||||
theDI << " * \"-nodraw\". If it is switched on then the resulting BndBox will not be\n\t"
|
||||
"drawn as DRAW-object.\n";
|
||||
theDI << " * \"-dump\". Prints the information about the created BndBox.\n";
|
||||
theDI << " * \"-notriangulation\". By default, AABB is built from existing mesh.\n\t"
|
||||
"This option allows ignoring triangulation.\n";
|
||||
theDI << " * \"-save\". Stores the information about created AABB in "
|
||||
"specified variables.\n";
|
||||
theDI << " * \"-optimal\". If it is switched on then the AABB will be optimal.\n\t"
|
||||
"This option is useful for OBB, too. It allows constructing\n\toptimal "
|
||||
"initial AABB.\n";
|
||||
theDI << " * \"-exttoler\". If it is switched on then the resulting box will be "
|
||||
"extended\n\ton the tolerance of the source shape.\n";
|
||||
theDI << " * \"-perfmeter\" - Auxiliary option. It provides compatibility "
|
||||
"with\n\tOCCT-test system. \"name\" is the counter name for "
|
||||
"\"chrono\"-TCL-command.\n\tNbIters is the number of iterations.\n";
|
||||
return 1;
|
||||
}
|
||||
// 1. Parse arguments
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
Bnd_Box anAABB;
|
||||
|
||||
Standard_Boolean doPrint = Standard_False;
|
||||
Standard_Boolean useOldSyntax = Standard_False;
|
||||
Standard_Boolean isOBB = Standard_False;
|
||||
Standard_Boolean hasToPrint = Standard_False,
|
||||
isTriangulationReq = Standard_True,
|
||||
isOptimal = Standard_False,
|
||||
isTolerUsed = Standard_False,
|
||||
hasToDraw = Standard_True;
|
||||
Standard_Integer aNbIters = 1;
|
||||
Standard_Integer aStartIdxToSave = -1,
|
||||
aStartIdxToCreate = -1,
|
||||
aNameToShape = -1,
|
||||
anIdxCounterName = -1;
|
||||
|
||||
for(Standard_Integer anAIdx = 1; anAIdx < theNArg; anAIdx++)
|
||||
Standard_Boolean isTriangulationReq = Standard_True;
|
||||
Standard_Boolean isOptimal = Standard_False;
|
||||
Standard_Boolean isTolerUsed = Standard_False;
|
||||
Standard_Boolean hasToDraw = Standard_True;
|
||||
|
||||
TCollection_AsciiString anOutVars[6];
|
||||
TCollection_AsciiString aResShapeName;
|
||||
for (Standard_Integer anArgIter = 1; anArgIter < theNArg; ++anArgIter)
|
||||
{
|
||||
if(theArgVal[anAIdx][0] != '-')
|
||||
{
|
||||
theDI << "Error: Wrong option \"" << theArgVal[anAIdx] <<
|
||||
"\". Please use \'-\' symbol\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!strcmp(theArgVal[anAIdx], "-s"))
|
||||
{
|
||||
aShape = DBRep::Get(theArgVal[++anAIdx]);
|
||||
if(aShape.IsNull())
|
||||
{
|
||||
theDI << "Error: Argument " << theArgVal[anAIdx] << " is not a shape.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if(!strcmp(theArgVal[anAIdx], "-c"))
|
||||
{
|
||||
aStartIdxToCreate = anAIdx + 1;
|
||||
anAIdx += 6;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-obb", 4))
|
||||
TCollection_AsciiString anArgCase (theArgVal[anArgIter]);
|
||||
anArgCase.LowerCase();
|
||||
if (anArgCase == "-obb")
|
||||
{
|
||||
isOBB = Standard_True;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-shape", 4))
|
||||
else if (anArgCase == "-aabb")
|
||||
{
|
||||
aNameToShape = ++anAIdx;
|
||||
isOBB = Standard_False;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-dump", 4))
|
||||
else if (anArgCase == "-shape"
|
||||
&& anArgIter + 1 < theNArg
|
||||
&& aResShapeName.IsEmpty())
|
||||
{
|
||||
hasToPrint = Standard_True;
|
||||
aResShapeName = theArgVal[++anArgIter];
|
||||
hasToDraw = Standard_False;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-save", 4))
|
||||
else if (anArgCase == "-dump"
|
||||
|| anArgCase == "-print")
|
||||
{
|
||||
aStartIdxToSave = anAIdx+1;
|
||||
anAIdx += 6;
|
||||
doPrint = Standard_True;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-notriangulation", 9))
|
||||
else if (anArgCase == "-save"
|
||||
&& anArgIter + 6 < theNArg
|
||||
&& anOutVars[0].IsEmpty())
|
||||
{
|
||||
for (int aCompIter = 0; aCompIter < 6; ++aCompIter)
|
||||
{
|
||||
anOutVars[aCompIter] = theArgVal[anArgIter + aCompIter + 1];
|
||||
}
|
||||
anArgIter += 6;
|
||||
}
|
||||
else if (anArgCase == "-notriangulation")
|
||||
{
|
||||
isTriangulationReq = Standard_False;
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-perfmeter", 8))
|
||||
{
|
||||
anIdxCounterName = ++anAIdx;
|
||||
aNbIters = Draw::Atoi(theArgVal[++anAIdx]);
|
||||
}
|
||||
else if(!strncmp(theArgVal[anAIdx], "-optimal", 4))
|
||||
else if (anArgCase == "-optimal")
|
||||
{
|
||||
isOptimal = Standard_True;
|
||||
}
|
||||
else if(!strcmp(theArgVal[anAIdx], "-exttoler"))
|
||||
else if (anArgCase == "-exttoler")
|
||||
{
|
||||
isTolerUsed = Standard_True;
|
||||
}
|
||||
else if(!strcmp(theArgVal[anAIdx], "-nodraw"))
|
||||
else if (anArgCase == "-nodraw")
|
||||
{
|
||||
hasToDraw = Standard_False;
|
||||
}
|
||||
else if (aShape.IsNull()
|
||||
&& !DBRep::Get (theArgVal[anArgIter]).IsNull())
|
||||
{
|
||||
aShape = DBRep::Get (theArgVal[anArgIter]);
|
||||
}
|
||||
else if (anAABB.IsVoid()
|
||||
&& anArgIter + 5 < theNArg
|
||||
&& parseMinMax (theArgVal + anArgIter, anAABB))
|
||||
{
|
||||
anArgIter += 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Error: Unknown option \"" << theArgVal[anAIdx] << "\".\n";
|
||||
std::cout << "Syntax error at argument '" << theArgVal[anArgIter] << "'.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(aShape.IsNull() && (aStartIdxToCreate < 0))
|
||||
if (anAABB.IsVoid()
|
||||
&& aShape.IsNull())
|
||||
{
|
||||
theDI << "Error: One of the options \'-s\' or \'-c\' must be set necessarily.\n";
|
||||
std::cout << "Syntax error: input is not specified (neither shape nor coordinates)\n";
|
||||
return 1;
|
||||
}
|
||||
else if (!anAABB.IsVoid()
|
||||
&& (isOBB || isOptimal || isTolerUsed))
|
||||
{
|
||||
std::cout << "Syntax error: Options -obb, -optimal and -extToler cannot be used for explicitly defined AABB.\n";
|
||||
return 1;
|
||||
}
|
||||
else if (isOBB
|
||||
&& !anOutVars[0].IsEmpty())
|
||||
{
|
||||
std::cout << "Error: Option -save works only with axes-aligned boxes.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(aStartIdxToCreate > 0)
|
||||
// enable printing (old syntax) if neither saving to shape nor to DRAW variables is requested
|
||||
if (! doPrint && anOutVars[0].IsEmpty() && aResShapeName.IsEmpty())
|
||||
{
|
||||
if(!aShape.IsNull())
|
||||
{
|
||||
theDI << "Error: Options \'-s\' and \'-c\' are fail for using simultaneously.\n";
|
||||
return 1;
|
||||
}
|
||||
else if(isOBB)
|
||||
{
|
||||
theDI << "Error: Options \'-c\' and \"-obb\" are fail for using simultaneously.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(isOptimal)
|
||||
{
|
||||
if(aShape.IsNull())
|
||||
{
|
||||
theDI << "Error: Options \"-optimal\" is used without any shape. "
|
||||
"Use \'-s\'-option.\n";
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(isTolerUsed)
|
||||
{
|
||||
if(aShape.IsNull())
|
||||
{
|
||||
theDI << "Error: Option \"-exttoler\" is used without any shape. "
|
||||
"Use \'-s\'-option.\n";
|
||||
return 1;
|
||||
}
|
||||
doPrint = Standard_True;
|
||||
useOldSyntax = Standard_True;
|
||||
}
|
||||
|
||||
// 2. Compute box and save results
|
||||
Handle(Draw_Box) aDB;
|
||||
OSD_Timer aTimer;
|
||||
|
||||
if(isOBB)
|
||||
if (isOBB)
|
||||
{
|
||||
if(aStartIdxToSave > 0)
|
||||
{
|
||||
theDI << "Error: Option \"-save\" work only with axes-aligned boxes.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
Bnd_OBB anOBB;
|
||||
Standard_Integer aN = aNbIters;
|
||||
BRepBndLib::AddOBB(aShape, anOBB, isTriangulationReq, isOptimal, isTolerUsed);
|
||||
|
||||
aTimer.Start();
|
||||
while(aN-- > 0)
|
||||
{
|
||||
anOBB.SetVoid();
|
||||
BRepBndLib::AddOBB(aShape, anOBB, isTriangulationReq, isOptimal, isTolerUsed);
|
||||
}
|
||||
aTimer.Stop();
|
||||
|
||||
if(anOBB.IsVoid())
|
||||
if (anOBB.IsVoid())
|
||||
{
|
||||
theDI << "Void box.\n";
|
||||
hasToPrint = Standard_False;
|
||||
}
|
||||
|
||||
const gp_Pnt &aBaryCenter= anOBB.Center();
|
||||
const gp_XYZ &aXDir = anOBB.XDirection(),
|
||||
&aYDir = anOBB.YDirection(),
|
||||
&aZDir = anOBB.ZDirection();
|
||||
Standard_Real aHalfX = anOBB.XHSize(),
|
||||
aHalfY = anOBB.YHSize(),
|
||||
aHalfZ = anOBB.ZHSize();
|
||||
|
||||
if(hasToPrint)
|
||||
else if (doPrint)
|
||||
{
|
||||
const gp_Pnt &aBaryCenter= anOBB.Center();
|
||||
const gp_XYZ &aXDir = anOBB.XDirection(),
|
||||
&aYDir = anOBB.YDirection(),
|
||||
&aZDir = anOBB.ZDirection();
|
||||
theDI << "Oriented bounding box\n";
|
||||
theDI << "Center: " << aBaryCenter.X() << " " <<
|
||||
aBaryCenter.Y() << " " <<
|
||||
@ -664,116 +625,92 @@ static Standard_Integer BoundBox(Draw_Interpretor& theDI,
|
||||
theDI << "X-axis: " << aXDir.X() << " " << aXDir.Y() << " " << aXDir.Z() << "\n";
|
||||
theDI << "Y-axis: " << aYDir.X() << " " << aYDir.Y() << " " << aYDir.Z() << "\n";
|
||||
theDI << "Z-axis: " << aZDir.X() << " " << aZDir.Y() << " " << aZDir.Z() << "\n";
|
||||
theDI << "Half X: " << aHalfX << "\n" <<
|
||||
"Half Y: " << aHalfY << "\n" << "Half Z: " << aHalfZ << "\n";
|
||||
theDI << "Half X: " << anOBB.XHSize() << "\n"
|
||||
<< "Half Y: " << anOBB.YHSize() << "\n"
|
||||
<< "Half Z: " << anOBB.ZHSize() << "\n";
|
||||
}
|
||||
|
||||
if(hasToDraw)
|
||||
aDB = new Draw_Box(anOBB, Draw_orange);
|
||||
|
||||
if(aNameToShape > 0)
|
||||
if (hasToDraw
|
||||
&& !anOBB.IsVoid())
|
||||
{
|
||||
ConvertBndToShape(anOBB, theArgVal[aNameToShape]);
|
||||
aDB = new Draw_Box (anOBB, Draw_orange);
|
||||
}
|
||||
|
||||
if (!aResShapeName.IsEmpty())
|
||||
{
|
||||
ConvertBndToShape (anOBB, aResShapeName.ToCString());
|
||||
}
|
||||
}
|
||||
else // if(!isOBB)
|
||||
{
|
||||
Standard_Real aXmin = RealFirst(), aYmin = RealFirst(), aZmin = RealFirst(),
|
||||
aXMax = RealLast(), aYMax = RealLast(), aZMax = RealLast();
|
||||
|
||||
Bnd_Box anAABB;
|
||||
|
||||
if(aStartIdxToCreate < 0)
|
||||
if (!aShape.IsNull())
|
||||
{
|
||||
Standard_Integer aN = aNbIters;
|
||||
anAABB.SetVoid ();
|
||||
if(isOptimal)
|
||||
{
|
||||
aTimer.Start();
|
||||
while(aN-- > 0)
|
||||
{
|
||||
anAABB.SetVoid();
|
||||
BRepBndLib::AddOptimal(aShape, anAABB, isTriangulationReq, isTolerUsed);
|
||||
}
|
||||
aTimer.Stop();
|
||||
BRepBndLib::AddOptimal (aShape, anAABB, isTriangulationReq, isTolerUsed);
|
||||
}
|
||||
else
|
||||
{
|
||||
aTimer.Start();
|
||||
while(aN-- > 0)
|
||||
{
|
||||
anAABB.SetVoid();
|
||||
BRepBndLib::Add(aShape, anAABB, isTriangulationReq);
|
||||
}
|
||||
aTimer.Stop();
|
||||
BRepBndLib::Add (aShape, anAABB, isTriangulationReq);
|
||||
}
|
||||
}
|
||||
|
||||
if (anAABB.IsVoid())
|
||||
{
|
||||
theDI << "Void box.\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(anIdxCounterName > 0)
|
||||
const gp_Pnt aMin = anAABB.CornerMin();
|
||||
const gp_Pnt aMax = anAABB.CornerMax();
|
||||
|
||||
// print to DRAW
|
||||
if (doPrint)
|
||||
{
|
||||
theDI << "Error: Option \"-perfmeter\"does not work if the option \'-c\' "
|
||||
"is switched on.\n";
|
||||
return 1;
|
||||
if (useOldSyntax)
|
||||
{
|
||||
theDI << aMin.X () << " " << aMin.Y () << " " << aMin.Z () << " "
|
||||
<< aMax.X () << " " << aMax.Y () << " " << aMax.Z () << "\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
theDI << "Axes-aligned bounding box\n";
|
||||
theDI << "X-range: " << aMin.X () << " " << aMax.X () << "\n" <<
|
||||
"Y-range: " << aMin.Y() << " " << aMax.Y() << "\n" <<
|
||||
"Z-range: " << aMin.Z () << " " << aMax.Z () << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
Standard_Integer anIdx = aStartIdxToCreate;
|
||||
aXmin = Draw::Atof(theArgVal[anIdx++]);
|
||||
aYmin = Draw::Atof(theArgVal[anIdx++]);
|
||||
aZmin = Draw::Atof(theArgVal[anIdx++]);
|
||||
aXMax = Draw::Atof(theArgVal[anIdx++]);
|
||||
aYMax = Draw::Atof(theArgVal[anIdx++]);
|
||||
aZMax = Draw::Atof(theArgVal[anIdx++]);
|
||||
|
||||
anAABB.Add(gp_Pnt(aXmin, aYmin, aZmin));
|
||||
anAABB.Add(gp_Pnt(aXMax, aYMax, aZMax));
|
||||
}
|
||||
|
||||
if(anAABB.IsVoid())
|
||||
{
|
||||
theDI << "Void box.\n";
|
||||
hasToPrint = Standard_False;
|
||||
}
|
||||
|
||||
if(hasToPrint || (aStartIdxToSave>0))
|
||||
{
|
||||
anAABB.Get(aXmin, aYmin, aZmin, aXMax, aYMax, aZMax);
|
||||
|
||||
if(hasToPrint)
|
||||
// save DRAW variables
|
||||
if (!anOutVars[0].IsEmpty())
|
||||
{
|
||||
theDI << "Axes-aligned bounding box\n";
|
||||
theDI << "X-range: " << aXmin << " " << aXMax << "\n" <<
|
||||
"Y-range: " << aYmin << " " << aYMax << "\n" <<
|
||||
"Z-range: " << aZmin << " " << aZMax << "\n";
|
||||
Draw::Set (anOutVars[0].ToCString(), aMin.X());
|
||||
Draw::Set (anOutVars[1].ToCString(), aMin.Y());
|
||||
Draw::Set (anOutVars[2].ToCString(), aMin.Z());
|
||||
Draw::Set (anOutVars[3].ToCString(), aMax.X());
|
||||
Draw::Set (anOutVars[4].ToCString(), aMax.Y());
|
||||
Draw::Set (anOutVars[5].ToCString(), aMax.Z());
|
||||
}
|
||||
|
||||
if(aStartIdxToSave > 0)
|
||||
// add presentation to DRAW viewer
|
||||
if (hasToDraw)
|
||||
{
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aXmin);
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aYmin);
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aZmin);
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aXMax);
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aYMax);
|
||||
Draw::Set(theArgVal[aStartIdxToSave++], aZMax);
|
||||
aDB = new Draw_Box (anAABB, Draw_orange);
|
||||
}
|
||||
}
|
||||
|
||||
if(hasToDraw)
|
||||
aDB = new Draw_Box(anAABB, Draw_orange);
|
||||
|
||||
if(aNameToShape > 0)
|
||||
// save as shape
|
||||
if (!aResShapeName.IsEmpty())
|
||||
{
|
||||
ConvertBndToShape(anAABB, theArgVal[aNameToShape]);
|
||||
ConvertBndToShape (anAABB, aResShapeName.ToCString());
|
||||
}
|
||||
}
|
||||
|
||||
if(hasToDraw)
|
||||
dout << aDB;
|
||||
|
||||
if(anIdxCounterName > 0)
|
||||
if (!aDB.IsNull())
|
||||
{
|
||||
theDI << "COUNTER " << theArgVal[anIdxCounterName] << ": " << aTimer.ElapsedTime() << "\n";
|
||||
dout << aDB;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1514,7 +1451,30 @@ void BRepTest::BasicCommands(Draw_Interpretor& theCommands)
|
||||
__FILE__,
|
||||
getcoords,g);
|
||||
|
||||
theCommands.Add("bounding", "enter the comand w/o any arguments to obtain the help.",
|
||||
theCommands.Add ("bounding",
|
||||
"bounding {shape | xmin ymin zmin xmax ymax zmax}"
|
||||
"\n\t\t: [-obb] [-noTriangulation] [-optimal] [-extToler]"
|
||||
"\n\t\t: [-dump] [-shape name] [-nodraw]"
|
||||
"\n\t\t: [-save xmin ymin zmin xmax ymax zmax]"
|
||||
"\n\t\t:"
|
||||
"\n\t\t: Computes a bounding box. Two types of the source data are supported:"
|
||||
"\n\t\t: a shape or AABB corners (xmin, ymin, zmin, xmax, ymax, zmax)."
|
||||
"\n\t\t:"
|
||||
"\n\t\t: Calculation options (applicable only if input is a shape):"
|
||||
"\n\t\t: -obb Compute Oriented Bounding Box (OBB) instead of AABB."
|
||||
"\n\t\t: -noTriangulation Force use of exact geometry for calculation"
|
||||
"\n\t\t: even if triangulation is present."
|
||||
"\n\t\t: -optimal Force calculation of optimal (more tight) AABB."
|
||||
"\n\t\t: In case of OBB, applies to initial AABB used in OBB calculation."
|
||||
"\n\t\t: -extToler Include tolerance of the shape in the resulting box."
|
||||
"\n\t\t:"
|
||||
"\n\t\t: Output options:"
|
||||
"\n\t\t: -dump Prints the information about computed Bounding Box."
|
||||
"\n\t\t: It is enabled by default (with plain old syntax for AABB)"
|
||||
"\n\t\t: if neither -shape nor -save is specified."
|
||||
"\n\t\t: -shape Stores computed box as solid in DRAW variable with specified name."
|
||||
"\n\t\t: -save Stores min and max coordinates of AABB in specified variables."
|
||||
"\n\t\t: -noDraw Avoid drawing resulting Bounding Box in DRAW viewer.",
|
||||
__FILE__, BoundBox, g);
|
||||
|
||||
//
|
||||
|
@ -73,6 +73,13 @@ public:
|
||||
//! Constructor to create OBB from AABB.
|
||||
Bnd_OBB(const Bnd_Box& theBox) : myIsAABox(Standard_True)
|
||||
{
|
||||
if (theBox.IsVoid())
|
||||
{
|
||||
myHDims[0] = myHDims[1] = myHDims[2] = -1.0;
|
||||
myIsAABox = Standard_False;
|
||||
return;
|
||||
}
|
||||
|
||||
Standard_Real aX1, aY1, aZ1, aX2, aY2, aZ2;
|
||||
theBox.Get(aX1, aY1, aZ1, aX2, aY2, aZ2);
|
||||
|
||||
|
@ -64,6 +64,10 @@
|
||||
|
||||
#include <Standard_Failure.hxx>
|
||||
|
||||
#include <Bnd_OBB.hxx>
|
||||
#include <BRepBndLib.hxx>
|
||||
#include <OSD_Timer.hxx>
|
||||
|
||||
#include <limits>
|
||||
|
||||
//=======================================================================
|
||||
@ -2990,6 +2994,36 @@ static Standard_Integer OCC29925 (Draw_Interpretor& theDI, Standard_Integer, con
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : OCC29311
|
||||
//purpose : check performance of OBB calculations
|
||||
//=======================================================================
|
||||
static Standard_Integer OCC29311 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
|
||||
{
|
||||
if (theArgc < 4)
|
||||
{
|
||||
std::cerr << "Use: " << theArgv[0] << " shape counter_name nb_iterations" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
TopoDS_Shape aShape = DBRep::Get (theArgv[1]);
|
||||
Standard_Integer aNbIter = Draw::Atoi (theArgv[3]);
|
||||
|
||||
Bnd_OBB anOBB;
|
||||
OSD_Timer aTimer;
|
||||
aTimer.Start ();
|
||||
for (Standard_Integer aN = aNbIter; aN > 0; --aN)
|
||||
{
|
||||
anOBB.SetVoid ();
|
||||
BRepBndLib::AddOBB (aShape, anOBB, Standard_False, Standard_False, Standard_False);
|
||||
}
|
||||
aTimer.Stop ();
|
||||
|
||||
theDI << "COUNTER " << theArgv[2] << ": " << aTimer.ElapsedTime() << "\n";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
const char *group = "QABugs";
|
||||
|
||||
@ -3028,6 +3062,7 @@ void QABugs::Commands_20(Draw_Interpretor& theCommands) {
|
||||
theCommands.Add ("OCC29064", "OCC29064: test memory usage by copying empty maps", __FILE__, OCC29064, group);
|
||||
theCommands.Add ("OCC29925", "OCC29925: check safety of character classification functions", __FILE__, OCC29925, group);
|
||||
theCommands.Add("OCC29807", "OCC29807 surface1 surface2 u1 v1 u2 v2", __FILE__, OCC29807, group);
|
||||
theCommands.Add("OCC29311", "OCC29311 shape counter nbiter: check performance of OBB calculation", __FILE__, OCC29311, group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ puts ""
|
||||
restore [locate_data_file BUC60849.brep] result
|
||||
checkshape result
|
||||
|
||||
bounding -s result -save xmin ymin zmin xmax ymax zmax -dump
|
||||
bounding result -save xmin ymin zmin xmax ymax zmax -dump
|
||||
|
||||
smallview
|
||||
fit
|
||||
|
@ -10,7 +10,7 @@ puts ""
|
||||
restore [locate_data_file bug61037.brep] sh1
|
||||
checkshape sh1
|
||||
|
||||
bounding -s sh1 -dump -shape result
|
||||
bounding sh1 -dump -shape result
|
||||
checkprops result -v 5.78576e-005 -s 0.042162
|
||||
|
||||
smallview
|
||||
|
@ -9,7 +9,7 @@ puts ""
|
||||
set BugNumber OCC12661
|
||||
|
||||
restore [locate_data_file OCC12661.brep] result
|
||||
bounding -s result -save x1 y1 z1 x2 y2 z2
|
||||
bounding result -save x1 y1 z1 x2 y2 z2
|
||||
|
||||
checkreal "x1" [dval x1] -6.3659273065258741 0 0.001
|
||||
checkreal "y1" [dval y1] 0.7051405053395956 0 0.001
|
||||
|
@ -16,7 +16,7 @@ offsetshape t b 10 b_1
|
||||
|
||||
checkshape t
|
||||
|
||||
bounding -s t -save xt1 yy zz xt2 yy zz -dump
|
||||
bounding t -save xt1 yy zz xt2 yy zz -dump
|
||||
set ori [lindex [dtyp t] 2]
|
||||
puts "Orientation of thick solid is $ori"
|
||||
|
||||
@ -28,7 +28,7 @@ if { [regexp {Faulty} $che] } {
|
||||
puts "Faulty ${BugNumber} : checkshape is wrong for h"
|
||||
}
|
||||
|
||||
bounding -s h -save xh1 yy zz xh2 yy zz -dump
|
||||
bounding h -save xh1 yy zz xh2 yy zz -dump
|
||||
|
||||
renamevar h result
|
||||
|
||||
|
@ -9,7 +9,7 @@ puts ""
|
||||
restore [locate_data_file bug27537.brep] result
|
||||
incmesh result 0.2
|
||||
|
||||
bounding -s result -save xMin yMin zMin xMax yMax zMax -dump
|
||||
bounding result -save xMin yMin zMin xMax yMax zMax -dump
|
||||
|
||||
mkcurve c result
|
||||
bounds c u1 u2
|
||||
|
@ -12,7 +12,7 @@ set step [expr 360.0/($NbIters-1) ]
|
||||
restore [locate_data_file bug29237_no_overlap.lhs.brep] a
|
||||
|
||||
# Create AABB for a and put it into "r1" variable
|
||||
# Draw[]> bounding -s a -shape r1
|
||||
# Draw[]> bounding a -shape r1
|
||||
# The volume of one AABB is
|
||||
# Draw[]> vprops r1 1.0e-12 -full
|
||||
# 32736000.276308119
|
||||
@ -22,7 +22,7 @@ set VMax 0
|
||||
set MaxIteration 0
|
||||
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -shape rr$i
|
||||
bounding a -obb -shape rr$i
|
||||
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal
|
||||
|
||||
|
@ -10,5 +10,5 @@ line ll -5 3 8 -1 0 0
|
||||
trim ll ll -100 100
|
||||
mkedge result ll
|
||||
|
||||
bounding -s result -obb
|
||||
bounding result -obb
|
||||
|
||||
|
@ -12,7 +12,7 @@ compound result
|
||||
|
||||
# construct obb for each edge of the shape
|
||||
foreach e [explode part e] {
|
||||
if [catch {bounding -s $e -obb}] {
|
||||
if [catch {bounding $e -obb}] {
|
||||
puts "Error with $e (exception)"
|
||||
add $e result
|
||||
} else {
|
||||
|
@ -12,7 +12,7 @@ compound result
|
||||
|
||||
# construct obb for each face of the shape
|
||||
foreach f [explode part f] {
|
||||
if [catch {bounding -s $f -obb}] {
|
||||
if [catch {bounding $f -obb}] {
|
||||
puts "Error with $f (exception)"
|
||||
add $f result
|
||||
} else {
|
||||
|
@ -11,7 +11,7 @@ set py 2
|
||||
set pz 3
|
||||
|
||||
vertex vv $px $py $pz
|
||||
set log [bounding -s vv -obb -dump]
|
||||
set log [bounding vv -obb -dump]
|
||||
|
||||
if {![regexp {Center: +([-0-9.+eE]+) +([-0-9.+eE]+) +([-0-9.+eE]+)} $log full xc yc zc]} {
|
||||
puts "Error in Dump."
|
||||
|
@ -22,7 +22,7 @@ set MaxIteration 0
|
||||
set MinIteration 0
|
||||
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -shape rr$i
|
||||
bounding a -obb -shape rr$i
|
||||
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal
|
||||
|
||||
@ -46,6 +46,6 @@ checkreal {Transformed BndBoxes} $VMax $VMin 0.0 0.001
|
||||
puts "The box with maximal volume is achieved in $MaxIteration iteration. See \"amax\" shape."
|
||||
puts "The box with minimal volume is achieved in $MinIteration iteration. See \"amin\" shape."
|
||||
|
||||
bounding -s amax -obb -dump
|
||||
bounding -s amin -obb -dump
|
||||
bounding amax -obb -dump
|
||||
bounding amin -obb -dump
|
||||
|
||||
|
@ -22,7 +22,7 @@ set MaxIteration 0
|
||||
set MinIteration 0
|
||||
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -shape rr$i
|
||||
bounding a -obb -shape rr$i
|
||||
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal
|
||||
|
||||
@ -46,6 +46,6 @@ checkreal {Transformed BndBoxes} $VMax $VMin 0.0 0.3
|
||||
puts "The box with maximal volume is achieved in $MaxIteration iteration. See \"amax\" shape."
|
||||
puts "The box with minimal volume is achieved in $MinIteration iteration. See \"amin\" shape."
|
||||
|
||||
bounding -s amax -obb -dump
|
||||
bounding -s amin -obb -dump
|
||||
bounding amax -obb -dump
|
||||
bounding amin -obb -dump
|
||||
|
||||
|
@ -12,7 +12,7 @@ set step [expr 360.0/($NbIters-1) ]
|
||||
restore [locate_data_file bug29237_no_overlap.rhs.brep] a
|
||||
|
||||
# Create AABB for a and put it into "r1" variable
|
||||
# Draw[]> bounding -s a -shape r1
|
||||
# Draw[]> bounding a -shape r1
|
||||
# The volume of one AABB is
|
||||
# Draw[]> vprops r1 1.0e-12 -full
|
||||
# 32736000.184203226
|
||||
@ -22,7 +22,7 @@ set VMax 0
|
||||
set MaxIteration 0
|
||||
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -shape rr$i
|
||||
bounding a -obb -shape rr$i
|
||||
|
||||
regexp {Mass +: +([-0-9.+eE]+)} [vprops rr$i 1.0e-12 -full] full Vreal
|
||||
|
||||
|
@ -6,5 +6,5 @@ puts ""
|
||||
# Implementation of the Oriented Bounding Boxes (OBB) functionality
|
||||
#################################################
|
||||
|
||||
bounding -c 50 100 30 180 200 100 -shape result
|
||||
bounding 50 100 30 180 200 100 -shape result
|
||||
checkprops result -v 910000
|
||||
|
@ -10,7 +10,7 @@ ptorus result 20 5
|
||||
trotate result 5 10 15 1 1 1 28
|
||||
|
||||
puts "AABB"
|
||||
bounding -s result -shape ra -dump -save x1 y1 z1 x2 y2 z2
|
||||
bounding result -shape ra -dump -save x1 y1 z1 x2 y2 z2
|
||||
|
||||
dump x1 y1 z1 x2 y2 z2
|
||||
|
||||
@ -19,7 +19,7 @@ set VaExp [ dval (x2-x1)*(y2-y1)*(z2-z1) ]
|
||||
checkprops ra -v $VaExp
|
||||
|
||||
puts "OBB"
|
||||
bounding -s result -shape ro -dump -obb
|
||||
bounding result -shape ro -dump -obb
|
||||
|
||||
checkprops ro -v 28694.7
|
||||
|
||||
|
@ -13,7 +13,7 @@ pload XDE
|
||||
igesbrep [locate_data_file OCC15570.igs] a *
|
||||
tpcompound result
|
||||
|
||||
bounding -s result -save xmin ymin zmin xmax ymax zmax -nodraw
|
||||
bounding result -save xmin ymin zmin xmax ymax zmax -nodraw
|
||||
|
||||
checkreal "xmin" [dval xmin] -22.500000100000001 0 0.001
|
||||
checkreal "ymin" [dval ymin] -88.366946209482094 0 0.001
|
||||
|
@ -18,14 +18,14 @@ set exception_status 0
|
||||
restore [locate_data_file OCC23165-edge1.brep] e1
|
||||
|
||||
donly e1
|
||||
catch { bounding -s e1 } msg
|
||||
catch { bounding e1 } msg
|
||||
fit
|
||||
|
||||
set index [lsearch $msg exception]
|
||||
if {$index > -1} {
|
||||
set exception_status 1
|
||||
} else {
|
||||
bounding -s e1 -save e1_x1 e1_y1 e1_z1 e1_x2 e1_y2 e1_z2
|
||||
bounding e1 -save e1_x1 e1_y1 e1_z1 e1_x2 e1_y2 e1_z2
|
||||
|
||||
set e1_good_x1 -17.610622244944413
|
||||
set e1_good_y1 -0.010622244944394899
|
||||
@ -47,7 +47,7 @@ restore [locate_data_file OCC23165-curve.rle] c
|
||||
mkedge result c 20 36
|
||||
|
||||
donly result
|
||||
set res [bounding -s result -save x1 y1 z1 x2 y2 z2 ]
|
||||
set res [bounding result -save x1 y1 z1 x2 y2 z2 ]
|
||||
fit
|
||||
|
||||
set good_x1 -17.6105835090592
|
||||
|
@ -25,7 +25,7 @@ set tol_rel 1.e-7
|
||||
checkreal "Distance 1 " ${dist1} ${good_dist} ${tol_abs} ${tol_rel}
|
||||
checkreal "Distance 2 " ${dist2} ${good_dist} ${tol_abs} ${tol_rel}
|
||||
|
||||
bounding -s a -save x0 y0 z0 x1 y1 z1 -nodraw
|
||||
bounding a -save x0 y0 z0 x1 y1 z1 -nodraw
|
||||
ttranslate a -x0 -y0 -z0
|
||||
ttranslate b -x0 -y0 -z0
|
||||
|
||||
|
@ -10,7 +10,7 @@ puts ""
|
||||
restore [locate_data_file OCC257.brep] result
|
||||
checkshape result
|
||||
|
||||
bounding -s result -save x1 y1 z1 x2 y2 z2
|
||||
bounding result -save x1 y1 z1 x2 y2 z2
|
||||
|
||||
set len [ dval x2-x1]
|
||||
set width [ dval y2-y1]
|
||||
|
@ -10,7 +10,7 @@ puts ""
|
||||
|
||||
restore [locate_data_file OCC566.brep] a
|
||||
|
||||
bounding -s a -save v1_x v1_y v1_z v2_x v2_y v2_z -dump -shape result
|
||||
bounding a -save v1_x v1_y v1_z v2_x v2_y v2_z -dump -shape result
|
||||
set err2 [OCC566 a]
|
||||
|
||||
regexp { *([-0-9.+eE]+) *([-0-9.+eE]+) *([-0-9.+eE]+) *([-0-9.+eE]+) *([-0-9.+eE]+) *([-0-9.+eE]+)} $err2 full v3_x v3_y v3_z v4_x v4_y v4_z
|
||||
|
@ -10,7 +10,7 @@ set BugNumber OCC6503
|
||||
|
||||
plane pl 0 0 0 0 0 1
|
||||
mkface f pl
|
||||
set info_result [bounding -s f -save x1 y1 z1 x2 y2 z2]
|
||||
set info_result [bounding f -save x1 y1 z1 x2 y2 z2]
|
||||
|
||||
set good_x1 -1e+100
|
||||
set good_y1 -1e+100
|
||||
|
@ -8,7 +8,7 @@ puts ""
|
||||
|
||||
bsplinecurve c 3 2 0 4 1 4 0 0 0 1 0 1 0 1 1 1 0 1 1 0 0 1
|
||||
mkedge e c
|
||||
bounding -s e -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
bounding e -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
|
||||
checkreal "Xmin" [dval Xmin] 0. 0.1 0.
|
||||
checkreal "Ymin" [dval Ymin] 0. 0.1 0.
|
||||
|
@ -8,7 +8,7 @@ puts ""
|
||||
|
||||
restore [locate_data_file bug25631_fbx.brep] result
|
||||
|
||||
bounding -s result -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
bounding result -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
|
||||
set tol_abs 1.0e-4
|
||||
set tol_rel 1.0e-4
|
||||
|
@ -8,7 +8,7 @@ puts ""
|
||||
|
||||
restore [locate_data_file bug26560_planarspline.brep] result
|
||||
|
||||
bounding -s result -save Xmin Ymin Zmin Xmax Ymax Zmax -shape resbox
|
||||
bounding result -save Xmin Ymin Zmin Xmax Ymax Zmax -shape resbox
|
||||
|
||||
set tol_abs 1.0e-4
|
||||
set tol_rel 0.0001
|
||||
|
@ -7,7 +7,7 @@ puts ""
|
||||
##############################################################
|
||||
|
||||
restore [locate_data_file bug27261_f1.brep] result
|
||||
bounding -s result -dump
|
||||
bounding result -dump
|
||||
|
||||
# Visual check.
|
||||
smallview
|
||||
|
@ -7,7 +7,7 @@ puts ""
|
||||
##############################################################
|
||||
|
||||
restore [locate_data_file bug27261_f2.brep] result
|
||||
bounding -s result -dump
|
||||
bounding result -dump
|
||||
|
||||
# Visual check.
|
||||
smallview
|
||||
|
@ -11,7 +11,7 @@ explode a_1 f
|
||||
|
||||
checknbshapes a_1_3 -wire 1
|
||||
|
||||
bounding -s a_1_3 -dump -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
bounding a_1_3 -dump -save Xmin Ymin Zmin Xmax Ymax Zmax
|
||||
|
||||
checkreal "Xmin" [dval Xmin] -7.1677412321949925 0.1 0.
|
||||
checkreal "Ymin" [dval Ymin] -8.0000000999999994 0.1 0.
|
||||
|
@ -19,7 +19,7 @@ writestl comp $imagedir/${casename}.stl 1
|
||||
readstl result $imagedir/${casename}.stl -brep
|
||||
|
||||
# check that bounding box is
|
||||
bounding -s result -save Xmin Ymin Zmin Xmax Ymax Zmax -nodraw
|
||||
bounding result -save Xmin Ymin Zmin Xmax Ymax Zmax -nodraw
|
||||
|
||||
checkreal "Xmin" [dval Xmin] 0.0 1e-5 0.
|
||||
checkreal "Ymin" [dval Ymin] 0.0 1e-5 0.
|
||||
|
@ -15,9 +15,9 @@ set area_RED [lindex ${Property_RED} 2]
|
||||
set Property_GREEN [sprops BUC60857_GREEN]
|
||||
set area_GREEN [lindex ${Property_GREEN} 2]
|
||||
|
||||
bounding -s BUC60857_BLUE -save xmin_BLUE ymin_BLUE zmin_BLUE xmax_BLUE ymax_BLUE zmax_BLUE -nodraw
|
||||
bounding -s BUC60857_RED -save xmin_RED ymin_RED zmin_RED xmax_RED ymax_RED zmax_RED -nodraw
|
||||
bounding -s BUC60857_GREEN -save xmin_GREEN ymin_GREEN zmin_GREEN xmax_GREEN ymax_GREEN zmax_GREEN -nodraw
|
||||
bounding BUC60857_BLUE -save xmin_BLUE ymin_BLUE zmin_BLUE xmax_BLUE ymax_BLUE zmax_BLUE -nodraw
|
||||
bounding BUC60857_RED -save xmin_RED ymin_RED zmin_RED xmax_RED ymax_RED zmax_RED -nodraw
|
||||
bounding BUC60857_GREEN -save xmin_GREEN ymin_GREEN zmin_GREEN xmax_GREEN ymax_GREEN zmax_GREEN -nodraw
|
||||
|
||||
set delta_area_GB [expr abs(${area_GREEN} - ${area_BLUE}) / ${area_BLUE} * 100]
|
||||
set delta_area_BR [expr ${area_BLUE} / ${area_RED}]
|
||||
|
@ -12,7 +12,7 @@ box b1 -100 -50 -2 200 100 1
|
||||
|
||||
# text label
|
||||
text2brep t "texT | Text\ntexT | Text" -height 50
|
||||
bounding -s t -save xx yy zz aTX aTY zz
|
||||
bounding t -save xx yy zz aTX aTY zz
|
||||
ttranslate t -0.5*aTX -0.5*aTY 1
|
||||
|
||||
# sphere
|
||||
|
@ -23,8 +23,8 @@ if [catch { igesbrep . a 6425 } res] {
|
||||
|
||||
renamevar a_1 a2
|
||||
|
||||
set size1 [ bounding -s a1 -save x1_a1 yy zz x2_a1 yy zz ]
|
||||
set size2 [ bounding -s a2 -save x1_a2 yy zz x2_a2 yy zz ]
|
||||
set size1 [ bounding a1 -save x1_a1 yy zz x2_a1 yy zz ]
|
||||
set size2 [ bounding a2 -save x1_a2 yy zz x2_a2 yy zz ]
|
||||
|
||||
set dim2 [ dval x2_a2-x1_a2 ]
|
||||
set dim1 [ dval x2_a1-x1_a1 ]
|
||||
|
@ -18,7 +18,7 @@ set aSetDY1 200
|
||||
set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
set aLabel 0:2
|
||||
SetShape D ${aLabel} aBox1
|
||||
@ -40,7 +40,7 @@ Undo D
|
||||
# Get a value of the attribute
|
||||
GetShape D ${aLabel} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -18,7 +18,7 @@ set aSetDY1 200
|
||||
set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
set aLabel 0:2
|
||||
SetShape D ${aLabel} aBox1
|
||||
@ -46,7 +46,7 @@ Undo D
|
||||
# Get a value of the attribute
|
||||
GetShape D ${aLabel} aBox4
|
||||
|
||||
bounding -s aBox4 -save X1_Box4 Y1_Box4 Z1_Box4 X2_Box4 Y2_Box4 Z2_Box4
|
||||
bounding aBox4 -save X1_Box4 Y1_Box4 Z1_Box4 X2_Box4 Y2_Box4 Z2_Box4
|
||||
if { [dval X1_Box1] != [dval X1_Box4] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box4] ||
|
||||
[dval Z1_Box1] != [dval Z1_Box4] ||
|
||||
|
@ -19,7 +19,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
set aLabel 0:2
|
||||
SetShape D ${aLabel} aBox1
|
||||
@ -49,7 +49,7 @@ if { ${IsDone} != 0 } {
|
||||
return
|
||||
}
|
||||
|
||||
bounding -s aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
bounding aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box5] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box5] ||
|
||||
|
@ -31,7 +31,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
set aLabel 0:2
|
||||
SetShape Doc ${aLabel} aBox1
|
||||
@ -61,7 +61,7 @@ if { ${IsDone} != 0 } {
|
||||
puts "OCC1228: ERROR (case 2)"
|
||||
}
|
||||
|
||||
bounding -s aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
bounding aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box5] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box5] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Create a label
|
||||
set aLabel 0:2
|
||||
@ -67,7 +67,7 @@ if { ${IsDone} != 0 } {
|
||||
puts "OCC1228: ERROR (case 2)"
|
||||
}
|
||||
|
||||
bounding -s aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
bounding aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box3] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box3] ||
|
||||
|
@ -35,7 +35,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -75,7 +75,7 @@ if { ${IsDone} != 0 } {
|
||||
puts "OCC1228: ERROR (case 2)"
|
||||
}
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -173,7 +173,7 @@ if !$Create_Doc {
|
||||
# NamedShape
|
||||
eval box Box $test_boxXYZ $test_boxDX $test_boxDY $test_boxDZ
|
||||
if [catch {GetShape D 0:1:6 b}] {puts "Error: NamedShape not found"
|
||||
} elseif {[bounding -s b -dump] != [bounding -s Box -dump]} {puts "Error: invalid NamedShape"
|
||||
} elseif {[bounding b -dump] != [bounding Box -dump]} {puts "Error: invalid NamedShape"
|
||||
} else {
|
||||
checkshape b
|
||||
checkprops b -l [expr $test_boxDX * 8 + $test_boxDY * 8 + $test_boxDZ * 8]
|
||||
|
@ -18,7 +18,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Create a label
|
||||
set aLabel 0:2
|
||||
@ -45,7 +45,7 @@ Redo D
|
||||
# Get a shape from the label
|
||||
GetShape D ${aLabel} aBox3
|
||||
|
||||
bounding -s aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
bounding aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box3] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box3] ||
|
||||
|
@ -18,7 +18,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Create a label
|
||||
set aLabel 0:2
|
||||
@ -45,7 +45,7 @@ Redo D
|
||||
# Get a shape from the label
|
||||
GetShape D ${aLabel} aBox3
|
||||
|
||||
bounding -s aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
bounding aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box3] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box3] ||
|
||||
|
@ -18,7 +18,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Create a label
|
||||
set aLabel 0:2
|
||||
@ -55,7 +55,7 @@ if { ${IsDone} != 0 } {
|
||||
return
|
||||
}
|
||||
|
||||
bounding -s aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
bounding aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box3] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box3] ||
|
||||
|
@ -47,7 +47,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
puts "SubShape=$S"
|
||||
|
||||
#Memorize a bounding box of the selected sub-shape
|
||||
bounding -s ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Select a sub-shape
|
||||
set LABEL [Label D 0:$iSubLabel]
|
||||
@ -60,7 +60,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
GetShape D ${LABEL} aSubShape
|
||||
|
||||
# Get bounding box
|
||||
bounding -s aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if {[dval X1_Box1] != [dval X1_Box2] || [dval Y1_Box1] != [dval Y1_Box2] || [dval Z1_Box1] != [dval Z1_Box2] || [dval X2_Box1] != [dval X2_Box2] || [dval Y2_Box1] != [dval Y2_Box2] || [dval Z2_Box1] != [dval Z2_Box2]} {
|
||||
puts "SelectGeometry command (${i}): Error"
|
||||
|
@ -47,7 +47,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
puts "SubShape=$S"
|
||||
|
||||
#Memorize a bounding box of the selected sub-shape
|
||||
bounding -s ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Select a sub-shape
|
||||
set LABEL [Label D 0:$iSubLabel]
|
||||
@ -60,7 +60,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
GetShape D ${LABEL} aSubShape
|
||||
|
||||
# Get bounding box
|
||||
bounding -s aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if {[dval X1_Box1] != [dval X1_Box2] || [dval Y1_Box1] != [dval Y1_Box2] || [dval Z1_Box1] != [dval Z1_Box2] || [dval X2_Box1] != [dval X2_Box2] || [dval Y2_Box1] != [dval Y2_Box2] || [dval Z2_Box1] != [dval Z2_Box2]} {
|
||||
puts "SelectGeometry command (${i}): Error"
|
||||
|
@ -47,7 +47,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
puts "SubShape=$S"
|
||||
|
||||
#Memorize a bounding box of the selected sub-shape
|
||||
bounding -s ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding ${S} -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Select a sub-shape
|
||||
set LABEL [Label D 0:$iSubLabel]
|
||||
@ -60,7 +60,7 @@ foreach S [directory [concat $aBox1$ter]] {
|
||||
GetShape D ${LABEL} aSubShape
|
||||
|
||||
# Get bounding box
|
||||
bounding -s aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aSubShape -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if {[dval X1_Box1] != [dval X1_Box2] || [dval Y1_Box1] != [dval Y1_Box2] || [dval Z1_Box1] != [dval Z1_Box2] || [dval X2_Box1] != [dval X2_Box2] || [dval Y2_Box1] != [dval Y2_Box2] || [dval Z2_Box1] != [dval Z2_Box2]} {
|
||||
puts "SelectGeometry command (${i}): Error"
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -57,7 +57,7 @@ Redo Doc1
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc1 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -57,7 +57,7 @@ Redo Doc2
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc2 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -57,7 +57,7 @@ Redo Doc1
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc1 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -62,7 +62,7 @@ Redo Doc1
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc1 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -70,7 +70,7 @@ if { ${IsDone} != 0 } {
|
||||
return
|
||||
}
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -57,7 +57,7 @@ Redo Doc2
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc2 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -62,7 +62,7 @@ Redo Doc1
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc2 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -68,7 +68,7 @@ Redo Doc1
|
||||
# 11. Get a shape from 'TLabel1'
|
||||
GetShape Doc1 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] == [dval X1_Box2] ||
|
||||
[dval Y1_Box1] == [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -68,7 +68,7 @@ Redo Doc2
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc2 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] == [dval X1_Box2] ||
|
||||
[dval Y1_Box1] == [dval Y1_Box2] ||
|
||||
|
@ -30,7 +30,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -48,7 +48,7 @@ set aSetDZ12 2300
|
||||
|
||||
box aBox12 ${aSetX12} ${aSetY12} ${aSetZ12} ${aSetDX12} ${aSetDY12} ${aSetDZ12}
|
||||
|
||||
bounding -s aBox12 -save X1_Box12 Y1_Box12 Z1_Box12 X2_Box12 Y2_Box12 Z2_Box12
|
||||
bounding aBox12 -save X1_Box12 Y1_Box12 Z1_Box12 X2_Box12 Y2_Box12 Z2_Box12
|
||||
|
||||
SetShape Doc1 ${aLabel12} aBox12
|
||||
|
||||
@ -99,12 +99,12 @@ Redo Doc2
|
||||
# Get a shape from 'TLabel1'
|
||||
GetShape Doc2 ${aLabel2} aBox2
|
||||
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
# Get a shape from 'T2Label1'
|
||||
GetShape Doc2 ${aLabel22} aBox22
|
||||
|
||||
bounding -s aBox22 -save X1_Box22 Y1_Box22 Z1_Box22 X2_Box22 Y2_Box22 Z2_Box22
|
||||
bounding aBox22 -save X1_Box22 Y1_Box22 Z1_Box22 X2_Box22 Y2_Box22 Z2_Box22
|
||||
|
||||
if { [dval X1_Box1] == [dval X1_Box2] ||
|
||||
[dval Y1_Box1] == [dval Y1_Box2] ||
|
||||
|
@ -37,7 +37,7 @@ proc get_element { type args } {
|
||||
global $element
|
||||
distmini dd ver $element
|
||||
if { [string match "*$type*" [whatis $element]] } {
|
||||
set bbox [bounding -s $element -save xx1 yy1 zz1 xx2 yy2 zz2 ]
|
||||
set bbox [bounding $element -save xx1 yy1 zz1 xx2 yy2 zz2 ]
|
||||
# Get distance
|
||||
set dv [lindex [dump dd_val] 5]
|
||||
if {[expr {[dval xx1-1e-2] <= $x && $x <= [dval xx2+1e-2]
|
||||
|
@ -12,7 +12,7 @@ if [regexp "Cannot write to the file $file" [binsave b $file]] {
|
||||
puts "Error: binrestore"
|
||||
} else {
|
||||
file delete $file
|
||||
if {[bounding -s b -dump] != [bounding -s bb -dump]} {
|
||||
if {[bounding b -dump] != [bounding bb -dump]} {
|
||||
puts "Error: restored shape has another bounding box"
|
||||
}
|
||||
checkshape bb
|
||||
|
@ -12,7 +12,7 @@ if [regexp "Cannot write to the file $file" [binsave b $file]] {
|
||||
puts "Error: binrestore"
|
||||
} else {
|
||||
file delete $file
|
||||
if {[bounding -s b -dump] != [bounding -s bb -dump]} {
|
||||
if {[bounding b -dump] != [bounding bb -dump]} {
|
||||
puts "Error: restored shape has another bounding box"
|
||||
}
|
||||
checkshape bb
|
||||
|
@ -12,7 +12,7 @@ if [regexp "Cannot write to the file $file" [binsave b $file]] {
|
||||
puts "Error: binrestore"
|
||||
} else {
|
||||
file delete $file
|
||||
if {[bounding -s b -dump] != [bounding -s bb -dump]} {
|
||||
if {[bounding b -dump] != [bounding bb -dump]} {
|
||||
puts "Error: restored shape has another bounding box"
|
||||
}
|
||||
checkshape bb
|
||||
|
@ -6,17 +6,19 @@ puts ""
|
||||
# Implementation of the Oriented Bounding Boxes (OBB) functionality
|
||||
#################################################
|
||||
|
||||
pload QAcommands
|
||||
|
||||
set NbIters 101
|
||||
set step [expr 360.0/($NbIters-1) ]
|
||||
|
||||
restore [locate_data_file bug29237_no_overlap.lhs.brep] a
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -perfmeter OBBL$i 5
|
||||
OCC29311 a OBBL$i 5
|
||||
if { $i != $NbIters } { trotate a 283 162 317 2 7 9 $step }
|
||||
}
|
||||
|
||||
restore [locate_data_file bug29237_no_overlap.rhs.brep] a
|
||||
for {set i 1} { $i <= $NbIters} { incr i } {
|
||||
bounding -s a -obb -perfmeter OBBR$i 5
|
||||
OCC29311 a OBBR$i 5
|
||||
if { $i != $NbIters } { trotate a 283 162 317 2 7 9 $step }
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
set aLabel 0:2
|
||||
SetShape D ${aLabel} aBox1
|
||||
@ -33,7 +33,7 @@ set IsDone [catch {GetShape DD ${aLabel} aBox5} aResult]
|
||||
if { ${IsDone} != 0 } {
|
||||
puts "Error : Get a value of TDataStd_Shape attribute from restoring document"
|
||||
} else {
|
||||
bounding -s aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
bounding aBox5 -save X1_Box5 Y1_Box5 Z1_Box5 X2_Box5 Y2_Box5 Z2_Box5
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box5] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box5] ||
|
||||
|
@ -11,7 +11,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
# Create a label
|
||||
set aLabel 0:2
|
||||
@ -41,7 +41,7 @@ if { ${IsDone} != 0 } {
|
||||
puts ${aResult}
|
||||
puts "Error : Get a value of TNaming_NamedShape attribute from restoring document"
|
||||
} else {
|
||||
bounding -s aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
bounding aBox3 -save X1_Box3 Y1_Box3 Z1_Box3 X2_Box3 Y2_Box3 Z2_Box3
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box3] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box3] ||
|
||||
|
@ -27,7 +27,7 @@ set aSetDZ1 300
|
||||
|
||||
box aBox1 ${aSetX1} ${aSetY1} ${aSetZ1} ${aSetDX1} ${aSetDY1} ${aSetDZ1}
|
||||
|
||||
bounding -s aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
bounding aBox1 -save X1_Box1 Y1_Box1 Z1_Box1 X2_Box1 Y2_Box1 Z2_Box1
|
||||
|
||||
SetShape Doc1 ${aLabel1} aBox1
|
||||
|
||||
@ -59,7 +59,7 @@ set IsDone [catch {GetShape Doc2 ${aLabel2} aBox2} aResult]
|
||||
if { ${IsDone} != 0 } {
|
||||
puts "Error : Get a value of TNaming_NamedShape attribute from restoring document"
|
||||
} else {
|
||||
bounding -s aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
bounding aBox2 -save X1_Box2 Y1_Box2 Z1_Box2 X2_Box2 Y2_Box2 Z2_Box2
|
||||
|
||||
if { [dval X1_Box1] != [dval X1_Box2] ||
|
||||
[dval Y1_Box1] != [dval Y1_Box2] ||
|
||||
|
Loading…
x
Reference in New Issue
Block a user