0033661: Data Exchange, Step Import - Tessellated GDTs are not imported
[occt.git] / src / BRepTest / BRepTest_ProjectionCommands.cxx
CommitLineData
b311480e 1// Created on: 1998-03-03
2// Created by: Didier PIFFAULT
3// Copyright (c) 1998-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
7fd59977 16
7fd59977 17#include <Draw_Appli.hxx>
7fd59977 18#include <DBRep.hxx>
19#include <Draw_Interpretor.hxx>
20#include <BRepProj_Projection.hxx>
7fd59977 21#include <BRepTest.hxx>
57c28b61 22
03cca6f7 23//=======================================================================
24//function : prj
25//purpose : Draw command for Conical and Cylindrical projection
26//=======================================================================
7fd59977 27static Standard_Integer prj(Draw_Interpretor& di, Standard_Integer n, const char** a)
03cca6f7 28{
29 if (n != 7)
30 {
31 di.PrintHelp(a[0]);
32 return 1;
7fd59977 33 }
03cca6f7 34 //
35 TopoDS_Shape anInputWire = DBRep::Get(a[2]);
36 TopoDS_Shape anInputShape = DBRep::Get(a[3]);
37 if (anInputWire.IsNull() || anInputShape.IsNull())
38 {
39 di << "Null input shapes\n";
40 return 1;
7fd59977 41 }
03cca6f7 42 //
43 Standard_Real X = Draw::Atof(a[4]),
44 Y = Draw::Atof(a[5]),
45 Z = Draw::Atof(a[6]);
46 //
47 Standard_Boolean bCylProj = !strcmp(a[0], "prj");
48 //
49 BRepProj_Projection aPrj = bCylProj ?
50 BRepProj_Projection(anInputWire, anInputShape, gp_Dir(X, Y, Z)) :
51 BRepProj_Projection(anInputWire, anInputShape, gp_Pnt(X, Y, Z));
52 //
53 if (!aPrj.IsDone())
54 {
55 di << "Not done\n";
56 return 0;
57 }
58 //
59 for (Standard_Integer i = 1; aPrj.More(); aPrj.Next(), ++i)
60 {
61 char name[255];
62 Sprintf(name, "%s_%d", a[1], i);
63 DBRep::Set(name, aPrj.Current());
64 di << name << " ";
65 }
66 //
67 di << "\n";
7fd59977 68 return 0;
69}
70
7fd59977 71/*********************************************************************************/
72
03cca6f7 73void BRepTest::ProjectionCommands(Draw_Interpretor& theCommands)
7fd59977 74{
75 static Standard_Boolean loaded = Standard_False;
76 if (loaded) return;
77 loaded = Standard_True;
78
79 const char* g = "Projection of wire commands";
80
03cca6f7 81 theCommands.Add("prj","prj result w s x y z: "
82 "Cylindrical projection of w (wire or edge) on s (faces) along direction.\n",
83 __FILE__, prj, g);
84 //
85 theCommands.Add("cprj","cprj result w s x y z: "
86 "Conical projection of w (wire or edge) on s (faces).\n",
87 __FILE__, prj, g);
7fd59977 88}