1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0027293: Add debug function to save a list of shapes into a compound

This commit is contained in:
msv
2016-03-21 18:45:29 +03:00
parent 73e5a645f3
commit 66d914e8ea
2 changed files with 45 additions and 0 deletions

View File

@@ -17,6 +17,9 @@
#include <DBRep.hxx>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
// 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