if (!theFeature->isAction()) { // do not add action to the data model
TDF_Label aFeaturesLab = featuresLabel();
TDF_Label aFeatureLab = aFeaturesLab.NewChild();
- initData(theFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS);
- // keep the feature ID to restore document later correctly
- TDataStd_Comment::Set(aFeatureLab, theFeature->getKind().c_str());
- myFeatures.Bind(aFeatureLab, theFeature);
- // store feature in the features array
+ // store feature in the features array: before "initData" because in macro features
+ // in initData it creates new features, appeared later than this
TDF_Label aPrevFeateureLab;
if (theAfterThis.get()) { // searching for the previous feature label
std::shared_ptr<Model_Data> aPrevData =
}
}
AddToRefArray(aFeaturesLab, aFeatureLab, aPrevFeateureLab);
+
+ initData(theFeature, aFeatureLab, TAG_FEATURE_ARGUMENTS);
+ // keep the feature ID to restore document later correctly
+ TDataStd_Comment::Set(aFeatureLab, theFeature->getKind().c_str());
+ myFeatures.Bind(aFeatureLab, theFeature);
// event: feature is added
static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_CREATED);
ModelAPI_EventCreator::get()->sendUpdated(theFeature, anEvent);
// erase all attributes under the label of feature
aFeatureLabel.ForgetAllAttributes();
// remove it from the references array
- if (theFeature->isInHistory()) {
- RemoveFromRefArray(featuresLabel(), aFeatureLabel);
- }
+ RemoveFromRefArray(featuresLabel(), aFeatureLabel);
// event: feature is deleted
ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), ModelAPI_Feature::group());
// the redisplay signal should be flushed in order to erase the feature presentation in the viewer
myHistory.erase(aHIter); // erase from map => this means that it is not synchronized
}
-FeaturePtr Model_Objects::feature(TDF_Label& theLabel) const
+FeaturePtr Model_Objects::feature(TDF_Label theLabel) const
{
if (myFeatures.IsBound(theLabel))
return myFeatures.Find(theLabel);
aNewFeatures.insert(aFeature);
initData(aFeature, aFeatureLabel, TAG_FEATURE_ARGUMENTS);
updateHistory(aFeature);
+ aFeature->setDisabled(false); // by default created feature is enabled (this allows to recreate the results before "setCurrent" is called)
// event: model is updated
ModelAPI_EventCreator::get()->sendUpdated(aFeature, aCreateEvent);
std::shared_ptr<Model_Data> aRefData =
std::dynamic_pointer_cast<Model_Data>((*aRefTo)->data());
aRefData->addBackReference(aFeature, aRefsIter->first); // here the Concealed flag is updated
+ // update enable/disable status: the nested status must be equal to the composite
+ CompositeFeaturePtr aComp =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
+ if (aComp.get()) {
+ FeaturePtr aReferenced = std::dynamic_pointer_cast<ModelAPI_Feature>(*aRefTo);
+ if (aReferenced.get()) {
+ aReferenced->setDisabled(aComp->isDisabled());
+ }
+ }
}
}
}
if (aGroup->Get() == ModelAPI_ResultBody::group().c_str()) {
aNewBody = createBody(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultPart::group().c_str()) {
- aNewBody = createPart(theFeature->data(), aResIndex);
+ //aNewBody = createPart(theFeature->data(), aResIndex);
+ theFeature->execute(); // create the part result
+ break;
} else if (aGroup->Get() == ModelAPI_ResultConstruction::group().c_str()) {
theFeature->execute(); // construction shapes are needed for sketch solver
break;