1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0032684: Draw Harness - fix Draw_Interpretor::Add() misuse due to overloaded syntax

This commit is contained in:
kgv 2021-11-23 20:35:58 +03:00 committed by smoskvin
parent 4e69a6ac05
commit d0cf7e8f3c
11 changed files with 65 additions and 56 deletions

View File

@ -1915,11 +1915,11 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
theCommands.Add("mkoffset",
"mkoffset result face/compound of wires nboffset stepoffset [jointype(a/i) [alt]]",__FILE__,
mkoffset);
mkoffset,g);
theCommands.Add("openoffset",
"openoffset result face/wire nboffset stepoffset [jointype(a/i)]",__FILE__,
openoffset);
openoffset,g);
theCommands.Add("mkedge",
"mkedge edge curve [surface] [pfirst plast] [vfirst [pfirst] vlast [plast]] ",__FILE__,
@ -1967,11 +1967,11 @@ void BRepTest::CurveCommands(Draw_Interpretor& theCommands)
edgeintersector,g);
theCommands.Add("build3d",
"build3d S [tol]",
"build3d S [tol]",__FILE__,
build3d, g);
theCommands.Add("reducepcurves",
"reducepcurves shape1 shape2 ...",
"reducepcurves shape1 shape2 ...",__FILE__,
reducepcurves, g);
theCommands.Add("concatC0wire",

View File

@ -2502,7 +2502,7 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
theCommands.Add("offsetparameter",
"offsetparameter Tol Inter(c/p) JoinType(a/i/t) [RemoveInternalEdges(r/k)]",
__FILE__, offsetparameter);
__FILE__, offsetparameter, g);
theCommands.Add("offsetload",
"offsetload shape offset bouchon1 bouchon2 ...",
@ -2523,53 +2523,53 @@ void BRepTest::FeatureCommands(Draw_Interpretor& theCommands)
theCommands.Add("featprism",
"Defines the arguments for a prism : featprism shape element skface Dirx Diry Dirz Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("featrevol",
"Defines the arguments for a revol : featrevol shape element skface Ox Oy Oz Dx Dy Dz Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("featpipe",
"Defines the arguments for a pipe : featpipe shape element skface spine Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("featdprism",
"Defines the arguments for a drafted prism : featdprism shape face skface angle Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("featlf",
"Defines the arguments for a linear rib or slot : featlf shape wire plane DirX DirY DirZ DirX DirY DirZ Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("featrf",
"Defines the arguments for a rib or slot of revolution : featrf shape wire plane X Y Z DirX DirY DirZ Size Size Fuse(0/1/2) Modify(0/1)",
__FILE__, DEFIN);
__FILE__, DEFIN, g);
theCommands.Add("addslide",
" Adds sliding elements : addslide prism/revol/pipe edge face [edge face...]",
__FILE__, ADD);
__FILE__, ADD, g);
theCommands.Add("featperform",
" Performs the prism revol dprism linform or pipe :featperform prism/revol/pipe/dprism/lf result [[Ffrom] Funtil]",
__FILE__, PERF);
__FILE__, PERF, g);
theCommands.Add("featperformval",
" Performs the prism revol dprism or linform with a value :featperformval prism/revol/dprism/lf result value",
__FILE__, PERF);
__FILE__, PERF, g);
theCommands.Add("endedges",
" Return top and bottom edges of dprism :endedges dprism shapetop shapebottom First/LastShape (1/2)",
__FILE__, BOSS);
__FILE__, BOSS, g);
theCommands.Add("fillet",
" Perform fillet on compounds of edges :fillet result object rad1 comp1 rad2 comp2 ...",
__FILE__, BOSS);
__FILE__, BOSS, g);
theCommands.Add("bossage",
" Perform fillet on top and bottom edges of dprism :bossage dprism result radtop radbottom First/LastShape (1/2)",
__FILE__, BOSS);
__FILE__, BOSS, g);
theCommands.Add("offsetshapesimple",
"offsetshapesimple result shape offsetvalue [solid] [tolerance=1e-7]",
__FILE__, ComputeSimpleOffset);
__FILE__, ComputeSimpleOffset, g);
}

View File

@ -757,15 +757,15 @@ void BRepTest::FilletCommands(Draw_Interpretor& theCommands)
theCommands.Add("rollingball",
"rollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
__FILE__,
rollingball);
rollingball, g);
theCommands.Add("brollingball",
"brollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
__FILE__,
rollingball);
rollingball, g);
theCommands.Add("trollingball",
"trollingball r S radius [stopf1 ..] @ [f1 f2 ..] @ [e1 ..]",
__FILE__,
rollingball);
rollingball, g);
}

View File

