1 // Name : SketchAPI_Projection.cpp
5 // 16/06/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "SketchAPI_Projection.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Dumper.h>
11 #include <ModelHighAPI_Selection.h>
12 #include <ModelHighAPI_Tools.h>
13 //--------------------------------------------------------------------------------------
14 SketchAPI_Projection::SketchAPI_Projection(
15 const std::shared_ptr<ModelAPI_Feature> & theFeature)
16 : SketchAPI_SketchEntity(theFeature)
21 SketchAPI_Projection::SketchAPI_Projection(
22 const std::shared_ptr<ModelAPI_Feature> & theFeature,
23 const ModelHighAPI_Selection & theExternalFeature )
24 : SketchAPI_SketchEntity(theFeature)
27 setExternalFeature(theExternalFeature);
31 SketchAPI_Projection::SketchAPI_Projection(
32 const std::shared_ptr<ModelAPI_Feature> & theFeature,
33 const std::string & theExternalName)
34 : SketchAPI_SketchEntity(theFeature)
37 setByExternalName(theExternalName);
41 SketchAPI_Projection::~SketchAPI_Projection()
46 //--------------------------------------------------------------------------------------
47 void SketchAPI_Projection::setExternalFeature(const ModelHighAPI_Selection & theExternalFeature)
49 fillAttribute(theExternalFeature, externalFeature());
54 void SketchAPI_Projection::setByExternalName(const std::string& theExternalName)
56 fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
61 //--------------------------------------------------------------------------------------
63 void SketchAPI_Projection::dump(ModelHighAPI_Dumper& theDumper) const
65 FeaturePtr aBase = feature();
66 const std::string& aSketchName = theDumper.parentName(aBase);
68 AttributeSelectionPtr anExternal = externalFeature();
69 theDumper << aBase << " = " << aSketchName << ".addProjection(" << anExternal << ")" << std::endl;
70 // dump "auxiliary" flag if necessary
71 SketchAPI_SketchEntity::dump(theDumper);