cc_classes_mesh02

Übersicht: Python & Blender


System Message: ERROR/3 (<string>, line 1)

Unknown directive type "index".

.. index:: class, mesh

Objectives

System Message: ERROR/3 (<string>, line 8)

Unknown directive type "tabularcolumns".

.. tabularcolumns:: | c | l |
   :border: none

a Now we will finish the pyramid class

Instructions

Tasks:
  1. Repeat the sub-steps shown here to create a class until you have a working version.
  2. Create a class of its own »primitive«, eg. a wedge or the base form of a hex key.
  3. Add a material to the class, which is given to the new object.

Design data for a mesh

Define the tip of the pyramid and defining the faces, is the last step.

System Message: ERROR/3 (<string>, line 29)

Error in "code-block" directive: unknown option: "emphasize-lines".

.. code-block:: python
   :emphasize-lines: 10, 13-16

   def pyramid_values():
       """
       This function takes inputs and returns vertex and face arrays.
       no actual mesh data creation is done here.
       """
       verts = [(-1, +1, 0),
                (+1, +1, 0),
                (+1, -1, 0),
                (-1, -1, 0),
                (0, 0, +2)]

       faces = [(0, 1, 2, 3),
                (0,1,4),
                (1,2,4),
                (2,3,4),
                (3,0,4)]

       return verts, faces

Defining the faces is done clockwise and remember the indes starts with 0.

The result

Now you are able to create as much pyramids as you like.

/images/all/blender-extended/pyramiden.png

The final version of the class

System Message: ERROR/3 (<string>, line 63)

Unknown directive type "literalinclude".

.. literalinclude:: files/pyramid2.py
   :language: python

Kommentare