#=========================================================================
# Make extrusion on circle
#=========================================================================
-# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+# Build face from sketcher results
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionFt.real("to_size").setValue(0) #TODO: remove
anExtrusionFt.real("from_size").setValue(0) #TODO: remove
aSession.finishOperation()
# Extrude clamp
-aClampSketchResult = aClampSketchFeature.firstResult()
-aClampSketchEdges = modelAPI_ResultConstruction(aClampSketchResult).shape()
-origin = geomDataAPI_Point(aClampSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aClampSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aClampSketchFeature.attribute("Norm")).dir()
-aClampSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aClampSketchEdges, aClampSketchFaces)
+aClampSketchResult = modelAPI_ResultConstruction(aClampSketchFeature.firstResult())
aSession.startOperation()
aClampExtrusionFt = aPart.addFeature("Extrusion")
assert (aClampExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
aClampExtrusionFt.selectionList("base").append(
- aClampSketchResult, aClampSketchFaces[0])
+ aClampSketchResult, aClampSketchResult.face(0))
aClampExtrusionFt.string("CreationMethod").setValue("BySizes")
aClampExtrusionFt.real("to_size").setValue(70)
aClampExtrusionFt.real("from_size").setValue(0)
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# selection type FACE=4
-anExtrusionFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
anExtrusionFt.real("to_size").setValue(0) #TODO: remove
anExtrusionFt.real("from_size").setValue(0) #TODO: remove
// try to find the shape of the higher level type in the context shape
bool aFacesTried = false; // for identification of vertices, faces are tried, then edges
TopoDS_ListOfShape aLastCommon; // to store the commons not good, but may be used for weak
- TopTools_MapOfShape aLastIntersectors;
+ TopoDS_ListOfShape aLastIntersectors;
while(aSelectionType != TopAbs_FACE || !aFacesTried) {
if (aSelectionType == TopAbs_FACE) {
if (theValue.ShapeType() != TopAbs_VERTEX)
if (aCommon.Extent() == 1 && aCommon.First().IsSame(theValue)) {
// name the intersectors
mySubSelList.clear();
- TopTools_MapOfShape::Iterator anInt(anIntersectors);
+ TopoDS_ListOfShape::Iterator anInt(anIntList);
for (; anInt.More(); anInt.Next()) {
if (!selectBySubSelector(theContext, anInt.Value())) {
break; // if some selector is failed, stop and search another solution
}
} else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty()) {
aLastCommon = aCommon;
- aLastIntersectors = anIntersectors;
+ aLastIntersectors = anIntList;
}
}
if (myWeakIndex != -1) {
// name the intersectors
mySubSelList.clear();
- TopTools_MapOfShape::Iterator anInt(aLastIntersectors);
+ TopoDS_ListOfShape::Iterator anInt(aLastIntersectors);
for (; anInt.More(); anInt.Next()) {
if (!selectBySubSelector(theContext, anInt.Value())) {
break; // if some selector is failed, stop and search another solution