X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_Tools.cpp;h=b488201750a4866ff82aa1ff3d150af14b2a2223;hb=6f31859c9897eacec13d3912e76f28b8b824ecf4;hp=a92364d0594b30c0c7d950c77e94bfc4995f720a;hpb=7fcf163a8a369889707c5b73eeeb2bc68a4b906e;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_Tools.cpp b/src/PartSet/PartSet_Tools.cpp index a92364d05..b48820175 100644 --- a/src/PartSet/PartSet_Tools.cpp +++ b/src/PartSet/PartSet_Tools.cpp @@ -431,19 +431,30 @@ std::shared_ptr PartSet_Tools::point3D(std::shared_ptrto3D(aC->pnt(), aX->dir(), aY); } -ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape, - const ObjectPtr& theObject, - CompositeFeaturePtr theSketch) +ResultPtr PartSet_Tools::findFixedObjectByExternal(const TopoDS_Shape& theShape, + const ObjectPtr& theObject, + CompositeFeaturePtr theSketch) { + ResultPtr aResult; if (theShape.ShapeType() == TopAbs_EDGE) { // Check that we already have such external edge std::shared_ptr aInEdge = std::shared_ptr(new GeomAPI_Edge()); aInEdge->setImpl(new TopoDS_Shape(theShape)); - ResultPtr aResult = findExternalEdge(theSketch, aInEdge); - if (aResult) - return aResult; + aResult = findExternalEdge(theSketch, aInEdge); + } + if (theShape.ShapeType() == TopAbs_VERTEX) { + std::shared_ptr aInVert = std::shared_ptr(new GeomAPI_Vertex()); + aInVert->setImpl(new TopoDS_Shape(theShape)); + aResult = findExternalVertex(theSketch, aInVert); + } + return aResult; +} - // If not found then we have to create new +ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape, + const ObjectPtr& theObject, + CompositeFeaturePtr theSketch) +{ + if (theShape.ShapeType() == TopAbs_EDGE) { Standard_Real aStart, aEnd; Handle(V3d_View) aNullView; FeaturePtr aMyFeature; @@ -454,13 +465,16 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap // Create line aMyFeature = theSketch->addFeature(SketchPlugin_Line::ID()); } else if (aAdaptor.GetType() == GeomAbs_Circle) { - if (aAdaptor.IsClosed()) { - // Create circle - aMyFeature = theSketch->addFeature(SketchPlugin_Circle::ID()); - } else { + std::shared_ptr anEdge = std::shared_ptr(new GeomAPI_Edge); + anEdge->setImpl(new TopoDS_Shape(theShape)); + if (anEdge->isArc()) { // Create arc aMyFeature = theSketch->addFeature(SketchPlugin_Arc::ID()); } + else { + // Create circle + aMyFeature = theSketch->addFeature(SketchPlugin_Circle::ID()); + } } if (aMyFeature) { DataPtr aData = aMyFeature->data(); @@ -487,12 +501,6 @@ ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShap } } if (theShape.ShapeType() == TopAbs_VERTEX) { - std::shared_ptr aInVert = std::shared_ptr(new GeomAPI_Vertex()); - aInVert->setImpl(new TopoDS_Shape(theShape)); - ResultPtr aResult = findExternalVertex(theSketch, aInVert); - if (aResult) - return aResult; - FeaturePtr aMyFeature = theSketch->addFeature(SketchPlugin_Point::ID()); if (aMyFeature) {