mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0024263: TNaming_CopyShape::CopyTool failure
Test case for issue CR24263
This commit is contained in:
parent
51b10cd466
commit
659b232a7c
@ -31,6 +31,7 @@
|
|||||||
#include <TopExp_Explorer.hxx>
|
#include <TopExp_Explorer.hxx>
|
||||||
#include <TCollection_AsciiString.hxx>
|
#include <TCollection_AsciiString.hxx>
|
||||||
#include <TopAbs.hxx>
|
#include <TopAbs.hxx>
|
||||||
|
#include <TNaming_CopyShape.hxx>
|
||||||
#include <TNaming_Translator.hxx>
|
#include <TNaming_Translator.hxx>
|
||||||
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
|
||||||
#include <DNaming_DataMapOfShapeOfName.hxx>
|
#include <DNaming_DataMapOfShapeOfName.hxx>
|
||||||
@ -146,6 +147,61 @@ static Standard_Integer DNaming_TCopyShape (Draw_Interpretor& di,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : DNaming_TCopyTool
|
||||||
|
//purpose : CopyTool Shape1 [Shape2 ...]
|
||||||
|
// - for test TNaming_CopyShape::CopyTool mechanism
|
||||||
|
//=======================================================================
|
||||||
|
|
||||||
|
static Standard_Integer DNaming_TCopyTool (Draw_Interpretor& di,
|
||||||
|
Standard_Integer nb,
|
||||||
|
const char** arg)
|
||||||
|
{
|
||||||
|
if (nb < 2) {
|
||||||
|
di << "Usage: CopyTool Shape1 [Shape2] ..." << "\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Standard_Integer i;
|
||||||
|
TCollection_AsciiString aCopyNames;
|
||||||
|
BRep_Builder aBuilder;
|
||||||
|
TColStd_IndexedDataMapOfTransientTransient aMap;
|
||||||
|
TopoDS_Shape aResult;
|
||||||
|
|
||||||
|
for (i = 1; i < nb; i++) {
|
||||||
|
TopoDS_Shape aShape = DBRep::Get(arg[i]);
|
||||||
|
|
||||||
|
if (aShape.IsNull()) {
|
||||||
|
BRepTools::Read(aShape, arg[i], aBuilder);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aShape.IsNull()) {
|
||||||
|
di << arg[i] << " is neither a shape nor a BREP file. Skip it." << "\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform copying.
|
||||||
|
TNaming_CopyShape::CopyTool(aShape, aMap, aResult);
|
||||||
|
|
||||||
|
// Draw result.
|
||||||
|
TCollection_AsciiString aName(arg[i]);
|
||||||
|
|
||||||
|
aName.AssignCat("_c");
|
||||||
|
DBRep::Set(aName.ToCString(), aResult);
|
||||||
|
|
||||||
|
// Compose all names of copies.
|
||||||
|
if (!aCopyNames.IsEmpty()) {
|
||||||
|
aCopyNames.AssignCat(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
aCopyNames.AssignCat(aName);
|
||||||
|
}
|
||||||
|
|
||||||
|
di << aCopyNames.ToCString() << "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : ToolsCommands
|
//function : ToolsCommands
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -163,6 +219,10 @@ void DNaming::ToolsCommands (Draw_Interpretor& theCommands)
|
|||||||
"CopyShape (Shape1 [Shape2] ...)",
|
"CopyShape (Shape1 [Shape2] ...)",
|
||||||
__FILE__, DNaming_TCopyShape, g);
|
__FILE__, DNaming_TCopyShape, g);
|
||||||
|
|
||||||
|
theCommands.Add ("CopyTool",
|
||||||
|
"CopyTool Shape1 [Shape2] ...",
|
||||||
|
__FILE__, DNaming_TCopyTool, g);
|
||||||
|
|
||||||
theCommands.Add ("CheckSame",
|
theCommands.Add ("CheckSame",
|
||||||
"CheckSame (Shape1 Shape2 ExploMode[F|E|V])",
|
"CheckSame (Shape1 Shape2 ExploMode[F|E|V])",
|
||||||
__FILE__, DNaming_CheckHasSame, g);
|
__FILE__, DNaming_CheckHasSame, g);
|
||||||
|
@ -51,6 +51,7 @@ void TNaming_CopyShape::Translate( const TopoDS_Shape& aShape,
|
|||||||
TopoDS_Shape& aResult,
|
TopoDS_Shape& aResult,
|
||||||
const Handle(TNaming_TranslateTool)& TrTool)
|
const Handle(TNaming_TranslateTool)& TrTool)
|
||||||
{
|
{
|
||||||
|
aResult.Nullify();
|
||||||
|
|
||||||
if (aShape.IsNull()) return;
|
if (aShape.IsNull()) return;
|
||||||
|
|
||||||
|
12
tests/bugs/caf/bug24263_2
Normal file
12
tests/bugs/caf/bug24263_2
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
puts "=========="
|
||||||
|
puts "OCC24263"
|
||||||
|
puts "=========="
|
||||||
|
puts ""
|
||||||
|
###################################################
|
||||||
|
# TNaming_CopyShape::CopyTool failure
|
||||||
|
###################################################
|
||||||
|
|
||||||
|
box b 100 100 100
|
||||||
|
explode b F
|
||||||
|
|
||||||
|
CopyTool b_1 b
|
Loading…
x
Reference in New Issue
Block a user