1 // Created on: 1993-06-14
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-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.
18 #include <BRep_Builder.hxx>
19 #include <BRep_Tool.hxx>
21 #include <Standard_NoSuchObject.hxx>
22 #include <TCollection_AsciiString.hxx>
23 #include <TopoDS_Edge.hxx>
24 #include <TopoDS_Face.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <TopoDS_Vertex.hxx>
27 #include <TopOpeBRepBuild_Builder.hxx>
28 #include <TopOpeBRepBuild_define.hxx>
29 #include <TopOpeBRepBuild_EdgeBuilder.hxx>
30 #include <TopOpeBRepBuild_FaceBuilder.hxx>
31 #include <TopOpeBRepBuild_GTopo.hxx>
32 #include <TopOpeBRepBuild_HBuilder.hxx>
33 #include <TopOpeBRepBuild_PaveSet.hxx>
34 #include <TopOpeBRepBuild_ShapeSet.hxx>
35 #include <TopOpeBRepBuild_ShellFaceSet.hxx>
36 #include <TopOpeBRepBuild_SolidBuilder.hxx>
37 #include <TopOpeBRepBuild_WireEdgeSet.hxx>
38 #include <TopOpeBRepDS_BuildTool.hxx>
39 #include <TopOpeBRepDS_CurveIterator.hxx>
40 #include <TopOpeBRepDS_HDataStructure.hxx>
41 #include <TopOpeBRepDS_PointIterator.hxx>
42 #include <TopOpeBRepDS_SurfaceIterator.hxx>
43 #include <TopOpeBRepTool_ShapeExplorer.hxx>
46 extern Standard_Boolean TopOpeBRepBuild_GettraceCU();
47 extern Standard_Boolean TopOpeBRepBuild_GettraceCUV();
48 extern Standard_Boolean TopOpeBRepBuild_GettraceSPF();
49 extern Standard_Boolean TopOpeBRepBuild_GettraceSPS();
50 extern Standard_Boolean TopOpeBRepBuild_GetcontextSF2();
51 extern Standard_Boolean TopOpeBRepBuild_GettraceSHEX();
54 //=======================================================================
55 //function : BuildFaces
57 //=======================================================================
58 void TopOpeBRepBuild_Builder::BuildFaces(const Standard_Integer iS,
59 const Handle(TopOpeBRepDS_HDataStructure)& HDS)
61 Standard_Real aTBSTol, aTBCTol;
65 //modified by NIZNHY-PKV Mon Dec 13 10:00:23 2010f
66 const TopOpeBRepDS_Surface& aTBS=HDS->Surface(iS);
67 aTBSTol=aTBS.Tolerance();
69 myBuildTool.MakeFace(aFace, aTBS);
71 //myBuildTool.MakeFace(aFace,HDS->Surface(iS));
72 //modified by NIZNHY-PKV Mon Dec 13 10:01:03 2010t
74 TopOpeBRepBuild_WireEdgeSet WES(aFace, this);
77 Standard_Boolean tSE = TopOpeBRepBuild_GettraceSPF();
80 TopOpeBRepDS_CurveIterator SCurves(HDS->SurfaceCurves(iS));
81 for (; SCurves.More(); SCurves.Next()) {
82 Standard_Integer iC = SCurves.Current();
83 const TopOpeBRepDS_Curve& CDS = HDS->Curve(iC);
85 if (tSE) cout<<endl<<"BuildFaces : C "<<iC<<" on S "<<iS<<endl;
88 TopTools_ListIteratorOfListOfShape Iti(NewEdges(iC));
89 for (; Iti.More(); Iti.Next()) {
91 //modified by NIZNHY-PKV Mon Dec 13 10:09:38 2010f
92 TopoDS_Edge& aE=*((TopoDS_Edge*)&anEdge);
93 aTBCTol=BRep_Tool::Tolerance(aE);
94 if (aTBCTol < aTBSTol) {
95 aBB.UpdateEdge(aE, aTBSTol);
97 //modified by NIZNHY-PKV Mon Dec 13 10:09:43 2010f
98 TopAbs_Orientation ori = SCurves.Orientation(TopAbs_IN);
99 myBuildTool.Orientation(anEdge,ori);
100 const Handle(Geom2d_Curve)& PC = SCurves.PCurve();
101 myBuildTool.PCurve(aFace,anEdge,CDS,PC);
102 WES.AddStartElement(anEdge);
106 TopOpeBRepBuild_FaceBuilder FABU(WES,aFace);
107 TopTools_ListOfShape& FaceList = ChangeNewFaces(iS);
108 MakeFaces(aFace,FABU,FaceList);
111 //=======================================================================
112 //function : BuildFaces
114 //=======================================================================
115 void TopOpeBRepBuild_Builder::BuildFaces(const Handle(TopOpeBRepDS_HDataStructure)& HDS)
117 Standard_Integer iS, n = HDS->NbSurfaces();
118 myNewFaces = new TopTools_HArray1OfListOfShape(0,n);
119 for (iS = 1; iS <= n; iS++) BuildFaces(iS,HDS);