# Create a part for extrusions & boolean
aSession.startOperation()
aPartFeature = aSession.moduleDocument().addFeature("Part")
-aPart = aSession.activeDocument()
aSession.finishOperation()
+aPart = aSession.activeDocument()
#=========================================================================
# Create a sketch with circle to extrude
#=========================================================================
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle")
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
origin = geomDataAPI_Point(eachSketchFeature.attribute("Origin")).pnt()
dirX = geomDataAPI_Dir(eachSketchFeature.attribute("DirX")).dir()
- dirY = geomDataAPI_Dir(eachSketchFeature.attribute("DirY")).dir()
norm = geomDataAPI_Dir(eachSketchFeature.attribute("Norm")).dir()
aSketchFaces = ShapeList()
GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+ origin, dirX, norm, aSketchEdges, aSketchFaces)
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
class FeaturesPlugin_Extrusion : public ModelAPI_Feature
static const std::string MY_EXTRUSION_ID("Extrusion");
- static const std::string MY_FACE_ID("extrusion_face");
- static const std::string MY_SIZE_ID("extrusion_size");
- static const std::string MY_REVERSE_ID("extrusion_reverse");
+ 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());
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
# Create circle
aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")).pnt()
dirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aSketchFeature.attribute("DirY")).dir()
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")).dir()
aSketchFaces = ShapeList()
GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+ origin, dirX, norm, aSketchEdges, aSketchFaces)
assert (len(aSketchFaces) > 0)
assert (aSketchFaces[0] is not None)
# Create extrusion
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine")
aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt()
dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirY")).dir()
norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir()
aSketchFaces = ShapeList()
GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+ origin, dirX, norm, aSketchEdges, aSketchFaces)
# Create extrusion on them
anExtrusionFt = aPart.addFeature("Extrusion")
anExtrusionFt.selectionList("base").append(
for i in xrange(0, N):
for j in xrange(0, N):
# Create circle
- aSketchFeature = modelAPI_CompositeFeature(aPart.addFeature("Sketch"))
+ aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
- diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
- diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSketchCircle = aSketchFeature.addFeature("SketchCircle")
aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
origin = geomDataAPI_Point(aSketchFeatures[i].attribute("Origin")).pnt()
dirX = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirX")).dir()
- dirY = geomDataAPI_Dir(aSketchFeatures[i].attribute("DirY")).dir()
norm = geomDataAPI_Dir(aSketchFeatures[i].attribute("Norm")).dir()
aSketchFaces = ShapeList()
GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+ origin, dirX, norm, aSketchEdges, aSketchFaces)
anExtrusionFt = aPart.addFeature("Extrusion")
assert (anExtrusionFt.getKind() == "Extrusion")
# Make rectangle sketch: base for the box, size 100x100
#=========================================================================
aSession.startOperation()
-aQuadrangleSketchFeature = modelAPI_CompositeFeature(aPart.addFeature("Sketch"))
+aQuadrangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSketchLineA = aQuadrangleSketchFeature.addFeature("SketchLine")
aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape()
origin = geomDataAPI_Point(aQuadrangleSketchFeature.attribute("Origin")).pnt()
dirX = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirX")).dir()
-dirY = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("DirY")).dir()
norm = geomDataAPI_Dir(aQuadrangleSketchFeature.attribute("Norm")).dir()
aSketchFaces = ShapeList()
GeomAlgoAPI_SketchBuilder.createFaces(
- origin, dirX, dirY, norm, aSketchEdges, aSketchFaces)
+ origin, dirX, norm, aSketchEdges, aSketchFaces)
# Create extrusion on them
aBox = aPart.addFeature("Extrusion")
aBox.selectionList("base").append(
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
#=========================================================================
aSession.startOperation()
aSketchCommonFeature = aDocument.addFeature("Sketch")
-aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+aSketchFeature = featureToCompositeFeature(aSketchCommonFeature)
origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
aSession.finishOperation()
assert (dirx.x() == 1)
assert (dirx.y() == 0)
assert (dirx.z() == 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-assert (diry.x() == 0)
-assert (diry.y() == 1)
-assert (diry.z() == 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
assert (norm.x() == 0)
assert (norm.y() == 0)
origin.setValue(0, 0, 0)
dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
-diry.setValue(0, 1, 0)
norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
norm.setValue(0, 0, 1)
#=========================================================================