diff --git a/dox/dev_guides/debug/debug.md b/dox/dev_guides/debug/debug.md index cf0ac3317e..c0984673ea 100644 --- a/dox/dev_guides/debug/debug.md +++ b/dox/dev_guides/debug/debug.md @@ -62,6 +62,14 @@ Sets the specified shape as a value of DRAW interpreter variable with the given - *theNameStr* -- the DRAW interpreter variable name to set. - *theShapePtr* -- a pointer to *TopoDS_Shape* variable. +~~~~~ +const char* DBRep_SetComp (const char* theNameStr, void* theListPtr) +~~~~~ + +Makes a compound from the specified list of shapes and sets it as a value of DRAW interpreter variable with the given name. +- *theNameStr* -- the DRAW interpreter variable name to set. +- *theListPtr* -- a pointer to *TopTools_ListOfShape* variable. + ~~~~~ const char* DrawTrSurf_Set (const char* theNameStr, void* theHandlePtr) const char* DrawTrSurf_SetPnt (const char* theNameStr, void* thePntPtr) @@ -140,6 +148,7 @@ For convenience it is possible to define aliases to commands in this window, for ~~~~~ >alias deval ? ({,,TKDraw}Draw_Eval) >alias dsetshape ? ({,,TKDraw}DBRep_Set) +>alias dsetcomp ? ({,,TKDraw}DBRep_SetComp) >alias dsetgeom ? ({,,TKDraw}DrawTrSurf_Set) >alias dsetpnt ? ({,,TKDraw}DrawTrSurf_SetPnt) >alias dsetpnt2d ? ({,,TKDraw}DrawTrSurf_SetPnt2d) diff --git a/src/DBRep/DBRep_Debug.cxx b/src/DBRep/DBRep_Debug.cxx index c545b7f5ed..b2ff8cc3cc 100644 --- a/src/DBRep/DBRep_Debug.cxx +++ b/src/DBRep/DBRep_Debug.cxx @@ -17,6 +17,9 @@ #include #include #include +#include +#include +#include // This file defines global functions not declared in any public header, // intended for use from debugger prompt (Command Window in Visual Studio) @@ -38,6 +41,39 @@ Standard_EXPORT const char* DBRep_Set (const char* theNameStr, void* theShapePtr } } +//======================================================================= +//function : DBRep_SetComp +//purpose : make compound from the given list of shapes +//======================================================================= +Standard_EXPORT const char* DBRep_SetComp(const char* theNameStr, void* theListPtr) +{ + if (theNameStr == 0 || theListPtr == 0) + { + return "Error: name or list of shapes is null"; + } + try { + TopTools_ListOfShape *pLS; + pLS = (TopTools_ListOfShape *)theListPtr; + + TopoDS_Compound aC; + BRep_Builder aBB; + TopTools_ListIteratorOfListOfShape aIt; + + aBB.MakeCompound(aC); + aIt.Initialize(*pLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE = aIt.Value(); + aBB.Add(aC, aE); + } + DBRep::Set(theNameStr, aC); + return theNameStr; + } + catch (Standard_Failure) + { + return Standard_Failure::Caught()->GetMessageString(); + } +} + // MSVC debugger cannot deal correctly with functions whose argunments // have non-standard types. Here we define alternative to the above functions // with good types with the hope that GDB on Linux or other debugger could