Skip to content

Pi3D Create Shapes

tipam edited this page Jul 11, 2012 · 29 revisions

The following create shape functions are available in Pi3D:

  • createCone (radius,height,sides, .. optional parameters)
  • createCuboid (width,height,depth, .. optional parameters)
  • createCylinder (radius,height,sides, .. optional parameters)
  • createDisk (radius,sides, .. optional parameters)
  • createElevationMapFromTexture (mapfile,width,depth,height,divx=0,divz=0, .. optional parameters)
  • createEnvironmentCube (size,type)
  • createExtrude (path(), .. optional parameters)
  • createLathe (path(),sides, .. optional parameters)
  • createMergeShape (optional parameters)
  • createPlane (width,height, .. optional parameters)
  • createSpiral (radius,thickness,ringRots,sides,rise,coils, .. optional parameters)
  • createSphere (radius,slices,sides,hemisphere, .. optional parameters)
  • createTCone (radiusBottom,radiusTop,height,sides, .. optional parameters)
  • createTorus (radius,thickness,ringRots,sides, .. optional parameters)
  • createTube (radius,thickness,height,sides, .. optional parameters)

Creating Shapes

Almost all shapes have default settings except for shapes that need a path (such as Lathe and Extrude). This means it is possible to do;

mycube = pi3d.createCuboid() #Create a cuboid with default settings

Or, you can define the shape's parameters;

mycube = pi3d.createCuboid(3,2,2) #Create a cuboid 3 wide, 2 high and 2 deep.

And even add the optional parameters which are available for all create shape functions...

Optional Parameters

You can optionally add the following parameters in the functions above (where stated):

name, x,y,z, rotX,rotY,rotZ, scaleX,scaleY,scaleZ, centerX,centerY,centerZ

However, if you wish add a rotation (for example), you must also state the previous parameters. For example;

mycube = pi3d.createCuboid(2,2,2, "Cuboid1", 0,0,0, 0,45,0) #Create a 2x2x2 cuboid rotated around the Y axis at 45 degrees

Or specify ALL the parameters available ...

#Create a 2x2x2 cuboid rotated around the Y axis at 45 degrees and having a centre of rotation 4 units up in the Y axis

mycube = pi3d.createCuboid(2,2,2, "Cuboid1", 0,0,0, 0,45,0, 1,1,1, 0,4,0)

Clone this wiki locally