]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketcherPrs/SketcherPrs_Tools.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / SketcherPrs / SketcherPrs_Tools.cpp
index 156e1265954e78e745b83ebd8b2c4cb8f8c02db8..b364447914f73b3c9b155d7c4917b826492b8c51 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -47,7 +47,7 @@
 #include <BRep_Tool.hxx>
 #include <Precision.hxx>
 
-#include <AIS_Dimension.hxx>
+#include <PrsDim_Dimension.hxx>
 
 namespace SketcherPrs_Tools {
 
@@ -95,6 +95,11 @@ ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName
 std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject)
 {
   ResultConstructionPtr aRes = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
+  if (!aRes.get()) {
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+    if (aFeature.get())
+      aRes = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFeature->lastResult());
+  }
   if (aRes.get() != NULL && aRes->data()->isValid()) {
     /// essential check as it is called in openGl thread
     return aRes->shape();
@@ -222,11 +227,12 @@ std::list<ResultPtr> getFreePoints(const CompositeFeaturePtr& theSketch)
       bool aIsFree = true;
       for(int aKind = 0; aIsFree && aKind < 2; aKind++) { // 0 for feature, 1 for result
         ObjectPtr aReferenced = aCurrent;
-        if (aKind == 1)
+        if (aKind == 1) {
           if (!aCurrent->results().empty())
             aReferenced = aCurrent->firstResult();
           else
             break;
+        }
         const std::set<AttributePtr>& aRefs = aReferenced->data()->refsToMe();
         std::set<AttributePtr>::iterator aRIt = aRefs.begin();
         for (; aRIt != aRefs.end(); ++aRIt) {