From 9d0a778ead38424b53f9d258fe7f0ad1dd0d568b Mon Sep 17 00:00:00 2001 From: nds Date: Mon, 16 Jun 2014 12:20:44 +0400 Subject: [PATCH] refs #80 - Sketch base GUI: create/draw point, circle and arc Arc edit correction. --- src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp | 8 ++++++-- src/PartSet/PartSet_FeatureArcPrs.cpp | 2 +- src/SketchPlugin/SketchPlugin_Arc.cpp | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp index d12cbdd73..6b8ebd946 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_EdgeBuilder.cpp @@ -69,7 +69,11 @@ boost::shared_ptr GeomAlgoAPI_EdgeBuilder::lineCircleArc( anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd); boost::shared_ptr aRes(new GeomAPI_Shape); - TopoDS_Edge anEdge = anEdgeBuilder.Edge(); - aRes->setImpl(new TopoDS_Shape(anEdge)); + anEdgeBuilder.Build(); + + if (anEdgeBuilder.IsDone()) + aRes->setImpl(new TopoDS_Shape(anEdgeBuilder.Edge())); + else + aRes = boost::shared_ptr(); return aRes; } diff --git a/src/PartSet/PartSet_FeatureArcPrs.cpp b/src/PartSet/PartSet_FeatureArcPrs.cpp index dc9fd82e5..0e76f6e8b 100644 --- a/src/PartSet/PartSet_FeatureArcPrs.cpp +++ b/src/PartSet/PartSet_FeatureArcPrs.cpp @@ -110,7 +110,7 @@ void PartSet_FeatureArcPrs::move(double theDeltaX, double theDeltaY) boost::shared_ptr aPoint3 = boost::dynamic_pointer_cast(aData->attribute(ARC_ATTR_END)); - aPoint1->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY); + aPoint3->setValue(aPoint3->x() + theDeltaX, aPoint3->y() + theDeltaY); } double PartSet_FeatureArcPrs::distanceToPoint(FeaturePtr theFeature, diff --git a/src/SketchPlugin/SketchPlugin_Arc.cpp b/src/SketchPlugin/SketchPlugin_Arc.cpp index 1830a0058..e390c6af2 100644 --- a/src/SketchPlugin/SketchPlugin_Arc.cpp +++ b/src/SketchPlugin/SketchPlugin_Arc.cpp @@ -61,7 +61,8 @@ const boost::shared_ptr& SketchPlugin_Arc::preview() boost::shared_ptr aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(aCenter, aStartPoint, aEndPoint, aNormal); - aShapes.push_back(aCircleShape); + if (aCircleShape) + aShapes.push_back(aCircleShape); } boost::shared_ptr aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes); setPreview(aCompound); -- 2.39.2