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.
16 #include <BRep_Builder.hxx>
17 #include <BRepTools.hxx>
20 #include <Draw_ProgressIndicator.hxx>
21 #include <Draw_Window.hxx>
22 #include <gp_Trsf.hxx>
23 #include <ShapeProcess_OperLibrary.hxx>
24 #include <SWDRAW_ShapeAnalysis.hxx>
25 #include <SWDRAW_ShapeCustom.hxx>
26 #include <SWDRAW_ShapeExtend.hxx>
27 #include <SWDRAW_ShapeFix.hxx>
28 #include <SWDRAW_ShapeProcess.hxx>
29 #include <SWDRAW_ShapeProcessAPI.hxx>
30 #include <SWDRAW_ShapeTool.hxx>
31 #include <SWDRAW_ShapeUpgrade.hxx>
33 //#72 rln 09.03.99 Packaging of SWDRAW
34 // for NSPApply -- CKY 12 JUL 2001
35 static int dejadraw = 0;
37 //#72 rln 09.03.99 Packaging of SWDRAW
39 //=======================================================================
42 //=======================================================================
44 static Standard_Integer LocSet (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
47 di << argv[0] << "LocSet a [b [c]]: set location for shape \"a\":\n";
48 di << "- to Null if one argument is given\n";
49 di << "- to location of shape b if two arguments are given\n";
50 di << "- to difference of locations of shapes b and c if three arguments are given\n";
54 TopoDS_Shape a = DBRep::Get ( argv[1] );
56 di << "No shape named \"" << argv[1] << "\" found\n";
61 TopoDS_Shape b = DBRep::Get ( argv[2] );
63 di << "No shape named \"" << argv[2] << "\" found\n";
67 TopoDS_Shape c = DBRep::Get ( argv[3] );
69 di << "No shape named \"" << argv[3] << "\" found\n";
72 L = b.Location().Multiplied ( c.Location().Inverted() );
74 else L = b.Location();
77 DBRep::Set ( argv[1], a );
82 //=======================================================================
85 //=======================================================================
87 static Standard_Integer LocDump (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
90 di << argv[0] << "LocDump a: dump location of shape \"a\"\n";
94 TopoDS_Shape a = DBRep::Get ( argv[1] );
96 di << "No shape named \"" << argv[1] << "\" found\n";
100 TopLoc_Location L = a.Location();
101 di << "Location of shape " << argv[1] << ":\n";
102 di << "Results in:\n";
103 gp_Trsf T = L.Transformation();
104 TopLoc_Location l ( T );
105 Standard_SStream aSStream;
106 l.ShallowDump ( aSStream );
112 //=======================================================================
115 //=======================================================================
117 void SWDRAW::Init (Draw_Interpretor& theCommands)
123 SWDRAW_ShapeTool::InitCommands (theCommands);
124 SWDRAW_ShapeAnalysis::InitCommands (theCommands);
125 SWDRAW_ShapeCustom::InitCommands (theCommands);
126 SWDRAW_ShapeExtend::InitCommands (theCommands);
127 SWDRAW_ShapeFix::InitCommands (theCommands);
128 SWDRAW_ShapeUpgrade::InitCommands (theCommands);
129 SWDRAW_ShapeProcess::InitCommands (theCommands);
130 SWDRAW_ShapeProcessAPI::InitCommands (theCommands);
133 theCommands.Add("LocSet", "a [b [c]]: set loc b->a; use no args to get help",__FILE__,LocSet,"essai");
134 theCommands.Add("LocDump", "a: dump location of a",__FILE__,LocDump,"essai");
136 // register operators for ShapeProcessing
137 ShapeProcess_OperLibrary::Init();
141 //=======================================================================
142 //function : GroupName
144 //=======================================================================
146 Standard_CString SWDRAW::GroupName()
148 return "Shape Healing";