// Getting faces to create solids.
std::shared_ptr<ModelAPI_Feature> aSketchFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(
reference(SKETCH_OBJECT_ID())->value());
- if(!aSketchFeature) {
+ if(!aSketchFeature || aSketchFeature->results().empty()) {
return;
}
ResultPtr aSketchRes = aSketchFeature->results().front();
theResultBody->store(theAlgo.shape());
} else {
const int aGenTag = 1;
- const int aFromTag = 2;
- const int aToTag = 3;
- const int aModTag = 4;
- const int aDelTag = 5;
- const int aSubsolidsTag=6; /// sub solids will be placed at labels 6, 7, etc. if result is compound of solids
+ const int aModTag = 2;
+ const int aDelTag = 3;
+ const int aSubsolidsTag=4; /// sub solids will be placed at labels 6, 7, etc. if result is compound of solids
+ int aToTag = 5; // may be many labels, starting from this index
+ int aFromTag = 10000; // may be many labels, starting from this index or last aToTag index
const std::string aGenName = "Generated";
const std::string aModName = "Modified";
const std::string aLatName = "LateralFace";
if(aSubShapes->isBound(aToFace)) {
aToFace = aSubShapes->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag);
+ theResultBody->generated(aToFace, aToName, aToTag++);
}
//Insert from faces
+ if (aFromTag < aToTag) aFromTag = aToTag;
for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag);
+ theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
}
//Insert to faces
const std::string aToName = "ToFace";
- const int aToTag = 2;
+ int aToTag = 2;
const ListOfShape& aToFaces = thePrismAlgo.toFaces();
for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
if(aSubShapes->isBound(aToFace)) {
aToFace = aSubShapes->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag);
+ theResultBody->generated(aToFace, aToName, aToTag++);
}
//Insert from faces
const std::string aFromName = "FromFace";
- const int aFromTag = 3;
+ int aFromTag = aToTag > 10000 ? aToTag : 10000;
const ListOfShape& aFromFaces = thePrismAlgo.fromFaces();
for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag);
+ theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
}
//Insert to faces
const std::string aToName = "ToFace";
- const int aToTag = 2;
+ int aToTag = 2;
const ListOfShape& aToFaces = theRevolAlgo.toFaces();
for(ListOfShape::const_iterator anIt = aToFaces.cbegin(); anIt != aToFaces.cend(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aToFace = *anIt;
if(aSubShapes->isBound(aToFace)) {
aToFace = aSubShapes->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag);
+ theResultBody->generated(aToFace, aToName, aToTag++);
}
//Insert from faces
const std::string aFromName = "FromFace";
- const int aFromTag = 3;
+ int aFromTag = aToTag > 10000 ? aToTag : 10000;
const ListOfShape& aFromFaces = theRevolAlgo.fromFaces();
for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
std::shared_ptr<GeomAPI_Shape> aFromFace = *anIt;
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag);
+ theResultBody->generated(aFromFace, aFromName, aFromTag++);
}
}
aBuilder.Delete(aPairsIter->first);
} else if (anEvol == TNaming_PRIMITIVE) {
aBuilder.Generated(aPairsIter->second);
+ } else if (anEvol == TNaming_SELECTED) {
+ aBuilder.Select(aPairsIter->first, aPairsIter->second);
}
}
// recursive call for all sub-labels
}
}
}
+
+void Model_BodyBuilder::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
+{
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
+ if (aData) {
+ clean();
+ if (!theShape.get())
+ return; // bad shape
+ TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
+ if (aShape.IsNull())
+ return; // null shape inside
+ TNaming_Builder aBuilder(aData->shapeLab());
+ aBuilder.Select(aShape, aShape);
+ }
+}
+
void Model_BodyBuilder::clean()
{
std::vector<TNaming_Builder*>::iterator aBuilder = myBuilders.begin();
const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const int theDecomposeSolidsTag = 0);
+ /// Stores the shape without naming support
+ /// \param theShape shape to store
+ MODEL_EXPORT virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape);
+
/// Returns the shape-result produced by this feature
MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
for(aFIter = myWaitForFinish.begin(); aFIter != myWaitForFinish.end(); aFIter++)
{
FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
- if (aF && aF->data()->isValid() && aF->getKind() == "Extrusion") {
+ if (aF && aF->data()->isValid() &&
+ (aF->getKind() == "Extrusion" || aF->getKind() == "Revolution")) {
AttributeSelectionListPtr aBase = aF->selectionList("base");
if (aBase.get()) {
for(int a = aBase->size() - 1; a >= 0; a--) {
const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const int theDecomposeSolidsTag = 0) = 0;
+ /// Stores the shape without naming support
+ virtual void storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+
/// Returns the shape-result produced by this feature
virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
myBuilder->storeModified(theOldShape, theNewShape, theDecomposeSolidsTag);
}
+void ModelAPI_ResultBody::storeWithoutNaming(const std::shared_ptr<GeomAPI_Shape>& theShape)
+{
+ myBuilder->storeWithoutNaming(theShape);
+}
+
std::shared_ptr<GeomAPI_Shape> ModelAPI_ResultBody::shape()
{
return myBuilder->shape();
MODELAPI_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theDecomposeSolidsTag = 0);
+ /// Stores the shape without naming support
+ MODELAPI_EXPORT virtual void storeWithoutNaming(
+ const std::shared_ptr<GeomAPI_Shape>& theShape);
+
/// Returns the shape-result produced by this feature
MODELAPI_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();