From: azv Date: Wed, 29 Jan 2020 14:45:34 +0000 (+0300) Subject: Fix crash on importing salome.shaper.model X-Git-Tag: V9_5_0a1~54^2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a42155ebfe80458f7dd0a68a350cbc0d80416f7c;p=modules%2Fshaper.git Fix crash on importing salome.shaper.model --- diff --git a/src/SketchAPI/SketchAPI_Sketch.cpp b/src/SketchAPI/SketchAPI_Sketch.cpp index a93c26e05..5a8d9ce21 100644 --- a/src/SketchAPI/SketchAPI_Sketch.cpp +++ b/src/SketchAPI/SketchAPI_Sketch.cpp @@ -1212,18 +1212,15 @@ static std::shared_ptr pointOnEllipse(const FeaturePtr& theFeatur } static std::shared_ptr middlePointOnBSpline(const FeaturePtr& theFeature, - const CompositeFeaturePtr& theSketch) + SketchAPI_Sketch* theSketch) { GeomAPI_Edge anEdge(theFeature->lastResult()->shape()); GeomPointPtr aMiddle = anEdge.middlePoint(); - - std::shared_ptr aSketch = - std::dynamic_pointer_cast(theSketch); - return aSketch->to2D(aMiddle); + return theSketch->to2D(aMiddle); } static std::shared_ptr middlePoint(const ObjectPtr& theObject, - const CompositeFeaturePtr& theSketch) + SketchAPI_Sketch* theSketch) { std::shared_ptr aMiddlePoint; FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); @@ -1259,7 +1256,7 @@ void SketchAPI_Sketch::move(const ModelHighAPI_RefAttr& theMovedEntity, if (aMessage->movedAttribute()) anOriginalPosition = pointCoordinates(aMessage->movedAttribute()); else - anOriginalPosition = middlePoint(aMessage->movedObject(), compositeFeature()); + anOriginalPosition = middlePoint(aMessage->movedObject(), this); if (!anOriginalPosition) return; // something has gone wrong, do not process movement