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 = "myOctogon"
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 "northeast".
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