1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomAlgoAPI_WireBuilder.cpp
4 // Created: 14 April 2016
5 // Author: Dmitry Bobylev
7 #include "GeomAlgoAPI_WireBuilder.h"
9 #include <BRepBuilderAPI_MakeWire.hxx>
11 #include <TopoDS_Wire.hxx>
13 //=================================================================================================
14 std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_WireBuilder::wire(const ListOfShape& theShapes)
16 BRepBuilderAPI_MakeWire aWireBuilder;
18 for(ListOfShape::const_iterator anIt = theShapes.cbegin(); anIt != theShapes.cend(); ++anIt) {
19 const TopoDS_Shape& aShape = (*anIt)->impl<TopoDS_Shape>();
20 switch(aShape.ShapeType()) {
22 aWireBuilder.Add(TopoDS::Edge(aShape));
26 aWireBuilder.Add(TopoDS::Wire(aShape));
30 return GeomShapePtr();
35 if(aWireBuilder.Error() != BRepBuilderAPI_WireDone) {
36 return GeomShapePtr();
39 GeomShapePtr aResultShape(new GeomAPI_Shape());
40 aResultShape->setImpl(new TopoDS_Shape(aWireBuilder.Wire()));