std::map<int, TNaming_Builder*>::iterator aFind = myBuilders.find(theTag);
if (aFind == myBuilders.end()) {
std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
- myBuilders[theTag] = new TNaming_Builder(
- theTag == 0 ? aData->shapeLab() : aData->shapeLab().FindChild(theTag));
+ TDF_Label aLab = theTag == 0 ? aData->shapeLab() : aData->shapeLab().FindChild(theTag);
+ myBuilders[theTag] = new TNaming_Builder(aLab);
aFind = myBuilders.find(theTag);
}
return aFind->second;
for(; anEntriesIter.More(); anEntriesIter.Next()) {
anEntriesIter.Value()->Label().ForgetAttribute(kEXTERNAL_SHAPE_REF);
}
+ // to clear old shapes in all sub-labels (they may be left without builders on Open)
+ TDF_ChildIDIterator aNSIter(aLab, TNaming_NamedShape::GetID(), true);
+ for(; aNSIter.More(); aNSIter.Next()) {
+ aNSIter.Value()->Label().ForgetAttribute(aNSIter.Value());
+ }
}
void Model_BodyBuilder::cleanCash()
}
}
// check the result is a Body
- if ((*anObjIt)->groupName() == ModelAPI_ResultBody::group()) {
+ if (anObjIt->get() && (*anObjIt)->groupName() == ModelAPI_ResultBody::group()) {
// check the result is part of CompSolid
ResultPtr anObjRes = std::dynamic_pointer_cast<ModelAPI_Result>(*anObjIt);
ResultBodyPtr aParentBody = ModelAPI_Tools::bodyOwner(anObjRes);