1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0032633: Draw Harness - extend command incmesh to apply default visualization parameters

incmesh - added -prs option to use StdPrs_ToolTriangulatedShape::GetDeflection() as meshing parameters.
vdisplay, XDisplay - added -autoTriangulation option to manage meshing behavior before displaying a shape.
trinfo - added output of meshing parameters.
Fixed broken incmesh syntax usage in several test cases.
This commit is contained in:
kgv 2021-10-19 21:34:18 +03:00 committed by smoskvin
parent 2c8c4b8086
commit 005caf39cf
15 changed files with 243 additions and 190 deletions

View File

@ -999,7 +999,7 @@ proc checktrinfo {shape args} {
# get current number of faces, triangles and nodes, value of max deflection # get current number of faces, triangles and nodes, value of max deflection
set tri_info [trinfo ${shape}] set tri_info [trinfo ${shape}]
set triinfo_pattern "(\[0-9\]+) +faces(.*\[^0-9]\(\[0-9\]+) +empty faces)?.*\[^0-9]\(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*deflection +(\[-0-9.+eE\]+)" set triinfo_pattern "(\[0-9\]+) +faces(.*\[^0-9]\(\[0-9\]+) +empty faces)?.*\[^0-9]\(\[0-9\]+) +triangles.*\[^0-9]\(\[0-9\]+) +nodes.*Maximal deflection +(\[-0-9.+eE\]+)"
if {![regexp "${triinfo_pattern}" ${tri_info} dump cur_nb_faces tmp cur_nb_empty_faces cur_nb_triangles cur_nb_nodes cur_deflection]} { if {![regexp "${triinfo_pattern}" ${tri_info} dump cur_nb_faces tmp cur_nb_empty_faces cur_nb_triangles cur_nb_nodes cur_deflection]} {
puts "Error: command trinfo prints empty info" puts "Error: command trinfo prints empty info"
} }

View File

@ -42,6 +42,9 @@
#include <OSD_OpenFile.hxx> #include <OSD_OpenFile.hxx>
#include <Poly_Connect.hxx> #include <Poly_Connect.hxx>
#include <Poly_MergeNodesTool.hxx> #include <Poly_MergeNodesTool.hxx>
#include <Poly_TriangulationParameters.hxx>
#include <Prs3d_Drawer.hxx>
#include <StdPrs_ToolTriangulatedShape.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <BRep_CurveRepresentation.hxx> #include <BRep_CurveRepresentation.hxx>
@ -80,83 +83,71 @@ OSD_Chronometer chIsos, chPointsOnIsos;
//function : incrementalmesh //function : incrementalmesh
//purpose : //purpose :
//======================================================================= //=======================================================================
static Standard_Integer incrementalmesh(Draw_Interpretor& di, Standard_Integer nbarg, const char** argv) static Standard_Integer incrementalmesh (Draw_Interpretor& theDI,
Standard_Integer theNbArgs,
const char** theArgVec)
{ {
if (nbarg < 3) if (theNbArgs < 3)
{ {
di << "\ theDI << "Syntax error: wrong number of arguments";
Builds triangular mesh for the shape\n\
usage: incmesh Shape LinearDeflection [options]\n\
options:\n\
-a val angular deflection for edges in deg\n\
(default ~28.64 deg = 0.5 rad)\n\n\
-ai val angular deflection inside of faces in deg\n\
(default ~57.29 deg = 1 rad)\n\n\
-di val Linear deflection used to tessellate the face interior.\n\
-min minimum size parameter limiting size of triangle's\n\
edges to prevent sinking into amplification in case\n\
of distorted curves and surfaces\n\n\
-relative notifies that relative deflection is used\n\
(switched off by default)\n\n\
-int_vert_off disables insertion of internal vertices into mesh\n\
(enabled by default)\n\
-surf_def_off disables control of deflection of mesh from real\n\
surface (enabled by default)\n\
-parallel enables parallel execution (switched off by default)\n\
-adjust_min enables local adjustment of min size depending on edge size (switched off by default)\n\
-force_face_def disables usage of shape tolerances for computing face deflection (switched off by default)\n\
-decrease enforces the meshing of the shape even if current mesh satisfies the new criteria\
(switched off by default).\n\
-algo {watson|delabella} changes core triangulation algorithm to one with specified id (watson is used by default)\n";
return 0;
}
TopoDS_ListOfShape aListOfShapes;
IMeshTools_Parameters aMeshParams;
Standard_Boolean isDeflectionInitialized = Standard_False;
Handle (IMeshTools_Context) aContext = new BRepMesh_Context;
for (Standard_Integer anArgIter = 1; anArgIter < nbarg; ++anArgIter)
{
TCollection_AsciiString aName = argv[anArgIter];
TCollection_AsciiString aNameCase = aName;
aNameCase.LowerCase();
if (aNameCase == "")
continue;
else if (aNameCase == "-relative")
aMeshParams.Relative = Standard_True;
else if (aNameCase == "-parallel")
aMeshParams.InParallel = Standard_True;
else if (aNameCase == "-int_vert_off")
aMeshParams.InternalVerticesMode = Standard_False;
else if (aNameCase == "-surf_def_off")
aMeshParams.ControlSurfaceDeflection = Standard_False;
else if (aNameCase == "-adjust_min")
aMeshParams.AdjustMinSize = Standard_True;
else if (aNameCase == "-force_face_def")
aMeshParams.ForceFaceDeflection = Standard_True;
else if (aNameCase == "-decrease")
aMeshParams.AllowQualityDecrease = Standard_True;
else if (aNameCase == "-algo")
{
if (++anArgIter >= nbarg)
{
di << "Error: wrong syntax at " << aNameCase;
return 1; return 1;
} }
TCollection_AsciiString anAlgoStr (argv[anArgIter]);
TopoDS_ListOfShape aListOfShapes;
IMeshTools_Parameters aMeshParams;
bool hasDefl = false, hasAngDefl = false, isPrsDefl = false;
Handle(IMeshTools_Context) aContext = new BRepMesh_Context();
for (Standard_Integer anArgIter = 1; anArgIter < theNbArgs; ++anArgIter)
{
TCollection_AsciiString aNameCase (theArgVec[anArgIter]);
aNameCase.LowerCase();
if (aNameCase == "-relative"
|| aNameCase == "-norelative")
{
aMeshParams.Relative = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-parallel"
|| aNameCase == "-noparallel")
{
aMeshParams.InParallel = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-int_vert_off")
{
aMeshParams.InternalVerticesMode = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-surf_def_off")
{
aMeshParams.ControlSurfaceDeflection = !Draw::ParseOnOffIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-adjust_min")
{
aMeshParams.AdjustMinSize = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-force_face_def")
{
aMeshParams.ForceFaceDeflection = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-decrease")
{
aMeshParams.AllowQualityDecrease = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter);
}
else if (aNameCase == "-algo"
&& anArgIter + 1 < theNbArgs)
{
TCollection_AsciiString anAlgoStr (theArgVec[++anArgIter]);
anAlgoStr.LowerCase(); anAlgoStr.LowerCase();
if (anAlgoStr == "watson" if (anAlgoStr == "watson"
|| anAlgoStr == "0") || anAlgoStr == "0")
{ {
aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Watson; aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Watson;
aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_MeshAlgoFactory)); aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_MeshAlgoFactory()));
} }
else if (anAlgoStr == "delabella" else if (anAlgoStr == "delabella"
|| anAlgoStr == "1") || anAlgoStr == "1")
{ {
aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Delabella; aMeshParams.MeshAlgo = IMeshTools_MeshAlgoType_Delabella;
aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory)); aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory()));
} }
else if (anAlgoStr == "-1" else if (anAlgoStr == "-1"
|| anAlgoStr == "default") || anAlgoStr == "default")
@ -166,89 +157,82 @@ options:\n\
} }
else else
{ {
di << "Syntax error at " << anAlgoStr; theDI << "Syntax error at '" << anAlgoStr << "'";
return 1; return 1;
} }
} }
else if (aNameCase == "-a") else if ((aNameCase == "-prs"
|| aNameCase == "-presentation"
|| aNameCase == "-vis"
|| aNameCase == "-visualization")
&& !isPrsDefl)
{ {
if (++anArgIter >= nbarg) isPrsDefl = true;
{
di << "Error: wrong syntax at " << aNameCase;
return 1;
} }
Standard_Real aVal = Draw::Atof (argv[anArgIter]) * M_PI / 180.; else if ((aNameCase == "-angular"
|| aNameCase == "-angdefl"
|| aNameCase == "-angulardeflection"
|| aNameCase == "-a")
&& anArgIter + 1 < theNbArgs)
{
Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]) * M_PI / 180.;
if (aVal <= Precision::Angular()) if (aVal <= Precision::Angular())
{ {
di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'"; theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
aMeshParams.Angle = aVal; aMeshParams.Angle = aVal;
hasAngDefl = true;
} }
else if (aNameCase == "-ai") else if (aNameCase == "-ai"
&& anArgIter + 1 < theNbArgs)
{ {
if (++anArgIter >= nbarg) Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]) * M_PI / 180.;
{
di << "Error: wrong syntax at " << aNameCase;
return 1;
}
Standard_Real aVal = Draw::Atof (argv[anArgIter]) * M_PI / 180.;
if (aVal <= Precision::Angular()) if (aVal <= Precision::Angular())
{ {
di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'"; theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
aMeshParams.AngleInterior = aVal; aMeshParams.AngleInterior = aVal;
} }
else if (aNameCase == "-min") else if (aNameCase == "-min"
&& anArgIter + 1 < theNbArgs)
{ {
if (++anArgIter >= nbarg) Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]);
{
di << "Error: wrong syntax at " << aNameCase;
return 1;
}
Standard_Real aVal = Draw::Atof (argv[anArgIter]);
if (aVal <= Precision::Confusion()) if (aVal <= Precision::Confusion())
{ {
di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'"; theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
aMeshParams.MinSize = aVal; aMeshParams.MinSize = aVal;
} }
else if (aNameCase == "-di") else if (aNameCase == "-di"
&& anArgIter + 1 < theNbArgs)
{ {
if (++anArgIter >= nbarg) Standard_Real aVal = Draw::Atof (theArgVec[++anArgIter]);
{
di << "Error: wrong syntax at " << aNameCase;
return 1;
}
Standard_Real aVal = Draw::Atof (argv[anArgIter]);
if (aVal <= Precision::Confusion()) if (aVal <= Precision::Confusion())
{ {
di << "Syntax error: invalid input parameter '" << argv[anArgIter] << "'"; theDI << "Syntax error: invalid input parameter '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
aMeshParams.DeflectionInterior = aVal; aMeshParams.DeflectionInterior = aVal;
} }
else if (aNameCase.IsRealValue (Standard_True)) else if (aNameCase.IsRealValue (true)
&& !hasDefl)
{ {
if (isDeflectionInitialized) aMeshParams.Deflection = Max (Draw::Atof (theArgVec[anArgIter]), Precision::Confusion());
{
continue;
}
aMeshParams.Deflection = Max (Draw::Atof (argv[anArgIter]), Precision::Confusion());
if (aMeshParams.DeflectionInterior < Precision::Confusion()) if (aMeshParams.DeflectionInterior < Precision::Confusion())
{ {
aMeshParams.DeflectionInterior = aMeshParams.Deflection; aMeshParams.DeflectionInterior = aMeshParams.Deflection;
} }
isDeflectionInitialized = Standard_True; hasDefl = true;
} }
else else
{ {
TopoDS_Shape aShape = DBRep::Get (aName); TopoDS_Shape aShape = DBRep::Get (theArgVec[anArgIter]);
if (aShape.IsNull()) if (aShape.IsNull())
{ {
di << "Syntax error: null shapes are not allowed here - " << aName <<"\n"; theDI << "Syntax error: null shapes are not allowed here '" << theArgVec[anArgIter] << "'\n";
return 1; return 1;
} }
aListOfShapes.Append (aShape); aListOfShapes.Append (aShape);
@ -261,7 +245,7 @@ options:\n\
return 1; return 1;
} }
di << "Incremental Mesh, multi-threading " theDI << "Incremental Mesh, multi-threading "
<< (aMeshParams.InParallel ? "ON" : "OFF") << "\n"; << (aMeshParams.InParallel ? "ON" : "OFF") << "\n";
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -279,64 +263,55 @@ options:\n\
} }
aShape = aCompound; aShape = aCompound;
} }
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (di, 1);
if (isPrsDefl)
{
Handle(Prs3d_Drawer) aDrawer = new Prs3d_Drawer();
if (hasDefl)
{
aDrawer->SetDeviationCoefficient (aMeshParams.Deflection);
}
aMeshParams.Deflection = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, aDrawer);
if (!hasAngDefl)
{
aMeshParams.Angle = aDrawer->DeviationAngle();
}
}
Handle(Draw_ProgressIndicator) aProgress = new Draw_ProgressIndicator (theDI, 1);
BRepMesh_IncrementalMesh aMesher; BRepMesh_IncrementalMesh aMesher;
aMesher.SetShape (aShape); aMesher.SetShape (aShape);
aMesher.ChangeParameters() = aMeshParams; aMesher.ChangeParameters() = aMeshParams;
aMesher.Perform (aContext, aProgress->Start()); aMesher.Perform (aContext, aProgress->Start());
di << "Meshing statuses: "; theDI << "Meshing statuses: ";
const Standard_Integer aStatus = aMesher.GetStatusFlags(); const Standard_Integer aStatus = aMesher.GetStatusFlags();
if (!aStatus) if (aStatus == 0)
{ {
di << "NoError"; theDI << "NoError";
return 0;
} }
else
{ for (Standard_Integer i = 0; i < 9; i++)
Standard_Integer i;
for (i = 0; i < 9; i++)
{ {
Standard_Integer aFlag = aStatus & (1 << i); Standard_Integer aFlag = aStatus & (1 << i);
if (aFlag) if (aFlag)
{ {
switch ((IMeshData_Status) aFlag) switch ((IMeshData_Status) aFlag)
{ {
case IMeshData_OpenWire: case IMeshData_OpenWire: theDI << "OpenWire "; break;
di << "OpenWire "; case IMeshData_SelfIntersectingWire: theDI << "SelfIntersectingWire "; break;
break; case IMeshData_Failure: theDI << "Failure "; break;
case IMeshData_SelfIntersectingWire: case IMeshData_ReMesh: theDI << "ReMesh "; break;
di << "SelfIntersectingWire "; case IMeshData_UnorientedWire: theDI << "UnorientedWire "; break;
break; case IMeshData_TooFewPoints: theDI << "TooFewPoints "; break;
case IMeshData_Failure: case IMeshData_Outdated: theDI << "Outdated "; break;
di << "Failure "; case IMeshData_Reused: theDI << "Reused "; break;
break; case IMeshData_UserBreak: theDI << "UserBreak "; break;
case IMeshData_ReMesh: case IMeshData_NoError: break;
di << "ReMesh ";
break;
case IMeshData_UnorientedWire:
di << "UnorientedWire ";
break;
case IMeshData_TooFewPoints:
di << "TooFewPoints ";
break;
case IMeshData_Outdated:
di << "Outdated ";
break;
case IMeshData_Reused:
di << "Reused ";
break;
case IMeshData_UserBreak:
di << "User break";
break;
case IMeshData_NoError:
default:
break;
} }
} }
} }
}
return 0; return 0;
} }
@ -757,7 +732,7 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
TopExp_Explorer anExp; TopExp_Explorer anExp;
Handle(Poly_Triangulation) aTriangulation; Handle(Poly_Triangulation) aTriangulation;
TopLoc_Location aLoc; TopLoc_Location aLoc;
Standard_Real aMaxDeflection = 0.0; Standard_Real aMaxDeflection = 0.0, aMeshingDefl = -1.0, aMeshingAngDefl = -1.0, aMeshingMinSize = -1.0;
Standard_Integer aNbFaces = 0, aNbEmptyFaces = 0, aNbTriangles = 0, aNbNodes = 0, aNbRepresentations = 0; Standard_Integer aNbFaces = 0, aNbEmptyFaces = 0, aNbTriangles = 0, aNbNodes = 0, aNbRepresentations = 0;
NCollection_IndexedDataMap<Standard_Integer, TriangulationStat> aLODsStat; NCollection_IndexedDataMap<Standard_Integer, TriangulationStat> aLODsStat;
NCollection_Vector<Standard_Integer> aNbLODs; NCollection_Vector<Standard_Integer> aNbLODs;
@ -770,9 +745,12 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
{ {
aNbTriangles += aTriangulation->NbTriangles(); aNbTriangles += aTriangulation->NbTriangles();
aNbNodes += aTriangulation->NbNodes(); aNbNodes += aTriangulation->NbNodes();
if (aTriangulation->Deflection() > aMaxDeflection) aMaxDeflection = Max (aMaxDeflection, aTriangulation->Deflection());
if (!aTriangulation->Parameters().IsNull())
{ {
aMaxDeflection = aTriangulation->Deflection(); aMeshingDefl = Max (aMeshingDefl, aTriangulation->Parameters()->Deflection());
aMeshingAngDefl = Max (aMeshingAngDefl, aTriangulation->Parameters()->Angle());
aMeshingMinSize = Max (aMeshingMinSize, aTriangulation->Parameters()->MinSize());
} }
} }
else else
@ -868,6 +846,18 @@ static Standard_Integer trianglesinfo (Draw_Interpretor& theDI, Standard_Integer
theDI << " " << aNbNodes << " nodes.\n"; theDI << " " << aNbNodes << " nodes.\n";
theDI << " " << aNbRepresentations << " polygons on triangulation.\n"; theDI << " " << aNbRepresentations << " polygons on triangulation.\n";
theDI << "Maximal deflection " << aMaxDeflection << "\n"; theDI << "Maximal deflection " << aMaxDeflection << "\n";
if (aMeshingDefl > 0.0)
{
theDI << "Meshing deflection " << aMeshingDefl << "\n";
}
if (aMeshingAngDefl > 0.0)
{
theDI << "Meshing angular deflection " << (aMeshingAngDefl * 180.0 / M_PI) << "\n";
}
if (aMeshingMinSize > 0.0)
{
theDI << "Meshing min size " << aMeshingMinSize << "\n";
}
if (aNbLODs.Size() > 0) if (aNbLODs.Size() > 0)
{ {
@ -1613,7 +1603,32 @@ void MeshTest::Commands(Draw_Interpretor& theCommands)
g = "Mesh Commands"; g = "Mesh Commands";
theCommands.Add("incmesh","Builds triangular mesh for the shape, run w/o args for help",__FILE__, incrementalmesh, g); theCommands.Add("incmesh",
"incmesh Shape LinDefl [-angular Angle]=28.64 [-prs]"
"\n\t\t: [-relative {0|1}]=0 [-parallel {0|1}]=0 [-min Size]"
"\n\t\t: [-algo {watson|delabella}]=watson"
"\n\t\t: [-di Value] [-ai Angle]=57.29"
"\n\t\t: [-int_vert_off {0|1}]=0 [-surf_def_off {0|1}]=0 [-adjust_min {0|1}]=0"
"\n\t\t: [-force_face_def {0|1}]=0 [-decrease {0|1}]=0"
"\n\t\t: Builds triangular mesh for the shape."
"\n\t\t: LinDefl linear deflection to control mesh quality;"
"\n\t\t: -angular angular deflection for edges in deg (~28.64 deg = 0.5 rad by default);"
"\n\t\t: -prs apply default meshing parameters for visualization purposes"
"\n\t\t: (20 deg angular deflection, 0.001 of bounding box linear deflection);"
"\n\t\t: -relative notifies that relative deflection is used (FALSE by default);"
"\n\t\t: -parallel enables parallel execution (FALSE by default);"
"\n\t\t: -algo changes core triangulation algorithm to one with specified id (watson by default);"
"\n\t\t: -min minimum size parameter limiting size of triangle's edges to prevent sinking"
"\n\t\t: into amplification in case of distorted curves and surfaces;"
"\n\t\t: -di linear deflection used to tessellate the face interior;"
"\n\t\t: -ai angular deflection inside of faces in deg (~57.29 deg = 1 rad by default);"
"\n\t\t: -int_vert_off disables insertion of internal vertices into mesh (enabled by default);"
"\n\t\t: -surf_def_off disables control of deflection of mesh from real surface (enabled by default);"
"\n\t\t: -adjust_min enables local adjustment of min size depending on edge size (FALSE by default);"
"\n\t\t: -force_face_def disables usage of shape tolerances for computing face deflection (FALSE by default);"
"\n\t\t: -decrease enforces the meshing of the shape even if current mesh satisfies the new criteria"
"\n\t\t: (FALSE by default).",
__FILE__, incrementalmesh, g);
theCommands.Add("tessellate","Builds triangular mesh for the surface, run w/o args for help",__FILE__, tessellate, g); theCommands.Add("tessellate","Builds triangular mesh for the surface, run w/o args for help",__FILE__, tessellate, g);
theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g); theCommands.Add("MemLeakTest","MemLeakTest",__FILE__, MemLeakTest, g);

View File

@ -4847,6 +4847,7 @@ static int VDisplay2 (Draw_Interpretor& theDI,
Standard_Integer anObjHighMode = -2; Standard_Integer anObjHighMode = -2;
Standard_Boolean toSetTrsfPers = Standard_False; Standard_Boolean toSetTrsfPers = Standard_False;
Standard_Boolean toEcho = Standard_True; Standard_Boolean toEcho = Standard_True;
Standard_Integer isAutoTriang = -1;
Handle(Graphic3d_TransformPers) aTrsfPers; Handle(Graphic3d_TransformPers) aTrsfPers;
TColStd_SequenceOfAsciiString aNamesOfDisplayIO; TColStd_SequenceOfAsciiString aNamesOfDisplayIO;
AIS_DisplayStatus aDispStatus = AIS_DS_None; AIS_DisplayStatus aDispStatus = AIS_DS_None;
@ -5048,6 +5049,17 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{ {
toReDisplay = Standard_True; toReDisplay = Standard_True;
} }
else if (aNameCase == "-autotr"
|| aNameCase == "-autotrian"
|| aNameCase == "-autotriang"
|| aNameCase == "-autotriangulation"
|| aNameCase == "-noautotr"
|| aNameCase == "-noautotrian"
|| aNameCase == "-noautotriang"
|| aNameCase == "-noautotriangulation")
{
isAutoTriang = Draw::ParseOnOffNoIterator (theArgNb, theArgVec, anArgIter) ? 1 : 0;
}
else if (aNameCase == "-erased" else if (aNameCase == "-erased"
|| aNameCase == "-load") || aNameCase == "-load")
{ {
@ -5089,6 +5101,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{ {
aShape->SetZLayer (aZLayer); aShape->SetZLayer (aZLayer);
} }
if (isAutoTriang != -1)
{
aShape->Attributes()->SetAutoTriangulation (isAutoTriang == 1);
}
if (toSetTrsfPers) if (toSetTrsfPers)
{ {
aCtx->SetTransformPersistence (aShape, aTrsfPers); aCtx->SetTransformPersistence (aShape, aTrsfPers);
@ -5157,6 +5173,10 @@ static int VDisplay2 (Draw_Interpretor& theDI,
{ {
aShape->SetZLayer (aZLayer); aShape->SetZLayer (aZLayer);
} }
if (isAutoTriang != -1)
{
aShape->Attributes()->SetAutoTriangulation (isAutoTriang == 1);
}
if (toSetTrsfPers) if (toSetTrsfPers)
{ {
aCtx->SetTransformPersistence (aShape, aTrsfPers); aCtx->SetTransformPersistence (aShape, aTrsfPers);
@ -6554,7 +6574,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: [-dispMode mode] [-highMode mode]" "\n\t\t: [-dispMode mode] [-highMode mode]"
"\n\t\t: [-layer index] [-top|-topmost|-overlay|-underlay]" "\n\t\t: [-layer index] [-top|-topmost|-overlay|-underlay]"
"\n\t\t: [-redisplay] [-erased]" "\n\t\t: [-redisplay] [-erased]"
"\n\t\t: [-noecho]" "\n\t\t: [-noecho] [-autoTriangulation {0|1}]"
"\n\t\t: name1 [name2] ... [name n]" "\n\t\t: name1 [name2] ... [name n]"
"\n\t\t: Displays named objects." "\n\t\t: Displays named objects."
"\n\t\t: Option -local enables displaying of objects in local" "\n\t\t: Option -local enables displaying of objects in local"
@ -6583,7 +6603,8 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: -dispmode Sets display mode for objects." "\n\t\t: -dispmode Sets display mode for objects."
"\n\t\t: -highmode Sets hilight mode for objects." "\n\t\t: -highmode Sets hilight mode for objects."
"\n\t\t: -redisplay Recomputes presentation of objects." "\n\t\t: -redisplay Recomputes presentation of objects."
"\n\t\t: -noecho Avoid printing of command results.", "\n\t\t: -noecho Avoid printing of command results."
"\n\t\t: -autoTriang Enable/disable auto-triangulation for displayed shape."
__FILE__, VDisplay2, group); __FILE__, VDisplay2, group);
theCommands.Add ("vnbdisplayed", theCommands.Add ("vnbdisplayed",

View File

@ -644,12 +644,14 @@ private:
XDEDRAW_XDisplayTool() XDEDRAW_XDisplayTool()
: myDispMode(-2), : myDispMode(-2),
myHiMode (-2), myHiMode (-2),
myIsAutoTriang (-1),
myToPrefixDocName (Standard_True), myToPrefixDocName (Standard_True),
myToGetNames (Standard_True), myToGetNames (Standard_True),
myToExplore (Standard_False) {} myToExplore (Standard_False) {}
//! Display single label. //! Display single label.
Standard_Integer displayLabel (const TDF_Label& theLabel, Standard_Integer displayLabel (Draw_Interpretor& theDI,
const TDF_Label& theLabel,
const TCollection_AsciiString& theNamePrefix, const TCollection_AsciiString& theNamePrefix,
const TopLoc_Location& theLoc, const TopLoc_Location& theLoc,
TCollection_AsciiString& theOutDispList) TCollection_AsciiString& theOutDispList)
@ -701,7 +703,7 @@ private:
const TopLoc_Location aLoc = theLoc * XCAFDoc_ShapeTool::GetLocation (theLabel); const TopLoc_Location aLoc = theLoc * XCAFDoc_ShapeTool::GetLocation (theLabel);
for (TDF_ChildIterator aChildIter (aRefLabel); aChildIter.More(); aChildIter.Next()) for (TDF_ChildIterator aChildIter (aRefLabel); aChildIter.More(); aChildIter.Next())
{ {
if (displayLabel (aChildIter.Value(), aName, aLoc, theOutDispList) == 1) if (displayLabel (theDI, aChildIter.Value(), aName, aLoc, theOutDispList) == 1)
{ {
return 1; return 1;
} }
@ -723,7 +725,7 @@ private:
} }
if (!aPrs->AcceptDisplayMode (myDispMode)) if (!aPrs->AcceptDisplayMode (myDispMode))
{ {
std::cout << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myDispMode << " display mode\n"; theDI << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myDispMode << " display mode";
return 1; return 1;
} }
else else
@ -736,11 +738,15 @@ private:
if (myHiMode != -1 if (myHiMode != -1
&& !aPrs->AcceptDisplayMode (myHiMode)) && !aPrs->AcceptDisplayMode (myHiMode))
{ {
std::cout << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myHiMode << " display mode\n"; theDI << "Syntax error: " << aPrs->DynamicType()->Name() << " rejects " << myHiMode << " display mode";
return 1; return 1;
} }
aPrs->SetHilightMode (myHiMode); aPrs->SetHilightMode (myHiMode);
} }
if (myIsAutoTriang != -1)
{
aPrs->Attributes()->SetAutoTriangulation (myIsAutoTriang == 1);
}
ViewerTest::Display (aName, aPrs, false); ViewerTest::Display (aName, aPrs, false);
theOutDispList += aName + " "; theOutDispList += aName + " ";
@ -755,7 +761,7 @@ private:
Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext(); Handle(AIS_InteractiveContext) aContext = ViewerTest::GetAISContext();
if (aContext.IsNull()) if (aContext.IsNull())
{ {
std::cout << "Error: no active view!\n"; theDI << "Error: no active viewer";
return 1; return 1;
} }
@ -785,6 +791,17 @@ private:
{ {
myHiMode = TCollection_AsciiString (theArgVec[++anArgIter]).IntegerValue(); myHiMode = TCollection_AsciiString (theArgVec[++anArgIter]).IntegerValue();
} }
else if (anArgCase == "-autotr"
|| anArgCase == "-autotrian"
|| anArgCase == "-autotriang"
|| anArgCase == "-autotriangulation"
|| anArgCase == "-noautotr"
|| anArgCase == "-noautotrian"
|| anArgCase == "-noautotriang"
|| anArgCase == "-noautotriangulation")
{
myIsAutoTriang = Draw::ParseOnOffNoIterator (theNbArgs, theArgVec, anArgIter) ? 1 : 0;
}
else if (anArgCase == "-docprefix" else if (anArgCase == "-docprefix"
|| anArgCase == "-nodocprefix") || anArgCase == "-nodocprefix")
{ {
@ -857,7 +874,7 @@ private:
if (!myDoc.IsNull() if (!myDoc.IsNull()
&& myDoc != aDoc) && myDoc != aDoc)
{ {
std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n"; theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
myDoc = aDoc; myDoc = aDoc;
@ -866,7 +883,7 @@ private:
} }
if (myDoc.IsNull()) if (myDoc.IsNull())
{ {
std::cout << "Syntax error at '" << theArgVec[anArgIter] << "'\n"; theDI << "Syntax error at '" << theArgVec[anArgIter] << "'";
return 1; return 1;
} }
@ -875,7 +892,7 @@ private:
if (aLabel.IsNull() if (aLabel.IsNull()
|| !XCAFDoc_ShapeTool::IsShape (aLabel)) || !XCAFDoc_ShapeTool::IsShape (aLabel))
{ {
std::cout << "Syntax error: " << aValue << " is not a valid shape label\n"; theDI << "Syntax error: " << aValue << " is not a valid shape label";
return 1; return 1;
} }
myLabels.Append (aLabel); myLabels.Append (aLabel);
@ -883,7 +900,7 @@ private:
} }
if (myDoc.IsNull()) if (myDoc.IsNull())
{ {
std::cout << "Syntax error: not enough arguments\n"; theDI << "Syntax error: not enough arguments";
return 1; return 1;
} }
if (myLabels.IsEmpty()) if (myLabels.IsEmpty())
@ -894,7 +911,7 @@ private:
for (TDF_LabelSequence::Iterator aLabIter (myLabels); aLabIter.More(); aLabIter.Next()) for (TDF_LabelSequence::Iterator aLabIter (myLabels); aLabIter.More(); aLabIter.Next())
{ {
const TDF_Label& aLabel = aLabIter.Value(); const TDF_Label& aLabel = aLabIter.Value();
if (displayLabel (aLabel, myToPrefixDocName ? myDocName + ":" : "", TopLoc_Location(), myOutDispList) == 1) if (displayLabel (theDI, aLabel, myToPrefixDocName ? myDocName + ":" : "", TopLoc_Location(), myOutDispList) == 1)
{ {
return 1; return 1;
} }
@ -920,6 +937,7 @@ private:
TDF_LabelSequence myLabels; //!< labels to display TDF_LabelSequence myLabels; //!< labels to display
Standard_Integer myDispMode; //!< shape display mode Standard_Integer myDispMode; //!< shape display mode
Standard_Integer myHiMode; //!< shape highlight mode Standard_Integer myHiMode; //!< shape highlight mode
Standard_Integer myIsAutoTriang; //!< auto-triangulation mode
Standard_Boolean myToPrefixDocName; //!< flag to prefix objects with document name Standard_Boolean myToPrefixDocName; //!< flag to prefix objects with document name
Standard_Boolean myToGetNames; //!< flag to use label names or tags Standard_Boolean myToGetNames; //!< flag to use label names or tags
Standard_Boolean myToExplore; //!< flag to explore assembles Standard_Boolean myToExplore; //!< flag to explore assembles
@ -1394,7 +1412,7 @@ void XDEDRAW::Init(Draw_Interpretor& di)
di.Add ("XDisplay", di.Add ("XDisplay",
"XDisplay Doc [label1 [label2 [...]]] [-explore {on|off}] [-docPrefix {on|off}] [-names {on|off}]" "XDisplay Doc [label1 [label2 [...]]] [-explore {on|off}] [-docPrefix {on|off}] [-names {on|off}]"
"\n\t\t: [-noupdate] [-dispMode Mode] [-highMode Mode]" "\n\t\t: [-noupdate] [-dispMode Mode] [-highMode Mode] [-autoTriangulation {0|1}]"
"\n\t\t: Displays document (parts) in 3D Viewer." "\n\t\t: Displays document (parts) in 3D Viewer."
"\n\t\t: -dispMode Presentation display mode." "\n\t\t: -dispMode Presentation display mode."
"\n\t\t: -highMode Presentation highlight mode." "\n\t\t: -highMode Presentation highlight mode."
@ -1402,7 +1420,8 @@ void XDEDRAW::Init(Draw_Interpretor& di)
"\n\t\t: -names Use object names instead of label tag; TRUE by default." "\n\t\t: -names Use object names instead of label tag; TRUE by default."
"\n\t\t: -explore Explode labels to leaves; FALSE by default." "\n\t\t: -explore Explode labels to leaves; FALSE by default."
"\n\t\t: -outDispList Set the TCL variable to the list of displayed object names." "\n\t\t: -outDispList Set the TCL variable to the list of displayed object names."
"\n\t\t: (instead of printing them to draw interpreter)", "\n\t\t: (instead of printing them to draw interpreter)"
"\n\t\t: -autoTriang Enable/disable auto-triangulation for displayed shapes.",
__FILE__, XDEDRAW_XDisplayTool::XDisplay, g); __FILE__, XDEDRAW_XDisplayTool::XDisplay, g);
di.Add ("XWdump","Doc filename.{gif|xwd|bmp} \t: Dump contents of viewer window to XWD, GIF or BMP file", di.Add ("XWdump","Doc filename.{gif|xwd|bmp} \t: Dump contents of viewer window to XWD, GIF or BMP file",

View File

@ -10,7 +10,7 @@ pload XDE
param xstep.cascade.unit M param xstep.cascade.unit M
stepread [locate_data_file bug25281_tess_infloop_extract.step] a * stepread [locate_data_file bug25281_tess_infloop_extract.step] a *
incmesh a_1 0.0002 1 incmesh a_1 0.0002 -parallel
checktrinfo a_1 -tri -nod checktrinfo a_1 -tri -nod

View File

@ -13,6 +13,6 @@ restore [locate_data_file bug23625_a1.brep] a
# workaround bug 0031426 until fix # workaround bug 0031426 until fix
vinit View1 vinit View1
vdefaults -autoTriang 0 vdefaults -autoTriang 0
incmesh a 7.6 12 incmesh a 7.6
COMPUTE_HLR $viewname $algotype COMPUTE_HLR $viewname $algotype

View File

@ -1,3 +1,3 @@
set command incmesh set command incmesh
set group advanced set group advanced
set parallel "" set parallel 0

View File

@ -1,3 +1,3 @@
set command incmesh set command incmesh
set group advanced set group advanced
set parallel -parallel set parallel 1

View File

@ -31,13 +31,13 @@ if { [string compare $command "shading"] == 0 } {
} }
if { [string compare $command "incmesh"] == 0 } { if { [string compare $command "incmesh"] == 0 } {
if { [string compare $parallel "-parallel"] != 0 || [info exists count_parallel] == 0 } { if { [string compare $parallel "1"] != 0 || [info exists count_parallel] == 0 } {
set count_parallel 1 set count_parallel 1
} }
for {set i 1} {$i <= $count_parallel} {incr i} { for {set i 1} {$i <= $count_parallel} {incr i} {
tclean res tclean res
puts "i = $i" puts "i = $i"
incmesh res ${Deflection} ${parallel} incmesh res ${Deflection} -parallel ${parallel}
} }
} }

View File

@ -1,3 +1,3 @@
set command incmesh set command incmesh
set group standard set group standard
set parallel "" set parallel 0

View File

@ -1,3 +1,3 @@
set command incmesh set command incmesh
set group standard set group standard
set parallel -parallel set parallel 1

View File

@ -8,7 +8,7 @@ pload XDE
stepread [locate_data_file bug26889_export.step] a * stepread [locate_data_file bug26889_export.step] a *
dchrono t restart dchrono t restart
incmesh a_1 0.01 1 incmesh a_1 0.01 -parallel
dchrono t stop counter incmesh dchrono t stop counter incmesh
checktrinfo a_1 -tri 525271 -nod 263456 -defl 0.069482224632795617 -tol_abs_defl 1e-6 checktrinfo a_1 -tri 525271 -nod 263456 -defl 0.069482224632795617 -tol_abs_defl 1e-6

View File

@ -8,7 +8,7 @@ pload XDE
stepread [locate_data_file bug26889_export.step] a * stepread [locate_data_file bug26889_export.step] a *
dchrono t restart dchrono t restart
incmesh a_1 0.1 1 incmesh a_1 0.1 -parallel
dchrono t stop counter incmesh dchrono t stop counter incmesh
checktrinfo a_1 -tri 68779 -nod 34737 -defl 0.24900556935704937 -tol_abs_defl 1e-6 checktrinfo a_1 -tri 68779 -nod 34737 -defl 0.24900556935704937 -tol_abs_defl 1e-6

View File

@ -8,7 +8,7 @@ pload XDE
stepread [locate_data_file bug26889_export.step] a * stepread [locate_data_file bug26889_export.step] a *
dchrono t restart dchrono t restart
incmesh a_1 1.0 1 incmesh a_1 1.0 -parallel
dchrono t stop counter incmesh dchrono t stop counter incmesh
checktrinfo a_1 -tri 12469 -nod 6503 -defl 1.2783003174746328 -tol_abs_defl 1e-6 checktrinfo a_1 -tri 12469 -nod 6503 -defl 1.2783003174746328 -tol_abs_defl 1e-6

View File

@ -10,10 +10,8 @@ pload MODELING VISUALIZATION
vinit View1 vinit View1
vclear vclear
vaxo vaxo
vsetdispmode 1
vdefaults -autoTriang off
pcone c 0 5 10 pcone c 0 5 10
vdisplay c vdisplay c -dispMode 1 -autoTriang off
vfit vfit
set aColor [vreadpixel 200 77 rgb name] set aColor [vreadpixel 200 77 rgb name]