#include <GeomAlgoAPI_ShapeTools.h>
#include <GeomAPI_ShapeExplorer.h>
+#include <sstream>
+
//=================================================================================================
void FeaturesPlugin_CompositeBoolean::initAttributes()
{
std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(aSolidAlgo);
if(aSweepAlgo.get()) {
//Insert to faces
+ int aToFaceIndex = 1;
const ListOfShape& aToFaces = aSweepAlgo->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++);
+ std::ostringstream aStr;
+ aStr << aToName << "_" << aToFaceIndex++;
+ theResultBody->generated(aToFace, aStr.str(), aToTag++);
}
//Insert from faces
+ int aFromFaceIndex = 1;
const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
if (aFromTag < aToTag) aFromTag = aToTag;
for(ListOfShape::const_iterator anIt = aFromFaces.cbegin(); anIt != aFromFaces.cend(); anIt++) {
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
+ std::ostringstream aStr;
+ aStr << aFromName << "_" << aFromFaceIndex++;
+ theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
}
}
}
std::shared_ptr<GeomAlgoAPI_MakeSweep> aSweepAlgo = std::dynamic_pointer_cast<GeomAlgoAPI_MakeSweep>(theMakeShape);
if(aSweepAlgo.get()) {
//Insert to faces
+ int aToFaceIndex = 1;
const std::string aToName = "ToFace";
int aToTag = 2;
const ListOfShape& aToFaces = aSweepAlgo->toFaces();
if(aDataMap->isBound(aToFace)) {
aToFace = aDataMap->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag++);
+ std::ostringstream aStr;
+ aStr << aToName << "_" << aToFaceIndex++;
+ theResultBody->generated(aToFace, aStr.str(), aToTag++);
}
//Insert from faces
+ int aFromFaceIndex = 1;
const std::string aFromName = "FromFace";
int aFromTag = aToTag > 10000 ? aToTag : 10000;
const ListOfShape& aFromFaces = aSweepAlgo->fromFaces();
if(aDataMap->isBound(aFromFace)) {
aFromFace = aDataMap->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
+ std::ostringstream aStr;
+ aStr << aFromName << "_" << aFromFaceIndex++;
+ theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
}
}
}
#include <GeomAlgoAPI_Prism.h>
#include <GeomAlgoAPI_ShapeTools.h>
+#include <sstream>
+
//=================================================================================================
FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
{
theResultBody->loadAndOrientGeneratedShapes(&thePrismAlgo, theBasis, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aSubShapes);
//Insert to faces
+ int aToFaceIndex = 1;
const std::string aToName = "ToFace";
int aToTag = 2;
const ListOfShape& aToFaces = thePrismAlgo.toFaces();
if(aSubShapes->isBound(aToFace)) {
aToFace = aSubShapes->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag++);
+ std::ostringstream aStr;
+ aStr << aToName << "_" << aToFaceIndex++;
+ theResultBody->generated(aToFace, aStr.str(), aToTag++);
}
//Insert from faces
+ int aFromFaceIndex = 1;
const std::string aFromName = "FromFace";
int aFromTag = aToTag > 10000 ? aToTag : 10000;
const ListOfShape& aFromFaces = thePrismAlgo.fromFaces();
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
+ std::ostringstream aStr;
+ aStr << aFromName << "_" << aFromFaceIndex++;
+ theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
}
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Lin.h>
+#include <sstream>
+
//=================================================================================================
FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
{
theResultBody->loadAndOrientGeneratedShapes(&theRevolAlgo, theBasis, GeomAPI_Shape::EDGE, aLatTag, aLatName, *aSubShapes);
//Insert to faces
+ int aToFaceIndex = 1;
const std::string aToName = "ToFace";
int aToTag = 2;
const ListOfShape& aToFaces = theRevolAlgo.toFaces();
if(aSubShapes->isBound(aToFace)) {
aToFace = aSubShapes->find(aToFace);
}
- theResultBody->generated(aToFace, aToName, aToTag++);
+ std::ostringstream aStr;
+ aStr << aToName << "_" << aToFaceIndex++;
+ theResultBody->generated(aToFace, aStr.str(), aToTag++);
}
//Insert from faces
+ int aFromFaceIndex = 1;
const std::string aFromName = "FromFace";
int aFromTag = aToTag > 10000 ? aToTag : 10000;
const ListOfShape& aFromFaces = theRevolAlgo.fromFaces();
if(aSubShapes->isBound(aFromFace)) {
aFromFace = aSubShapes->find(aFromFace);
}
- theResultBody->generated(aFromFace, aFromName, aFromTag++);
+ std::ostringstream aStr;
+ aStr << aFromName << "_" << aFromFaceIndex++;
+ theResultBody->generated(aFromFace, aStr.str(), aFromTag++);
}
}
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("vertex")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
aSession.finishOperation()
#=========================================================================
# Check results
aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1")
aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2")
aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1")
-aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_1&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_2&Extrusion_1_1/FromFace_1_1")
+aSelectionListAttr.append("Extrusion_1_1/LateralFace_3&Extrusion_1_1/ToFace_1_1")
aSession.finishOperation()
#=========================================================================
# Check results
aGroupFeature = aSession.activeDocument().addFeature("Group")
aSelectionListAttr = aGroupFeature.selectionList("group_list")
aSelectionListAttr.setSelectionType("face")
-aSelectionListAttr.append("Extrusion_1_1/ToFace_1")
+aSelectionListAttr.append("Extrusion_1_1/ToFace_1_1")
aSession.finishOperation()
#=========================================================================
# Check results
aPlacementFt = aPart.addFeature("Placement")
aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
aPlacementFt = aPart.addFeature("Placement")
aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
aPlacementFt.selection("placement_start_shape").selectSubShape("face", "Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
aSession.startOperation()
aPlacementFt = aPart.addFeature("Placement")
aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("edge", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
aSession.startOperation()
aPlacementFt = aPart.addFeature("Placement")
aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("edge", "Extrusion_1_1/ToFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
aSession.startOperation()
aPlacementFt = aPart.addFeature("Placement")
aPlacementFt.selectionList("placement_objects_list").append(anExtrusionResult, anExtrusionResult.shape())
-aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4&Extrusion_1_1/FromFace_1&Extrusion_1_1/LateralFace_1")
-aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
+aPlacementFt.selection("placement_start_shape").selectSubShape("vertex", "Extrusion_1_1/LateralFace_4&Extrusion_1_1/FromFace_1_1&Extrusion_1_1/LateralFace_1")
+aPlacementFt.selection("placement_end_shape").selectSubShape("vertex", "Extrusion_1_2/ToFace_1_1&Extrusion_1_2/LateralFace_3&Extrusion_1_2/LateralFace_2")
aPlacementFt.boolean("placement_reverse_direction").setValue(False)
aPlacementFt.boolean("placement_centering").setValue(True)
aPlacementFt.execute()
thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
thisxmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/LateralFace_1"
thiszmin = "Sketch_1/Edge5_1"
-thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1"
mystand = model.addSketch(mypart, thisface)
thisface = "Extrusion_1_1/LateralFace_2"
thisxmin = "Extrusion_1_1/LateralFace_3&Extrusion_1_1/LateralFace_2"
-thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1"
+thiszmax = "Extrusion_1_1/LateralFace_2&Extrusion_1_1/ToFace_1_1"
mystand = model.addSketch(mypart, thisface)
circle = mystand.addCircle(0, 25, 5)
sketch.setCoincident(arc.endPoint(), h1.startPoint())
# Binding
- left_e = sketch.addLine("Extrusion_1_1/LateralFace_4&Extrusion_1_1/ToFace_1")
+ left_e = sketch.addLine("Extrusion_1_1/LateralFace_4&Extrusion_1_1/ToFace_1_1")
sketch.setCoincident(left_e.startPoint(), left.endPoint())
sketch.setCoincident(left_e.endPoint(), left.startPoint())