1 #include "SketchPlugin_Feature.h"
2 #include "SketchPlugin_Sketch.h"
3 #include <ModelAPI_Document.h>
4 #include <ModelAPI_Data.h>
5 #include <ModelAPI_Object.h>
6 #include <ModelAPI_AttributeRefList.h>
7 #include <ModelAPI_ResultConstruction.h>
9 SketchPlugin_Feature::SketchPlugin_Feature()
14 SketchPlugin_Sketch* SketchPlugin_Feature::sketch()
17 // find sketch that references to this feature
18 const std::set<AttributePtr>& aBackRefs = data()->refsToMe();
19 std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
20 for(; aBackRef != aBackRefs.end(); aBackRef++) {
21 boost::shared_ptr<SketchPlugin_Sketch> aSketch =
22 boost::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
24 mySketch = aSketch.get();
32 AISObjectPtr SketchPlugin_Feature::simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
33 AISObjectPtr thePrevious)
35 boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
36 ModelAPI_ResultConstruction>(theRes);
38 boost::shared_ptr<GeomAPI_Shape> aPreview;
40 aPreview = aConstr->shape();
42 AISObjectPtr aResult = thePrevious;
44 aResult = AISObjectPtr(new GeomAPI_AISObject());
45 aResult->createShape(aPreview);