1 // File: ModuleBase_Tools.cpp
2 // Created: 11 July 2014
3 // Author: Vitaly Smetannikov
5 #include "ModuleBase_Tools.h"
6 #include <ModelAPI_ResultBody.h>
7 #include <ModelAPI_ResultConstruction.h>
8 #include <ModelAPI_Document.h>
10 namespace ModuleBase_Tools
13 //******************************************************************
14 boost::shared_ptr<GeomAPI_Shape> shape(ResultPtr theResult)
16 ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
17 if (aBody) return aBody->shape();
18 ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theResult);
19 if (aConstruct) return aConstruct->shape();
20 return boost::shared_ptr<GeomAPI_Shape>();
23 //******************************************************************
24 FeaturePtr feature(ObjectPtr theObject)
26 FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
28 ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
30 DocumentPtr aDoc = aResult->document();
31 return aDoc->feature(aResult);