Cut angular section (pie section) out of cylinder In general, I'm wondering how to cut a pie slice out of a cylinder. I have done an extensive search and I'm sure it's not that difficult, but I haven't managed to find anything I could apply (possibly because of my novice status in Blender.)
For the moment, my more immediate need is to cut out part of an octogonal prism. So, consider the octogon built with the following code:
import bpy

# Create a 3D octogonal prism.

myRadius = 2.0
myDepth  = 1.0

bpy.ops.mesh.primitive_cylinder_add(
        vertices = 8, radius = myRadius, depth = myDepth,
        location = ( 0, 0, 0 ) ) # location could be other, using origin for simplicity here
bpy.context.object.name  = &quot;myOctogon&quot;

Ultimately, what I want is to end up with is 7/8 of the original prism rotated clockwise by pi/8 so that the gap faces &quot;northeast&quot;.
UPDATE:
I have discovered that I can do it as follows, though I don't know how to script it all:
import bpy
from math import pi

# Create a 2D octogon.

myRadius = 2.0
myDepth  = 1.0

bpy.ops.mesh.primitive_circle_add(
    vertices = 8 , radius = myRadius,
    fill_type='TRIFAN', 
    location = ( 0, 0, 0 ),
    rotation = ( 0, 0, pi / 8 ) )

bpy.ops.object.editmode_toggle()

# Select the 'northeast' edge.
bpy.ops.mesh.subdivide()

# Select the new vertex, move it to ( 0, 0, 0 ).

# Select the whole 'pac man' shape, extrude to desired height.
bpy.ops.mesh.extrude_region_move( ... ) # need to work out appropriate details
Below is a quick and dirty method using a circle and solidify modifier with operators.
import bpy
from math import pi

verts_total = 8
verts_fill = 7
my_radius = 1.0
my_location = (0.0, 0.0, 0.0)
my_rotation = (0.0, 0.0, 0.0)  # use radians
my_depth = 2.0

def make_pacman(verts_total, verts_fill, my_radius, my_location, my_rotation, my_depth):
    # create a circle mesh and create triangle fan fill
    bpy.ops.mesh.primitive_circle_add(
        vertices=verts_total,
        radius=my_radius,
        fill_type='TRIFAN',
        calc_uvs=True,
        location=my_location,
        rotation=my_rotation)

    obj = bpy.context.object
    # add solidify modifier to simulate cylinder
    mod = obj.modifiers.new(&quot;SOLIDIFY&quot;, type='SOLIDIFY')
    mod.thickness = my_depth 
    mod.offset = 0
    # if full cylinder then done
    if verts_total == verts_fill:
        return
    # select vertices to delete
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.select_all(action='DESELECT')
    bpy.ops.object.mode_set(mode='OBJECT')
    for i, vert in enumerate(obj.data.vertices):
        if i &lt;= verts_fill:
            continue
        vert.select = True
    bpy.ops.object.mode_set(mode='EDIT')
    bpy.ops.mesh.delete(type='VERT')
    bpy.ops.object.mode_set(mode='OBJECT')

make_pacman(verts_total, verts_fill, my_radius, my_location, my_rotation, my_depth)