#include <TopExp_Explorer.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopAbs.hxx>
+#include <TNaming_CopyShape.hxx>
#include <TNaming_Translator.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfShapeShape.hxx>
#include <DNaming_DataMapOfShapeOfName.hxx>
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
//purpose :
"CopyShape (Shape1 [Shape2] ...)",
__FILE__, DNaming_TCopyShape, g);
+ theCommands.Add ("CopyTool",
+ "CopyTool Shape1 [Shape2] ...",
+ __FILE__, DNaming_TCopyTool, g);
+
theCommands.Add ("CheckSame",
"CheckSame (Shape1 Shape2 ExploMode[F|E|V])",
__FILE__, DNaming_CheckHasSame, g);