From 7bdcfb0a20cb1a342cec594ea9f9c80ae5f98304 Mon Sep 17 00:00:00 2001 From: AjinkyaDahale Date: Mon, 20 Mar 2017 19:44:45 +0530 Subject: [PATCH] Issue #2682 Modifying a check in SketchObject::validateExternalLinks() for datums. Hopefully will not cause trouble. There is still a problem where if the check fails, all constraints will be lost! --- src/Mod/Sketcher/App/SketchObject.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 77669165a8..f0f6ee2af3 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -4138,12 +4138,17 @@ void SketchObject::validateExternalLinks(void) const App::DocumentObject *Obj=Objects[i]; const std::string SubElement=SubElements[i]; - const Part::Feature *refObj=static_cast(Obj); - const Part::TopoShape& refShape=refObj->Shape.getShape(); - TopoDS_Shape refSubShape; try { - refSubShape = refShape.getSubShape(SubElement.c_str()); + if (Obj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) { + const Part::Datum* datum = static_cast(Obj); + refSubShape = datum->getShape(); + } + else { + const Part::Feature *refObj=static_cast(Obj); + const Part::TopoShape& refShape=refObj->Shape.getShape(); + refSubShape = refShape.getSubShape(SubElement.c_str()); + } } catch (Standard_Failure) { rebuild = true ; @@ -4185,7 +4190,6 @@ void SketchObject::validateExternalLinks(void) rebuildVertexIndex(); solve(true); // we have to update this sketch and everything depending on it. } - } void SketchObject::rebuildExternalGeometry(void)