Extensions:2.6/Py/Scripts/Add Mesh/Add Gear

提供: wiki
移動先: 案内検索
Gears
Add Gears Object
UI location Group: AddMesh
Version 2.1 Author(s) Michel J. Anders (varkenvarken)
Blender 2.57 License GPL


Executable information
File name add_mesh_gears.py
Current version download https://svn.blender.org/svnroot/bf-extensions/trunk/py/scripts/addons/add_mesh_extra_objects/


Links http://blenderartists.org/forum/showthread.php?t=172956


Installation

  • This script is in Blender 2.5 Add-Ons menu.
  • In User Preferences you can see the Add-Ons menu.
  • You can activate the script here.
  • The script will now show up in the Shift/A Add/Mesh Menu.


Introduction

Scripts Add Mesh Gears.jpg

Create Add Mesh Gears

  • This Script creates a Gears Primitive.
  • Enable the Script in the Add-Ons menu.
  • Press the Shift/a.
  • Then Add.
  • Then Mesh.
  • Below the Monkey.
  • There is the Gears.
  • Press Gears.
  • To create the New Mesh.
  • This primitive was added in Blender.
  • As A Script, not Hardcoded.
  • You can change the script Parameters in the Toolbar Menu
  • Currently you need to set script parameters before doing any transforms or using modifiers.


Instructions

Interface/Menu Overview

  • The interface for this script is found in the Tool Shelf > Object Tools
  • Features: Sliders, Numeric Input.
  • Number of teeth
  • Radius
  • Addendum
  • Dedendum
  • Base
  • Width
  • Skewness
  • Conical angle
  • Crown


Known Issues

  • In Blender 2.5 the scripts currently show up in the toolbar.
  • Currently you need to set script parameters before doing any transforms or using modifiers.

Additional Information


  • """

What was needed to port it from 2.49 -> 2.50 alpha 0?

The basic functions that calculate the geometry (verts and faces) are mostly unchanged (add_tooth, add_spoke, add_gear)

Also, the vertex group API is changed a little bit but the concepts are the same:

=

vertexgroup = ob.vertex_groups.new('NAME_OF_VERTEXGROUP') vertexgroup.add(vertexgroup_vertex_indices, weight, 'ADD')

=

Now for some reason the name does not 'stick' and we have to set it this way: vertexgroup.name = 'NAME_OF_VERTEXGROUP'

Conversion to 2.50 also meant we could simply do away with our crude user interface. Just definining the appropriate properties in the AddGear() operator will display the properties in the Blender GUI with the added benefit of making it interactive: changing a property will redo the AddGear() operator providing the user with instant feedback.

Finally we had to convert/throw away some print statements to print functions as Blender nows uses Python 3.x

The code to actually implement the AddGear() function is mostly copied from add_mesh_torus() (distributed with Blender). """

  • In the Wiki writer's opinion always have Python Installed on your computer when using scripts. http://www.python.org/

Support