Here is a program that creates the extrusion you want. The basic idea is to add and subtract rectangles and disks.Â
Another possible approach would be to make a Python list of positions along the straight parts of the contour and then extend the list with the pos attribute of paths.arc. That is, if p is a list of the points along the straight parts of the path, p.extend(a.pos) to add arc points to the path, where a = paths.arc(....). Note that paths are in the xz plane; see the example program extrusion_overview.py for a visualization of this issue.
from __future__ import print_function, division
from visual import *
#-----------------------------------------------------------------------------------
# define a "board" using arcs and lines as a closed contour
# this board should be extruded e.g. with a thickness od 20 mm (see var. straight)
#-----------------------------------------------------------------------------------
    Â
scene.title = "mySHAPE"
scene.height = 1000
scene.width = 1500
scene.range = 600
scene.center = (500, 250, 10)
# workpiece must have thickness of 20 mm
straight = [(0,0,0),(0,0,-20)] # extrude in -z direction
# Create four sections. The first is the left half of the board.
s1 = shapes.rectangle(pos=(250,250), width=500, height=500)
# The second from the left is a rectangle from which we subtract a circle (a disk)
r2 = shapes.rectangle(pos=(600,150), width=200, height=300)
c2 = shapes.circle(pos=(600,300), radius=100)
s2 = r2-c2
# The third from the left is a rectangle to which we add a circle, then
# subtract the right half of the material.
r3 = shapes.rectangle(pos=(900,150), width=400, height=300)
c3 = shapes.circle(pos=(900,300), radius=200)
r3b = shapes.rectangle(pos=(1000,250), width=200, height=500)
s3 = r3+c3-r3b
# The fourth from the left is like the third.
r4 = shapes.rectangle(pos=(900,200), width=200, height=400)
c4 = shapes.circle(pos=(900,400), radius=100)
r4b = shapes.rectangle(pos=(850,250), width=100, height=500)
s4 = r4+c4-r4b
C = s1+s2+s3+s4 # Set C = s1 or s2 or s3 or s4 to see the individual contributions
# why is Polygon always closed ?? Â can I define an unclosed Polygon ??
# The Polygon module, not written by those developing VPython, only handles closed contours.
# From the Help on extrusion:
# Instead of giving Polygon closed contours of shapes, alternatively you can specify
# the 2D shape as a simple list of 2D points that need not constitute a closed contour,
# as in the upper object shown at the right. Here is the program:
##s = [(-3,5), (0,0), (-3,-5)]
##p = [(-7,0,5), (5,0,-5)]
##extrusion(pos=p, shape=s,
## Â Â Â Â Â color=color.orange,Â
## Â Â Â Â Â material=materials.wood)
# It should be possible to use the paths library to create a list of positions.
myExt_Arc = extrusion(pos=straight, shape=C, color=color.yellow)