for (; aPointsIt != anAllCoincPoints.end(); aPointsIt++) {
AttributePtr aP = (*aPointsIt);
FeaturePtr aCoincFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aP->owner());
+ bool isInSet = (theEdgesSet.find(aCoincFeature) != theEdgesSet.end());
// Condition 0: not auxiliary
- if (aCoincFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value()) continue;
+ if (!isInSet && aCoincFeature->boolean(SketchPlugin_SketchEntity::AUXILIARY_ID())->value())
+ continue;
// Condition 1: not a point feature
if (aCoincFeature->getKind() != SketchPlugin_Point::ID()) {
if (aCoincFeature != theEdge) {
// Condition 3: it is in the set of interest.
// Empty set means all sketch edges.
- bool isInSet = true;
- if (theEdgesSet.size()) {
- isInSet = (theEdgesSet.find(aCoincFeature) != theEdgesSet.end());
- }
- if (isInSet) {
+ if (isInSet || theEdgesSet.empty()) {
// Condition 4: consider only features with two end points
std::shared_ptr<GeomDataAPI_Point2D> aP1, aP2;
SketchPlugin_SegmentationTools::getFeaturePoints(aCoincFeature, aP1, aP2);
FeaturePtr& theFeature,
std::list<ObjectPtr>& thePoolOfFeatures)
{
+ if (theFeature) {
+ // check the feature type is the same as required
+ if (theFeature->getKind() != theFeatureKind) {
+ // return feature to the pool and try to find the most appropriate
+ thePoolOfFeatures.push_back(theFeature);
+ theFeature = FeaturePtr();
+ }
+ }
if (!theFeature) {
// try to find appropriate feature in the pool
for (std::list<ObjectPtr>::iterator it = thePoolOfFeatures.begin();
#include "SketchPlugin_MacroArc.h"
#include "SketchPlugin_MacroCircle.h"
#include "SketchPlugin_MultiRotation.h"
+#include "SketchPlugin_Offset.h"
#include "SketchPlugin_Point.h"
#include "SketchPlugin_Sketch.h"
#include "SketchPlugin_Trim.h"
// B-splines are not supported in Copying features
FeaturePtr aSelFeature = ModelAPI_Feature::feature(aSelObject);
- if (aSelFeature && (aSelFeature->getKind() == SketchPlugin_BSpline::ID() ||
+ if (aFeature->getKind() != SketchPlugin_Offset::ID() &&
+ aSelFeature && (aSelFeature->getKind() == SketchPlugin_BSpline::ID() ||
aSelFeature->getKind() == SketchPlugin_BSplinePeriodic::ID())) {
theError = "Not supported";
return false;
}
anObjIter = aCopiedObjects.begin();
- for (; anObjIter != aCopiedObjects.end(); anObjIter++)
- if (aSelObject == *anObjIter) {
+ for (; anObjIter != aCopiedObjects.end(); anObjIter++) {
+ bool isFound = aSelObject == *anObjIter;
+ if (!isFound) {
+ // check in the results of the feature
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anObjIter);
+ const std::list<ResultPtr>& aResults = aFeature->results();
+ for (std::list<ResultPtr>::const_iterator aResIt = aResults.begin();
+ aResIt != aResults.end() && !isFound; ++aResIt) {
+ isFound = aSelObject == *aResIt;
+ }
+ }
+ if (isFound) {
std::wstring aName = aSelObject.get() ? aSelObject->data()->name() : L"";
theError = "The object %1 is a result of copy";
theError.arg(aName);
return false;
}
+ }
}
return true;
}
shape_types="Edges"
use_external="true"
greed="true">
+ <validator id="SketchPlugin_CopyValidator" />
</sketch_multi_selector>
<doublevalue id="offset_value"
label="Offset value"
if (!aRes.get()) {
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (aFeature.get())
- aRes = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFeature->firstResult());
+ aRes = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFeature->lastResult());
}
if (aRes.get() != NULL && aRes->data()->isValid()) {
/// essential check as it is called in openGl thread