extrudedObjects = []
for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
# Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(50)
extrudedObjects = []
for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
# Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
extrudedObjects = []
for eachSketchFeature in [aCircleSketchFeature, aTriangleSketchFeature]:
# Build sketch faces
- aSketchResult = eachSketchFeature.firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+ aSketchResult = modelAPI_ResultConstruction(eachSketchFeature.firstResult())
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(50)
# 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)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
# Create extrusion
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
# 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)
+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)
# 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)
+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)
Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchLine_1")])
Fill_1 = model.addFill(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], [model.selection("VERTEX", "Vertex_1_1")])
model.do()
-
model.checkResult(Fill_1,model,1,[2],[0],[0],[2],[4])
model.testHaveNamingSubshapes(Fill_1,model,Part_1_doc)
# Make extrusion on circle 1
#=========================================================================
# 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)
+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)
# Make extrusion on circle 2
#=========================================================================
# 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)
+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)
anExtrusions = []
for i in range(0, N * N):
- aSketchResult = aSketchFeatures[i].firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
- norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+ aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
- # v1.0.2 from master
- # anExtrusionFt.selection("extrusion_face").setValue(
- # aSketchResult, aSketchFaces[0])
- # anExtrusionFt.real("extrusion_size").setValue(10)
- # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
anExtrusions.append(anExtrusionFt)
aSession.finishOperation()
#=========================================================================
# Build a big box extrusion
#=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
# Create extrusion on them
aBox = aPart.addFeature("Extrusion")
aBox.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
aBox.string("CreationMethod").setValue("BySizes")
aBox.real("from_size").setValue(0)
aBox.real("to_size").setValue(10)
aBox.real("to_offset").setValue(0) #TODO: remove
aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-# aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
aSession.finishOperation()
# 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)
+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)
#=========================================================================
# Make extrusion
#=========================================================================
-aSketchResult = aSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces)
-assert (len(aSketchFaces) > 0)
-assert (aSketchFaces[0] is not None)
-assert (aSketchFaces[1] is not None)
+aSketchResult = modelAPI_ResultConstruction(aSketchFeature.firstResult())
+assert (aSketchResult.facesNum() > 1)
aSession.startOperation()
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0])
-anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[1])
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(0))
+anExtrusionFt.selectionList("base").append(aSketchResult, aSketchResult.face(1))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("to_size").setValue(50)
anExtrusionFt.real("from_size").setValue(0)
aSession.finishOperation()
# 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)
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
#=========================================================================
# Create a sketch line to revol
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByAngles")
aRevolFt.real("from_angle").setValue(10)
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
aRevolFt.real("from_angle").setValue(0) #TODO: remove
assert (aRevolFt.getKind() == "Revolution")
# selection type FACE=4
aRevolFt.selectionList("base").append(
- aCircleSketchResult, aCircleSketchFaces[0])
+ aCircleSketchResult, aCircleSketchResult.face(0))
aRevolFt.selection("axis_object").setValue(aLineSketchResult, aLineEdge)
aRevolFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
aRevolFt.real("from_angle").setValue(0) #TODO: remove
# 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)
+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)
# 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)
+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)
# 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)
+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)
## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
##
-# -*- coding: utf-8 -*-
+"""
+ TestExtrusion.py
+ Unit test of FeaturesPlugin_Boolean class: many Boolean operations performance
-from salome.shaper import model
+ class FeaturesPlugin_Extrusion : public ModelAPI_Feature
+ static const std::string MY_EXTRUSION_ID("Extrusion");
+ static const std::string MY_FACE_ID("base");
+ static const std::string MY_SIZE_ID("size");
+ static const std::string MY_REVERSE_ID("reverse");
data()->addAttribute(FeaturesPlugin_Extrusion::FACE_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Extrusion::SIZE_ID(), ModelAPI_AttributeDouble::typeId());
anExtrusions = []
for i in range(0, N * N):
- aSketchResult = aSketchFeatures[i].firstResult()
- aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
- origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
- dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
- norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
- aSketchFaces = ShapeList()
- GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
-
+ aSketchResult = modelAPI_ResultConstruction(aSketchFeatures[i].firstResult())
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
anExtrusionFt.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
anExtrusionFt.string("CreationMethod").setValue("BySizes")
anExtrusionFt.real("from_size").setValue(0)
anExtrusionFt.real("to_size").setValue(10)
anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
- # v1.0.2 from master
- # anExtrusionFt.selection("extrusion_face").setValue(
- # aSketchResult, aSketchFaces[0])
- # anExtrusionFt.real("extrusion_size").setValue(10)
- # anExtrusionFt.boolean("extrusion_reverse").setValue(False)
anExtrusions.append(anExtrusionFt)
aSession.finishOperation()
#=========================================================================
# Build a big box extrusion
#=========================================================================
-aSketchResult = aQuadrangleSketchFeature.firstResult()
-aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
-origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
-aSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, norm, aSketchEdges, aSketchFaces)
+aSketchResult = modelAPI_ResultConstruction(aQuadrangleSketchFeature.firstResult())
# Create extrusion on them
aBox = aPart.addFeature("Extrusion")
aBox.selectionList("base").append(
- aSketchResult, aSketchFaces[0])
+ aSketchResult, aSketchResult.face(0))
aBox.string("CreationMethod").setValue("BySizes")
aBox.real("from_size").setValue(0)
aBox.real("to_size").setValue(10)
aBox.real("to_offset").setValue(0) #TODO: remove
aBox.real("from_offset").setValue(0) #TODO: remove
-# v 1.0.2 from master
-# aBox.selection("extrusion_face").setValue(
-# aSketchResult, aSketchFaces[0])
-# aBox.real("extrusion_size").setValue(10)
-# aBox.boolean("extrusion_reverse").setValue(False)
aSession.finishOperation()
# 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)
+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)