1 // File: BRepTest_ShellCommands.cxx
2 // Created: Mon Dec 21 10:19:27 1998
3 // Author: Michael KAZAKOV
4 // <mko@vladox.nnov.matra-dtv.fr>
7 #include <BRepTest.hxx>
8 #include <Draw_Interpretor.hxx>
9 #include <Draw_Appli.hxx>
11 #include <BRepTools.hxx>
12 #include <BRepOffset.hxx>
13 #include <BRepOffsetAPI_MakeThickSolid.hxx>
14 #include <TopTools_ListOfShape.hxx>
15 #include <TopoDS_Shape.hxx>
16 #include <TopExp_Explorer.hxx>
18 #include <BRep_Tool.hxx>
20 #include <TopExp_Explorer.hxx>
22 #include <TopoDS_Face.hxx>
28 static Standard_Boolean issame(TopoDS_Face& face, TopoDS_Face& newface)
30 TopExp_Explorer exp(face,TopAbs_VERTEX),newexp(newface,TopAbs_VERTEX);
31 Standard_Integer newcounter=0,counter=0;
32 for (;exp.More();exp.Next())
35 gp_Pnt p(BRep_Tool::Pnt(TopoDS::Vertex(exp.Current())));
36 for (;newexp.More();newexp.Next())
38 gp_Pnt newp(BRep_Tool::Pnt(TopoDS::Vertex(newexp.Current())));
39 if (p.IsEqual(newp,1e-7))
46 if (counter==newcounter)
48 return Standard_False;
51 static TopoDS_Face findface(TopoDS_Shape& shape, TopoDS_Face& face)
54 TopExp_Explorer exp(shape,TopAbs_FACE);
55 for (;exp.More();exp.Next())
57 newface = TopoDS::Face(exp.Current());
58 if (issame(face,newface))
66 static Standard_Integer shell(Draw_Interpretor& di, Standard_Integer n, const char** a)
68 TopoDS_Shape Shape = DBRep::Get(a[1]);
69 TopTools_ListOfShape ListOfCorks;
70 //cout <<"You have "<<n-2<<" of the reference faces" << endl;
71 di <<"You have "<<n-2<<" of the reference faces" << "\n";
75 //cout <<i-1<<"th element"<< endl;
76 di <<i-1<<"th element"<< "\n";
77 // ListOfCorks.Append(findface(Shape,TopoDS::Face(DBRep::Get(a[i]))));
78 TopoDS_Shape aLocalFace(DBRep::Get(a[i]));
79 ListOfCorks.Append(findface(Shape,(TopoDS_Face &) TopoDS::Face(aLocalFace)));
80 // ListOfCorks.Append(findface(Shape,(TopoDS_Face &) TopoDS::Face(DBRep::Get(a[i]))));
82 Standard_Real Tol = 1e-5;
83 Standard_Real OffsetValue = 1;
84 OffsetValue = -OffsetValue; // Offset > 0 = Interior.
85 BRepOffsetAPI_MakeThickSolid MKTS (Shape,
92 DBRep::Set("Result.brep",MKTS.Shape());
93 TopTools_ListOfShape Larg;
95 //Check if the shape has at least one face
96 TopExp_Explorer FExp (MKTS.Shape (), TopAbs_FACE);
98 //cout << "Standard_True"<<endl;
99 di << "Standard_True"<<"\n";
101 DBRep::Set("S",MKTS.Shape());
104 /*********************************************************************************/
106 void BRepTest::ShellCommands(Draw_Interpretor& theCommands)
108 static Standard_Boolean loaded = Standard_False;
110 loaded = Standard_True;
112 const char* g = "Projection of wire commands";
114 theCommands.Add("shell","Make shell on bugged object",