1 // Created on: 1998-03-03
2 // Created by: Didier PIFFAULT
3 // Copyright (c) 1998-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <GeometryTest.hxx>
18 #include <DrawTrSurf.hxx>
19 #include <Draw_Appli.hxx>
20 #include <TopoDS_Shape.hxx>
22 #include <Draw_Interpretor.hxx>
23 #include <BRepProj_Projection.hxx>
24 #include <TopExp_Explorer.hxx>
25 #include <BRepTest.hxx>
29 //=======================================================================
31 //purpose : Draw command for Conical and Cylindrical projection
32 //=======================================================================
33 static Standard_Integer prj(Draw_Interpretor& di, Standard_Integer n, const char** a)
41 TopoDS_Shape anInputWire = DBRep::Get(a[2]);
42 TopoDS_Shape anInputShape = DBRep::Get(a[3]);
43 if (anInputWire.IsNull() || anInputShape.IsNull())
45 di << "Null input shapes\n";
49 Standard_Real X = Draw::Atof(a[4]),
53 Standard_Boolean bCylProj = !strcmp(a[0], "prj");
55 BRepProj_Projection aPrj = bCylProj ?
56 BRepProj_Projection(anInputWire, anInputShape, gp_Dir(X, Y, Z)) :
57 BRepProj_Projection(anInputWire, anInputShape, gp_Pnt(X, Y, Z));
65 for (Standard_Integer i = 1; aPrj.More(); aPrj.Next(), ++i)
68 Sprintf(name, "%s_%d", a[1], i);
69 DBRep::Set(name, aPrj.Current());
77 /*********************************************************************************/
79 void BRepTest::ProjectionCommands(Draw_Interpretor& theCommands)
81 static Standard_Boolean loaded = Standard_False;
83 loaded = Standard_True;
85 const char* g = "Projection of wire commands";
87 theCommands.Add("prj","prj result w s x y z: "
88 "Cylindrical projection of w (wire or edge) on s (faces) along direction.\n",
91 theCommands.Add("cprj","cprj result w s x y z: "
92 "Conical projection of w (wire or edge) on s (faces).\n",