aLoop->registerListener(this, kOpStartEvent);
Config_PropManager::registerProp("Model update", "automatic_rebuild", "Rebuild immediately",
- Config_Prop::Bool, "false");
+ Config_Prop::Boolean, "false");
myIsAutomatic =
Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
}
for(aFIter = myJustCreatedOrUpdated.begin(); aFIter != myJustCreatedOrUpdated.end(); aFIter++)
{
FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
- if (aF && aF->data() && aF->data()->isValid() && aF->getKind() == "Extrusion") {
- if (aF->selection("extrusion_face")) {
- ResultPtr aSketchRes = aF->selection("extrusion_face")->context();
- if (aSketchRes) {
- static Events_ID HIDE_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE);
- ModelAPI_EventCreator::get()->sendUpdated(aSketchRes, HIDE_DISP);
+ if (aF && aF->getKind() == "Extrusion") {
+ AttributeSelectionListPtr aBase = aF->selectionList("base");
+ if (aBase.get()) {
+ for(int a = aBase->size() - 1; a >= 0; a--) {
+ ResultPtr aSketchRes = aBase->value(a)->context();
+ if (aSketchRes) {
+ static Events_ID HIDE_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE);
+ ModelAPI_EventCreator::get()->sendUpdated(aSketchRes, HIDE_DISP);
+ }
}
}
}
CompositeFeaturePtr aComposite =
std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
if (aComposite) {
- int aSubsNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubsNum; a++) {
+ // number of subs can be changed in execution: like fillet
+ for(int a = 0; a < aComposite->numberOfSubs(); a++) {
if (updateFeature(aComposite->subFeature(a)))
aMustbeUpdated = true;
}
std::shared_ptr<ModelAPI_AttributeSelection> aSel =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
if (!aSel->update()) { // this must be done on execution since it may be long operation
- if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)))
+ if (!aFactory->isNotObligatory(theFeature->getKind(), theFeature->data()->id(aSel)) &&
+ aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
aState = ModelAPI_StateInvalidArgument;
}
}
if (aSelAttr) {
if (!aSelAttr->update()) {
if (!aFactory->isNotObligatory(
- theFeature->getKind(), theFeature->data()->id(aSel)))
+ theFeature->getKind(), theFeature->data()->id(aSel)) &&
+ aFactory->isCase(theFeature, theFeature->data()->id(aSel)))
aState = ModelAPI_StateInvalidArgument;
}
}
// for sketch after update of plane (by update of selection attribute)
// but before execute, all sub-elements also must be updated (due to the plane changes)
if (aComposite) {
- int aSubsNum = aComposite->numberOfSubs();
- for(int a = 0; a < aSubsNum; a++) {
+ // number of subs can be changed in execution: like fillet
+ for(int a = 0; a < aComposite->numberOfSubs(); a++) {
FeaturePtr aSub = aComposite->subFeature(a);
bool aWasModified = myUpdated[aSub];
myUpdated.erase(myUpdated.find(aSub)); // erase to update for sure (plane may be changed)
}
// re-execute after update: solver may update the previous values, so, shapes must be
// updated
- for(int a = 0; a < aSubsNum; a++) {
+ for(int a = 0; a < aComposite->numberOfSubs(); a++) {
if (aComposite->subFeature(a) && aFactory->validate(aComposite->subFeature(a)))
aComposite->subFeature(a)->execute();
}