Home

If you're new to Python
and VPython see more
Help at glowscript.org

Pictures of 3D objects

 
helix
helix

The following statement will display a helix that is parallel to the x axis:

spring = helix(pos=vector(0,2,1),
            axis=vector(5,0,0), radius=0.5)

The helix object has the following attributes and default values: pos vector(0,0,0), axis vector(1,0,0), length (1), radius (1), coils (5), thickness (radius/20), color vector(1,1,1) which is color.white, red (1), green (1), blue (1), and up vector(0,1,0). More details:

length Length of axis; if not specified, axis determines the length, default = 1
If length is specified, it overrides the length given by axis

radius The radius of the helix, default = 1

thickness is the diameter of the cross section of the curve used to draw the helix; default is radius/20.

size Instead of specifying length and radius, you can set size=vector(length,height,width), which means that the cross section of the helix can be elliptical.

Note that the pos attribute for cylinder, arrow, cone, pyramid, and helix corresponds to one end of the object, whereas for a box, sphere, or ring it corresponds to the center of the object.

Currently it is not possible to specify the opacity of a helix object, which is based on the curve object.

See Rotating an Object for an easy way to change the orientation of an object.

See description of Additional Attributes available for all 3D display objects.