1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
// File: BRepSweep_Trsf.cxx
// Created: Thu Jun 10 10:21:13 1993
// Author: Laurent BOURESCHE
// <lbo@phobox>
#include <BRepSweep_Trsf.ixx>
#include <Sweep_NumShapeIterator.hxx>
#include <BRepSweep_Iterator.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <BRep_Tool.hxx>
#include <BRepLProp.hxx>
#include <GeomAbs_Shape.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Face.hxx>
#include <TopExp.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Precision.hxx>
BRepSweep_Trsf::BRepSweep_Trsf(const BRep_Builder& aBuilder,
const TopoDS_Shape& aGenShape,
const Sweep_NumShape& aDirWire,
const TopLoc_Location& aLocation,
const Standard_Boolean aCopy):
BRepSweep_NumLinearRegularSweep(aBuilder,aGenShape,aDirWire),
myLocation(aLocation),
myCopy(aCopy)
{
}
void BRepSweep_Trsf::Delete()
{}
void BRepSweep_Trsf::Init()
{
if(!myCopy){
Sweep_NumShapeIterator It;
for(It.Init(myDirWire);It.More();It.Next()){
Process(myGenShape,It.Value());
}
}
}
Standard_Boolean BRepSweep_Trsf::Process(const TopoDS_Shape& aGenS,
const Sweep_NumShape& aDirV)
{
Standard_Boolean dotrsf = (aDirV.Index()==2 && !myDirWire.Closed());
Standard_Integer iD = myDirShapeTool.Index(aDirV);
Standard_Integer iG = myGenShapeTool.Index(aGenS);
if(IsInvariant(aGenS)){
myShapes(iG,iD) = aGenS;
myBuiltShapes(iG,iD) = Standard_True;
return Standard_True;
}
else{
BRepSweep_Iterator Jt;
Standard_Boolean touch = Standard_False;
for(Jt.Init(aGenS);Jt.More();Jt.Next()){
if(Process(Jt.Value(),aDirV)) touch = Standard_True;
}
if(!touch || !dotrsf){
TopoDS_Shape newShape = aGenS;
if(dotrsf) newShape.Move(myLocation);
myShapes(iG,iD) = newShape;
myBuiltShapes(iG,iD) = Standard_True;
}
return touch;
}
}
//=======================================================================
//function : SetContinuity
//purpose :
//=======================================================================
void BRepSweep_Trsf::SetContinuity(const TopoDS_Shape& aGenS,
const Sweep_NumShape& aDirS)
{
Standard_Real tl = Precision::Confusion(), tol3d;
//angular etant un peu severe pour les contours sketches.
Standard_Real ta = 0.00175;//environ 0.1 degre
GeomAbs_Shape cont;
BRep_Builder B = myBuilder.Builder();
if(aGenS.ShapeType() == TopAbs_EDGE){
if (HasShape(aGenS,aDirS)){
TopoDS_Edge E = TopoDS::Edge(aGenS);
BRepAdaptor_Curve e;
Standard_Real ud,uf;
TopoDS_Vertex d,f;
TopExp::Vertices(E,d,f);
if(d.IsSame(f)){
// tol3d = Max(tl,BRep_Tool::Tolerance(d));
tol3d = Max(tl,2.*BRep_Tool::Tolerance(d));//IFV 24.05.00 buc60684
e.Initialize(E);
ud = BRep_Tool::Parameter(d,TopoDS::Edge(aGenS));
uf = BRep_Tool::Parameter(f,TopoDS::Edge(aGenS));
cont = BRepLProp::Continuity(e,e,ud,uf,tol3d,ta);
if(cont >= 1){
TopoDS_Shape s_wnt = Shape(d,aDirS);
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
s_wnt = Shape(aGenS,aDirS);
TopoDS_Face f_wnt = TopoDS::Face(s_wnt);
B.Continuity(e_wnt,f_wnt,f_wnt,cont);
}
}
if(aDirS.Closed()){
Sweep_NumShape dirv = myDirShapeTool.Shape(2);
if(GDDShapeIsToAdd(Shape(aGenS,aDirS),
Shape(aGenS,dirv),
aGenS,aDirS,dirv)){
TopLoc_Location Lo;
Standard_Real fi,la;
cont = BRep_Tool::Curve(E,Lo,fi,la)->Continuity();
if(cont >= 1){
TopoDS_Shape s_wnt = Shape(aGenS,dirv);
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
s_wnt = Shape(aGenS,aDirS);
TopoDS_Face f_wnt = TopoDS::Face(s_wnt);
B.Continuity(e_wnt,f_wnt,f_wnt,cont);
}
}
}
}
}
else if(aGenS.ShapeType() == TopAbs_WIRE){
TopoDS_Edge E1,E2;
BRepAdaptor_Curve e1,e2;
Standard_Real u1,u2;
TopTools_IndexedDataMapOfShapeListOfShape M;
TopExp::MapShapesAndAncestors(aGenS,TopAbs_VERTEX,TopAbs_EDGE,M);
TopTools_ListIteratorOfListOfShape It,Jt;
for(Standard_Integer i = 1; i <= M.Extent(); i++){
TopoDS_Vertex V = TopoDS::Vertex(M.FindKey(i));
Standard_Integer j = 1;
for(It.Initialize(M.FindFromIndex(i));It.More();It.Next(),j++){
Jt.Initialize(M.FindFromIndex(i));
for(Standard_Integer k=1; k <= j; k++) { Jt.Next(); }
for(;Jt.More();Jt.Next()){
E1 = TopoDS::Edge(It.Value());
E2 = TopoDS::Edge(Jt.Value());
if (!E1.IsSame(E2) && HasShape(E1,aDirS) && HasShape(E2,aDirS)){
u1 = BRep_Tool::Parameter(V,E1);
u2 = BRep_Tool::Parameter(V,E2);
// tol3d = Max(tl,BRep_Tool::Tolerance(V));
tol3d = Max(tl,2.*BRep_Tool::Tolerance(V)); //IFV 24.05.00 buc60684
e1.Initialize(E1);
e2.Initialize(E2);
cont = BRepLProp::Continuity(e1,e2,u1,u2,tol3d,ta);
if(cont >= 1){
TopoDS_Shape s_wnt = Shape(V,aDirS);
TopoDS_Edge e_wnt = TopoDS::Edge(s_wnt);
s_wnt = Shape(E1,aDirS);
TopoDS_Face f1_wnt = TopoDS::Face(s_wnt);
s_wnt = Shape(E2,aDirS);
TopoDS_Face f2_wnt = TopoDS::Face(s_wnt);
B.Continuity(e_wnt,f1_wnt,f2_wnt,cont);
}
}
}
}
}
}
}
|