1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
19 #include <SWDRAW_ShapeTool.hxx>
20 #include <SWDRAW_ShapeAnalysis.hxx>
21 #include <SWDRAW_ShapeCustom.hxx>
22 #include <SWDRAW_ShapeExtend.hxx>
23 #include <SWDRAW_ShapeFix.hxx>
24 #include <SWDRAW_ShapeUpgrade.hxx>
25 #include <SWDRAW_ShapeProcess.hxx>
26 #include <SWDRAW_ShapeProcessAPI.hxx>
28 //#72 rln 09.03.99 Packaging of SWDRAW
30 #include <ShapeProcess_OperLibrary.hxx>
31 #include <BRepTools.hxx>
32 #include <Draw_Window.hxx>
33 #include <BRep_Builder.hxx>
34 #include <gp_Trsf.hxx>
36 // for NSPApply -- CKY 12 JUL 2001
38 #include <XSAlgo_AlgoContainer.hxx>
40 #include <Draw_ProgressIndicator.hxx>
42 static int dejadraw = 0;
44 //#72 rln 09.03.99 Packaging of SWDRAW
46 //=======================================================================
49 //=======================================================================
51 static Standard_Integer LocSet (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
54 di << argv[0] << "LocSet a [b [c]]: set location for shape \"a\":" << "\n";
55 di << "- to Null if one argument is given" << "\n";
56 di << "- to location of shape b if two arguments are given" << "\n";
57 di << "- to difference of locations of shapes b and c if three arguments are given" << "\n";
61 TopoDS_Shape a = DBRep::Get ( argv[1] );
63 di << "No shape named \"" << argv[1] << "\" found" << "\n";
68 TopoDS_Shape b = DBRep::Get ( argv[2] );
70 di << "No shape named \"" << argv[2] << "\" found" << "\n";
74 TopoDS_Shape c = DBRep::Get ( argv[3] );
76 di << "No shape named \"" << argv[3] << "\" found" << "\n";
79 L = b.Location().Multiplied ( c.Location().Inverted() );
81 else L = b.Location();
84 DBRep::Set ( argv[1], a );
89 //=======================================================================
92 //=======================================================================
94 static Standard_Integer LocDump (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
97 di << argv[0] << "LocDump a: dump location of shape \"a\"" << "\n";
101 TopoDS_Shape a = DBRep::Get ( argv[1] );
103 di << "No shape named \"" << argv[1] << "\" found" << "\n";
107 TopLoc_Location L = a.Location();
108 di << "Location of shape " << argv[1] << ":" << "\n";
109 // L.ShallowDump ( di );
110 di << "Results in:" << "\n";
111 gp_Trsf T = L.Transformation();
112 TopLoc_Location l ( T );
113 //l.ShallowDump ( di );
114 Standard_SStream aSStream;
115 l.ShallowDump ( aSStream );
121 //=======================================================================
124 //=======================================================================
126 void SWDRAW::Init (Draw_Interpretor& theCommands)
130 // DBRep::BasicCommands(theCommands);
131 // CKY 4-AOUT-1998 : pb avec GeomFill
132 // GeometryTest::AllCommands(theCommands);
133 // BRepTest::AllCommands(theCommands);
134 // MeshTest::Commands(theCommands);
137 SWDRAW_ShapeTool::InitCommands (theCommands);
138 SWDRAW_ShapeAnalysis::InitCommands (theCommands);
139 SWDRAW_ShapeCustom::InitCommands (theCommands);
140 SWDRAW_ShapeExtend::InitCommands (theCommands);
141 SWDRAW_ShapeFix::InitCommands (theCommands);
142 SWDRAW_ShapeUpgrade::InitCommands (theCommands);
143 SWDRAW_ShapeProcess::InitCommands (theCommands);
144 SWDRAW_ShapeProcessAPI::InitCommands (theCommands);
147 theCommands.Add("LocSet", "a [b [c]]: set loc b->a; use no args to get help",__FILE__,LocSet,"essai");
148 theCommands.Add("LocDump", "a: dump location of a",__FILE__,LocDump,"essai");
150 // register operators for ShapeProcessing
151 ShapeProcess_OperLibrary::Init();
155 //=======================================================================
156 //function : GroupName
158 //=======================================================================
160 Standard_CString SWDRAW::GroupName()
162 return "Shape Healing";