Dump "Intersection point" and "Projection".
//--------------------------------------------------------------------------------------
#include <GeomAPI_Pnt2d.h>
//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Dumper.h>
#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
//--------------------------------------------------------------------------------------
}
//--------------------------------------------------------------------------------------
+
+void SketchAPI_IntersectionPoint::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aSketchName = theDumper.parentName(aBase);
+
+ AttributeSelectionPtr aLine = externalLine();
+ theDumper << aBase << " = " << aSketchName << ".addIntersectionPoint(" << aLine << ")" << std::endl;
+ // dump "auxiliary" flag if necessary
+ SketchAPI_SketchEntity::dump(theDumper);
+}
/// Set by external name
SKETCHAPI_EXPORT
void setByExternalLineName(const std::string & theExternalLineName);
+
+ /// Dump wrapped feature
+ SKETCHAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
};
//! Pointer on IntersectionPoint object
//--------------------------------------------------------------------------------------
#include "SketchAPI_Projection.h"
//--------------------------------------------------------------------------------------
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
#include <ModelHighAPI_Tools.h>
//--------------------------------------------------------------------------------------
SketchAPI_Projection::SketchAPI_Projection(
}
}
+SketchAPI_Projection::SketchAPI_Projection(
+ const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName)
+: SketchAPI_SketchEntity(theFeature)
+{
+ if (initialize()) {
+ setByExternalName(theExternalName);
+ }
+}
+
SketchAPI_Projection::~SketchAPI_Projection()
{
execute();
}
+void SketchAPI_Projection::setByExternalName(const std::string& theExternalName)
+{
+ fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
+
+ execute();
+}
+
//--------------------------------------------------------------------------------------
+
+void SketchAPI_Projection::dump(ModelHighAPI_Dumper& theDumper) const
+{
+ FeaturePtr aBase = feature();
+ const std::string& aSketchName = theDumper.parentName(aBase);
+
+ AttributeSelectionPtr anExternal = externalFeature();
+ theDumper << aBase << " = " << aSketchName << ".addProjection(" << anExternal << ")" << std::endl;
+ // dump "auxiliary" flag if necessary
+ SketchAPI_SketchEntity::dump(theDumper);
+}
SKETCHAPI_EXPORT
SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature,
const ModelHighAPI_Selection & theExternalFeature);
+ /// Constructor with values
+ SKETCHAPI_EXPORT
+ SketchAPI_Projection(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::string & theExternalName);
/// Destructor
SKETCHAPI_EXPORT
virtual ~SketchAPI_Projection();
/// Set external feature
SKETCHAPI_EXPORT
void setExternalFeature(const ModelHighAPI_Selection & theExternalLine);
+
+ /// Set by external name
+ SKETCHAPI_EXPORT
+ void setByExternalName(const std::string & theExternalName);
+
+ /// Dump wrapped feature
+ SKETCHAPI_EXPORT
+ virtual void dump(ModelHighAPI_Dumper& theDumper) const;
};
//! Pointer on Projection object
return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalFeature));
}
+std::shared_ptr<SketchAPI_Projection> SketchAPI_Sketch::addProjection(
+ const std::string & theExternalName)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = compositeFeature()->addFeature(SketchPlugin_Projection::ID());
+ return ProjectionPtr(new SketchAPI_Projection(aFeature, theExternalName));
+}
+
//--------------------------------------------------------------------------------------
std::shared_ptr<SketchAPI_Mirror> SketchAPI_Sketch::addMirror(
const ModelHighAPI_RefAttr & theMirrorLine,
std::shared_ptr<SketchAPI_Projection> addProjection(
const ModelHighAPI_Selection & theExternalFeature);
+ /// Add projection
+ SKETCHAPI_EXPORT
+ std::shared_ptr<SketchAPI_Projection> addProjection(const std::string & theExternalName);
+
/// Add mirror
SKETCHAPI_EXPORT
std::shared_ptr<SketchAPI_Mirror> addMirror(