@ -1709,8 +1709,6 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
"setflags shape_name flag1[flag2...]\n sets flags for shape(free, modified, checked, orientable, closed, infinite, convex, locked), for example <setflags a free> or <setflags a -free> if necessary unflag ",
__FILE__,setFlags,g);
// theCommands.Add("dumpmmgt",
// "dump le contenu du gestionnaire de memoire",__FILE__,dumpmmgt,g);
theCommands.Add("purgemmgt",
"returns the free memory from the system to the memory manager",
__FILE__,purgemmgt,g);
@ -1722,7 +1720,7 @@ void DBRep::BasicCommands(Draw_Interpretor& theCommands)
"\n\t\t +|-t : switch on/off output to tcl of Progress Indicator"
"\n\t\t +|-c : switch on/off output to cout of Progress Indicator"
"\n\t\t +|-g : switch on/off graphical mode of Progress Indicator",
XProgress,"DE: General");
__FILE__, XProgress,"DE: General");
theCommands.Add("writebrep",
"writebrep shape filename [-binary {0|1}]=0 [-version Version]=4"
"\n\t\t: [-triangles {0|1}]=1 [-normals {0|1}]=0"

View File

@ -316,14 +316,11 @@ void Draw_Interpretor::add (const Standard_CString theCommandName,
{
Standard_ASSERT_RAISE (myInterp != NULL, "Attempt to add command to Null interpretor");
Standard_PCharacter aName = (Standard_PCharacter )theCommandName;
Standard_PCharacter aHelp = (Standard_PCharacter )theHelp;
Standard_PCharacter aGroup = (Standard_PCharacter )theGroup;
Tcl_CreateCommand (myInterp, aName, CommandCmd, (ClientData )theCallback, CommandDelete);
Tcl_CreateCommand (myInterp, theCommandName, CommandCmd, (ClientData )theCallback, CommandDelete);
// add the help
Tcl_SetVar2 (myInterp, "Draw_Helps", aName, aHelp, TCL_GLOBAL_ONLY);
Tcl_SetVar2 (myInterp, "Draw_Groups", aGroup, aName,
Tcl_SetVar2 (myInterp, "Draw_Helps", theCommandName, theHelp, TCL_GLOBAL_ONLY);
Tcl_SetVar2 (myInterp, "Draw_Groups", theGroup, theCommandName,
TCL_GLOBAL_ONLY | TCL_APPEND_VALUE | TCL_LIST_ELEMENT);
// add path to source file (keep not more than two last subdirectories)
@ -344,8 +341,10 @@ void Draw_Interpretor::add (const Standard_CString theCommandName,
TCollection_AsciiString aSrcPath;
aPath.SystemName (aSrcPath);
if (aSrcPath.Value(1) == '/')
{
aSrcPath.Remove(1);
Tcl_SetVar2 (myInterp, "Draw_Files", aName, aSrcPath.ToCString(), TCL_GLOBAL_ONLY);
}
Tcl_SetVar2 (myInterp, "Draw_Files", theCommandName, aSrcPath.ToCString(), TCL_GLOBAL_ONLY);
}
//=======================================================================

View File

@ -1819,7 +1819,8 @@ void GeometryTest::CurveCommands(Draw_Interpretor& theCommands)
theCommands.Add("projonplane",
"projonplane r C3d Plane [dx dy dz] [0/1]",
projonplane);
__FILE__,
projonplane, g);
theCommands.Add("bisec",
"bisec result line/circle/point line/circle/point",

View File

@ -1267,7 +1267,7 @@ void QABugs::Commands_3(Draw_Interpretor& theCommands) {
theCommands.Add("BUC60856","BUC60856",__FILE__,BUC60856,group);
theCommands.Add("coordload","load coord from file",__FILE__,coordload);
theCommands.Add("coordload","load coord from file",__FILE__,coordload,group);
theCommands.Add("TestMem","TestMem",__FILE__,TestMem,group);
theCommands.Add("BUC60945","BUC60945",__FILE__,TestMem,group);

View File

@ -6590,7 +6590,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
"\n\t\t: -highmode Sets hilight mode for objects."
"\n\t\t: -redisplay Recomputes presentation of objects."
"\n\t\t: -noecho Avoid printing of command results."
"\n\t\t: -autoTriang Enable/disable auto-triangulation for displayed shape."
"\n\t\t: -autoTriang Enable/disable auto-triangulation for displayed shape.",
__FILE__, VDisplay2, group);
theCommands.Add ("vnbdisplayed",
@ -6863,12 +6863,12 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
theCommands.Add("vtexrepeat",
"vtexrepeat name RepeatU RepeatV"
"\n\t\t: Alias for vtexture name -setRepeat RepeatU RepeatV.",
VTexture,group);
__FILE__, VTexture, group);
theCommands.Add("vtexdefault",
"vtexdefault name"
"\n\t\t: Alias for vtexture name -default.",
VTexture,group);
__FILE__, VTexture, group);
theCommands.Add("vstate",
"vstate [-entities] [-hasSelected] [name1] ... [nameN]"
@ -6885,7 +6885,7 @@ void ViewerTest::Commands(Draw_Interpretor& theCommands)
theCommands.Add("vtypes",
"vtypes : list of known types and signatures in AIS - To be Used in vpickobject command for selection with filters",
VIOTypes,group);
__FILE__, VIOTypes, group);
theCommands.Add("vselfilter",
"vselfilter [-contextfilter {AND|OR}]"

View File

@ -13729,7 +13729,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
"\n\t\t: for example '+Z' will show front of the model,"
"\n\t\t: '-X-Y+Z' will define left axonometrical view."
"\n\t\t: -frame define camera Up and Right directions (regardless Up convention);"
"\n\t\t: for example '+X+Z' will show front of the model with Z-up."
"\n\t\t: for example '+X+Z' will show front of the model with Z-up.",
__FILE__,VViewProj,group);
theCommands.Add("vtop" ,
"vtop or <T> : Top view. Orientation +X+Y" ,
@ -13754,7 +13754,7 @@ void ViewerTest::ViewerCommands(Draw_Interpretor& theCommands)
__FILE__,VViewProj,group);
theCommands.Add("vpick" ,
"vpick : vpick X Y Z [shape subshape] ( all variables as string )",
VPick,group);
__FILE__, VPick, group);
theCommands.Add("vfit",
"vfit or <F> [-selected] [-noupdate]"
"\n\t\t: [-selected] fits the scene according to bounding box of currently selected objects",

View File

@ -3075,7 +3075,7 @@ void XDEDRAW_GDTs::InitCommands(Draw_Interpretor& di)
di.Add("XGetGDTAffectedPlane", "XGetGDTAffectedPlane Doc GDT_Label Plane"
"Returns affected plane into Plane",
__FILE__, getGDTAffectedPlane, g);
di.Add("XGetGDTSemanticName", "XGetGDTSemanticName Doc GDT_Label"
di.Add("XGetGDTSemanticName", "XGetGDTSemanticName Doc GDT_Label",
__FILE__, getGDTSemanticName, g);
di.Add("XSetGDTSemanticName", "XSetGDTSemanticName Doc GDT_Label Name"

View File

@ -123,23 +123,34 @@ void XSDRAW::LoadDraw (Draw_Interpretor& theCommands)
XSDRAW::RemoveCommand("exit");
// if (!getenv("WBHOSTTOP")) XSDRAW::RemoveCommand("xsnew");
Handle(TColStd_HSequenceOfAsciiString) list =
IFSelect_Activator::Commands(0);
TCollection_AsciiString com;
Standard_Integer i, nb = list->Length();
for (i = 1; i <= nb; i ++) {
Handle(IFSelect_Activator) act;
Standard_Integer nact, num = -1;
char help[200];
com = list->Value(i);
Handle(TColStd_HSequenceOfAsciiString) list = IFSelect_Activator::Commands (0);
for (TColStd_HSequenceOfAsciiString::Iterator aCmdIter (*list); aCmdIter.More(); aCmdIter.Next())
{
Standard_Integer num = -1;
const TCollection_AsciiString& aCmd = aCmdIter.Value();
if (!theolds.IsEmpty())
theolds.Find(com, num);
if (num == 0) continue;
if (!IFSelect_Activator::Select(com.ToCString(),nact,act))
Sprintf (help,"type : xhelp %s for help",com.ToCString());
else if (!act.IsNull()) strcpy(help,act->Help(nact));
if (num < 0) theCommands.Add (com.ToCString(),help,XSTEPDRAWRUN,act->Group());
else theCommands.Add (thenews->Value(num).ToCString(),help,XSTEPDRAWRUN,act->Group());
{
theolds.Find (aCmd, num);
}
if (num == 0)
{
continue;
}
Standard_Integer nact = 0;
Handle(IFSelect_Activator) anAct;
TCollection_AsciiString aHelp;
if (!IFSelect_Activator::Select (aCmd.ToCString(), nact, anAct))
{
aHelp = TCollection_AsciiString("type : xhelp ") + aCmd + " for help";
}
else if (!anAct.IsNull())
{
aHelp = anAct->Help (nact);
}
const TCollection_AsciiString& aCmdName = num < 0 ? aCmd : thenews->Value (num);
theCommands.Add (aCmdName.ToCString(), aHelp.ToCString(), "", XSTEPDRAWRUN, anAct->Group());
}
}