if (theAfterThis.get())
anAfterLab = std::dynamic_pointer_cast<Model_Data>(theAfterThis->data())->label().Father();
+ // check whether some folder refers to the moved feature by start or end: if yes, remove from it
+ removeFromFolder(std::list<FeaturePtr>(1, theMoved));
+
Handle(TDataStd_HLabelArray1) aNewArray =
new TDataStd_HLabelArray1(aRefs->Lower(), aRefs->Upper());
int aPassedMovedFrom = 0; // the prev feature location is found and passed
if (aSub.get()) {
std::shared_ptr<Model_Data> aSubData = std::dynamic_pointer_cast<Model_Data>(
aSub->data());
- if (aSubData->label().Father().IsEqual(aSubLab.ChangeValue())) {
+ const TDF_Label& aSubLabVal = aSubLab.ChangeValue();
+ if (aSubData->label().Father().IsEqual(aSubLabVal)) {
aCurrentResult = aSub;
break;
}
const std::list<ResultPtr>& aResults = aFeature->results();
std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
for(; aRIter != aResults.cend(); aRIter++) {
- std::shared_ptr<Model_Data> aResData = std::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
+ std::shared_ptr<Model_Data> aResData =
+ std::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
if (aResData->label().Father().IsEqual(aSubLab.ChangeValue())) {
aCurrentResult = *aRIter;
break;
if (theChild.get()) {
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theChild->data());
TDF_Label aLab = aData->label();
- if (!aLab.IsNull() && aLab.Depth() > 1) {
- ObjectPtr anObj = object(aLab.Father().Father());
+ if (!aLab.IsNull() && aLab.Depth() > 2) {
+ ObjectPtr anObj = object(aLab.Father().Father().Father());
return anObj;
}
}
std::string& theParentName) const
{
ResultBodyPtr aBodyRes = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theFeatureData->owner());
- if(aBodyRes) {
+ if (aBodyRes) {
+ // only for top-results (works for the cases when results are not yet added to the feature)
FeaturePtr anOwner = ModelAPI_Feature::feature(theResult);
// names of sub-solids in CompSolid should be default (for example,
// result of boolean operation 'Boolean_1' is a CompSolid which is renamed to 'MyBOOL',
// however, sub-elements of 'MyBOOL' should be named 'Boolean_1_1', 'Boolean_1_2' etc.)
- std::ostringstream aDefaultName;
- aDefaultName << anOwner->name();
- // compute default name of CompSolid (name of feature + index of CompSolid's result)
- int aBodyResultIndex = 0;
- const std::list<ResultPtr>& aResults = anOwner->results();
- std::list<ResultPtr>::const_iterator anIt = aResults.begin();
- for(; anIt != aResults.end(); ++anIt, ++aBodyResultIndex)
- if(aBodyRes == *anIt)
- break;
- aDefaultName << "_" << (aBodyResultIndex + 1);
- theParentName = aDefaultName.str();
+ if (std::dynamic_pointer_cast<Model_Data>(aBodyRes->data())->label().Depth() == 6) {
+ std::ostringstream aDefaultName;
+ // compute default name of CompSolid (name of feature + index of CompSolid's result)
+ int aBodyResultIndex = 0;
+ const std::list<ResultPtr>& aResults = anOwner->results();
+ std::list<ResultPtr>::const_iterator anIt = aResults.begin();
+ for (; anIt != aResults.end(); ++anIt, ++aBodyResultIndex)
+ if (aBodyRes == *anIt)
+ break;
+ aDefaultName << anOwner->name();
+ aDefaultName << "_" << (aBodyResultIndex + 1);
+ theParentName = aDefaultName.str();
+ } else { // just name of the parent result if it is deeper than just a sub-result
+ theParentName = aBodyRes->data()->name();
+ }
return false;
}
}
}
}
+ if (aResSize > 0) { // check there exist a body that must be updated
+ std::list<ResultPtr>::const_iterator aRes = theFeature->results().cbegin();
+ for (; aResSize && aRes != theFeature->results().cend(); aRes++, aResSize++) {
+ if ((*aRes)->data()->isValid() && (*aRes)->groupName() == ModelAPI_ResultBody::group()) {
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(*aRes);
+ aBody->updateSubs(aBody->shape(), false);
+ }
+ }
+ }
}
ResultPtr Model_Objects::findByName(const std::string theName)