if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
- clean();
+ if (theDecomposeSolidsTag != -2)
+ clean();
// store the new shape as primitive
TNaming_Builder aBuilder(aShapeLab);
if (!theOldShape || !theNewShape)
} else if (aNotInTree) {
// not in tree -> store as primitive (stored as separated)
builder(aBuilderTag)->Generated(aNewShape);
+ } else if (aNewShape.ShapeType() > aRoot.ShapeType()) {
+ // if lower-level type is produced, make it as generated
+ builder(aBuilderTag)->Generated(aRoot, aNewShape);
} else {
builder(aBuilderTag)->Modify(aRoot, aNewShape);
}
if (theSplitInSubs && mySubs.size()) { // consists of subs
std::vector<std::shared_ptr<ModelAPI_ResultBody> >::const_iterator aSubIter = mySubs.cbegin();
for(; aSubIter != mySubs.cend(); aSubIter++) {
+ // check that sub-shape was also created as modification of ShapeIn
+ /* to find when it is needed later to enable: to store modification of sub-bodies not only as primitives
+ GeomShapePtr aSubGeomShape = (*aSubIter)->shape();
+ if (!theIsStoreAsGenerated && aSubGeomShape.get() && !aSubGeomShape->isNull()) {
+ TopoDS_Shape aSubShape = aSubGeomShape->impl<TopoDS_Shape>();
+ TopoDS_Shape aWholeIn = theShapeIn->impl<TopoDS_Shape>();
+ for(TopExp_Explorer anExp(aWholeIn, aSubShape.ShapeType()); anExp.More(); anExp.Next()) {
+ ListOfShape aHistory;
+ std::shared_ptr<GeomAPI_Shape> aSubIn(new GeomAPI_Shape());
+ aSubIn->setImpl((new TopoDS_Shape(anExp.Current())));
+ theMS->modified(aSubIn, aHistory);
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aHistory.begin();
+ for (; anIt != aHistory.end(); anIt++) {
+ if ((*anIt)->isSame(aSubGeomShape)) {
+ (*aSubIter)->storeModified(aSubIn, aSubGeomShape, -2); // -2 is to avoid clearing
+ }
+ }
+ }
+ }*/
(*aSubIter)->loadAndOrientModifiedShapes(
theMS, theShapeIn, theKindOfShape, theTag, theName, theSubShapes, theIsStoreSeparate,
theIsStoreAsGenerated);
}
}
-
int Model_ResultCompSolid::numberOfSubs(bool forTree) const
{
return int(mySubs.size());