-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <SketchPlugin_ConstraintTangent.h>
#include <SketchPlugin_ConstraintVertical.h>
#include <SketchPlugin_MacroBSpline.h>
+#include <SketchPlugin_SketchCopy.h>
#include <SketcherPrs_Tools.h>
//--------------------------------------------------------------------------------------
#include <ModelAPI_Events.h>
return SketchPtr(new SketchAPI_Sketch(aFeature, thePlaneObject));
}
+//--------------------------------------------------------------------------------------
+SketchPtr copySketch(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const SketchPtr & theSketch)
+{
+ FeaturePtr aCopyer = thePart->addFeature(SketchPlugin_SketchCopy::ID());
+ aCopyer->reference(SketchPlugin_SketchCopy::BASE_ID())->setValue(theSketch->feature());
+ aCopyer->execute();
+
+ FeaturePtr aNewSketch = thePart->nextFeature(aCopyer);
+
+ // perform removing the macro-feature
+ thePart->removeFeature(aCopyer);
+ apply();
+
+ return SketchPtr(new SketchAPI_Sketch(aNewSketch));
+}
+
//--------------------------------------------------------------------------------------
std::list< std::shared_ptr<SketchAPI_Point> > SketchAPI_Sketch::getFreePoints()
if (aVersion == SketchPlugin_ConstraintAngle::THE_VERSION_1) {
std::string aTypeLC = theType;
- std::transform(aTypeLC.begin(), aTypeLC.end(), aTypeLC.begin(), ::tolower);
+ std::transform(aTypeLC.begin(), aTypeLC.end(), aTypeLC.begin(),
+ [](char c) { return static_cast<char>(::tolower(c)); });
if (aTypeLC == "supplementary")
aType = (int)SketcherPrs_Tools::ANGLE_COMPLEMENTARY;
else if (aTypeLC == "backward")