Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1993-06-14 |
2 | // Created by: Jean Yves LEBEY | |
3 | // Copyright (c) 1993-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 | |
e520f87c | 18 | #include <BRep_Builder.hxx> |
42cf5bc1 | 19 | #include <BRep_Tool.hxx> |
20 | #include <gp_Pnt.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> | |
e520f87c | 44 | |
0797d9d3 | 45 | #ifdef OCCT_DEBUG |
1d0a9d4d | 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(); | |
7fd59977 | 52 | #endif |
53 | ||
54 | //======================================================================= | |
55 | //function : BuildFaces | |
56 | //purpose : | |
57 | //======================================================================= | |
58 | void TopOpeBRepBuild_Builder::BuildFaces(const Standard_Integer iS, | |
59 | const Handle(TopOpeBRepDS_HDataStructure)& HDS) | |
60 | { | |
e520f87c P |
61 | Standard_Real aTBSTol, aTBCTol; |
62 | BRep_Builder aBB; | |
7fd59977 | 63 | TopoDS_Shape aFace; |
e520f87c P |
64 | // |
65 | //modified by NIZNHY-PKV Mon Dec 13 10:00:23 2010f | |
66 | const TopOpeBRepDS_Surface& aTBS=HDS->Surface(iS); | |
67 | aTBSTol=aTBS.Tolerance(); | |
68 | // | |
69 | myBuildTool.MakeFace(aFace, aTBS); | |
70 | // | |
71 | //myBuildTool.MakeFace(aFace,HDS->Surface(iS)); | |
72 | //modified by NIZNHY-PKV Mon Dec 13 10:01:03 2010t | |
73 | // | |
74 | TopOpeBRepBuild_WireEdgeSet WES(aFace, this); | |
75 | // | |
0797d9d3 | 76 | #ifdef OCCT_DEBUG |
7fd59977 | 77 | Standard_Boolean tSE = TopOpeBRepBuild_GettraceSPF(); |
7fd59977 | 78 | #endif |
e520f87c P |
79 | // |
80 | TopOpeBRepDS_CurveIterator SCurves(HDS->SurfaceCurves(iS)); | |
81 | for (; SCurves.More(); SCurves.Next()) { | |
7fd59977 | 82 | Standard_Integer iC = SCurves.Current(); |
83 | const TopOpeBRepDS_Curve& CDS = HDS->Curve(iC); | |
0797d9d3 | 84 | #ifdef OCCT_DEBUG |
7fd59977 | 85 | if (tSE) cout<<endl<<"BuildFaces : C "<<iC<<" on S "<<iS<<endl; |
7fd59977 | 86 | #endif |
87 | TopoDS_Shape anEdge; | |
e520f87c P |
88 | TopTools_ListIteratorOfListOfShape Iti(NewEdges(iC)); |
89 | for (; Iti.More(); Iti.Next()) { | |
7fd59977 | 90 | anEdge = Iti.Value(); |
e520f87c P |
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); | |
96 | } | |
97 | //modified by NIZNHY-PKV Mon Dec 13 10:09:43 2010f | |
7fd59977 | 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); | |
103 | } | |
104 | } | |
e520f87c | 105 | // |
7fd59977 | 106 | TopOpeBRepBuild_FaceBuilder FABU(WES,aFace); |
107 | TopTools_ListOfShape& FaceList = ChangeNewFaces(iS); | |
108 | MakeFaces(aFace,FABU,FaceList); | |
109 | } | |
110 | ||
111 | //======================================================================= | |
112 | //function : BuildFaces | |
113 | //purpose : | |
114 | //======================================================================= | |
115 | void TopOpeBRepBuild_Builder::BuildFaces(const Handle(TopOpeBRepDS_HDataStructure)& HDS) | |
116 | { | |
117 | Standard_Integer iS, n = HDS->NbSurfaces(); | |
118 | myNewFaces = new TopTools_HArray1OfListOfShape(0,n); | |
119 | for (iS = 1; iS <= n; iS++) BuildFaces(iS,HDS); | |
120 | } |