MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / MakeWire

Method MakeWire

src/Mod/Part/App/BRepOffsetAPI_MakeOffsetFix.cpp:132–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132void BRepOffsetAPI_MakeOffsetFix::MakeWire(TopoDS_Shape& wire)
133{
134 // get the edges of the wire and check which of the stored edges
135 // serve as input of the wire
136 TopTools_MapOfShape aMap;
137 TopExp_Explorer xp(wire, TopAbs_EDGE);
138 while (xp.More()) {
139 aMap.Add(xp.Current());
140 xp.Next();
141 }
142
143 std::list<TopoDS_Edge> edgeList;
144 for (const auto& itLoc : myLocations) {
145 TopTools_ListOfShape newShapes = mkOffset.Generated(itLoc.first);
146 // Check generated shapes for the vertexes, too
147 TopExp_Explorer xpv(itLoc.first, TopAbs_VERTEX);
148 while (xpv.More()) {
149 TopTools_ListOfShape newEdge = mkOffset.Generated(xpv.Current());
150 if (!newEdge.IsEmpty()) {
151 newShapes.Append(newEdge);
152 }
153 xpv.Next();
154 }
155 for (TopTools_ListIteratorOfListOfShape it(newShapes); it.More(); it.Next()) {
156 TopoDS_Shape newShape = it.Value();
157
158 if (aMap.Contains(newShape)) {
159 newShape.Move(itLoc.second);
160 edgeList.push_back(TopoDS::Edge(newShape));
161 }
162 }
163 }
164
165 if (!edgeList.empty()) {
166 BRepBuilderAPI_MakeWire mkWire;
167 mkWire.Add(edgeList.front());
168 edgeList.pop_front();
169 wire = mkWire.Wire();
170
171 bool found = false;
172 do {
173 found = false;
174 for (std::list<TopoDS_Edge>::iterator pE = edgeList.begin(); pE != edgeList.end(); ++pE) {
175 mkWire.Add(*pE);
176 if (mkWire.Error() != BRepBuilderAPI_DisconnectedWire) {
177 // edge added ==> remove it from list
178 found = true;
179 edgeList.erase(pE);
180 wire = mkWire.Wire();
181 break;
182 }
183 }
184 } while (found);
185 }
186}
187
188const TopoDS_Shape& BRepOffsetAPI_MakeOffsetFix::Shape()
189{

Callers 4

make3DCurveMethod · 0.80
GetCurve3dMethod · 0.80
makeOffsetShapeMethod · 0.80

Calls 15

WireMethod · 0.80
ErrorMethod · 0.80
EdgeClass · 0.50
MoreMethod · 0.45
AddMethod · 0.45
NextMethod · 0.45
IsEmptyMethod · 0.45
AppendMethod · 0.45
ValueMethod · 0.45
ContainsMethod · 0.45
MoveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected