d4faf9e9 |
1 | // Created on: 1994-07-25 |
2 | // Created by: Remi LEQUETTE |
3 | // Copyright (c) 1994-1999 Matra Datavision |
4 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
938bb740 |
8 | // This library is free software; you can redistribute it and/or modify it under |
9 | // the terms of the GNU Lesser General Public License version 2.1 as published |
d4faf9e9 |
10 | // by the Free Software Foundation, with special exception defined in the file |
11 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | // distribution for complete text of the license and disclaimer of any warranty. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #include <BRepTools.hxx> |
18 | #include <Standard_ErrorHandler.hxx> |
19 | #include <Standard_Failure.hxx> |
20 | #include <TopTools_LocationSet.hxx> |
21 | |
22 | // This file defines global functions not declared in any public header, |
23 | // intended for use from debugger prompt (Command Window in Visual Studio) |
24 | |
25 | //! Save shape to file |
26 | const char* BRepTools_Write (const char* theFileStr, void* theShapePtr) |
27 | { |
28 | if (theFileStr == 0 || theShapePtr == 0) |
29 | { |
30 | return "Error: name or shape is null"; |
31 | } |
32 | try { |
33 | OCC_CATCH_SIGNALS |
34 | if (BRepTools::Write (*(TopoDS_Shape*)theShapePtr, theFileStr)) |
35 | return theFileStr; |
36 | else |
37 | return "Error: write failed"; |
38 | } |
9775fa61 |
39 | catch (Standard_Failure const& anException) |
d4faf9e9 |
40 | { |
9775fa61 |
41 | return anException.GetMessageString(); |
d4faf9e9 |
42 | } |
43 | } |
44 | |
45 | //! Dump shape to cout |
46 | const char* BRepTools_Dump (void* theShapePtr) |
47 | { |
48 | if (theShapePtr == 0) |
49 | { |
50 | return "Error: name or shape is null"; |
51 | } |
52 | try { |
53 | OCC_CATCH_SIGNALS |
54 | |
55 | cout <<"\n\n"; |
56 | BRepTools::Dump (*(TopoDS_Shape*)theShapePtr, cout); |
57 | cout << endl; |
58 | |
59 | return "Shape dumped to cout"; |
60 | } |
9775fa61 |
61 | catch (Standard_Failure const& anException) |
d4faf9e9 |
62 | { |
9775fa61 |
63 | return anException.GetMessageString(); |
d4faf9e9 |
64 | } |
65 | } |
66 | |
67 | //! Dump shape location to cout |
68 | const char* BRepTools_DumpLoc (void* theLocationPtr) |
69 | { |
70 | if (theLocationPtr == 0) |
71 | { |
72 | return "Error: name or shape is null"; |
73 | } |
74 | try { |
75 | OCC_CATCH_SIGNALS |
76 | |
77 | cout <<"\n\n"; |
78 | TopTools_LocationSet LS; |
79 | LS.Add(*(TopLoc_Location*)theLocationPtr); |
80 | LS.Dump(cout); |
81 | cout <<endl; |
82 | |
83 | return "Location dumped to cout"; |
84 | } |
9775fa61 |
85 | catch (Standard_Failure const& anException) |
d4faf9e9 |
86 | { |
9775fa61 |
87 | return anException.GetMessageString(); |
d4faf9e9 |
88 | } |
89 | } |
90 | |
91 | // MSVC debugger cannot deal correctly with functions whose argunments |
92 | // have non-standard types. Here we define alternative to the above functions |
93 | // with good types with the hope that GDB on Linux or other debugger could |
94 | // work with them (DBX could, on SUN Solaris). |
95 | #ifndef _MSC_VER |
96 | |
97 | const char* BRepTools_Write (const char* theFileNameStr, const TopoDS_Shape& theShape) |
98 | { |
99 | return BRepTools_Write (theFileNameStr, (void*)&theShape); |
100 | } |
101 | |
102 | const char* BRepTools_Dump (const TopoDS_Shape& theShape) |
103 | { |
104 | return BRepTools_Dump ((void*)&theShape); |
105 | } |
106 | |
107 | const char* BRepTools_DumpLoc (const TopoDS_Shape& theShape) |
108 | { |
109 | return BRepTools_DumpLoc ((void*)&theShape); |
110 | } |
111 | |
112 | #endif |