[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3829] contrib/py/scripts/addons/ add_mesh_cad_objects: moved add_column to branches/broken_stuff/ add_mesh_column.py it is broken for months with no dev.

Brendon Murphy meta.androcto1 at gmail.com
Mon Oct 8 01:11:04 CEST 2012


Revision: 3829
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3829
Author:   meta-androcto
Date:     2012-10-07 23:11:02 +0000 (Sun, 07 Oct 2012)
Log Message:
-----------
moved add_column to branches/broken_stuff/add_mesh_column.py it is broken for months with no dev.
merge add stairs & wall factory to add_mesh_cad_objects

Modified Paths:
--------------
    contrib/py/scripts/addons/add_mesh_cad_objects/__init__.py

Added Paths:
-----------
    branches/broken_stuff/add_mesh_column.py
    contrib/py/scripts/addons/add_mesh_cad_objects/Blocks.py
    contrib/py/scripts/addons/add_mesh_cad_objects/Wallfactory.py
    contrib/py/scripts/addons/add_mesh_cad_objects/general.py
    contrib/py/scripts/addons/add_mesh_cad_objects/post.py
    contrib/py/scripts/addons/add_mesh_cad_objects/rail.py
    contrib/py/scripts/addons/add_mesh_cad_objects/retainer.py
    contrib/py/scripts/addons/add_mesh_cad_objects/stairbuilder.py
    contrib/py/scripts/addons/add_mesh_cad_objects/stringer.py
    contrib/py/scripts/addons/add_mesh_cad_objects/tread.py

Removed Paths:
-------------
    contrib/py/scripts/addons/add_mesh_column.py
    contrib/py/scripts/addons/add_mesh_stairs/
    contrib/py/scripts/addons/add_mesh_walls/

Added: branches/broken_stuff/add_mesh_column.py
===================================================================
--- branches/broken_stuff/add_mesh_column.py	                        (rev 0)
+++ branches/broken_stuff/add_mesh_column.py	2012-10-07 23:11:02 UTC (rev 3829)
@@ -0,0 +1,1092 @@
+#
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you may redistribute it, and/or
+# modify it, under the terms of the GNU General Public License
+# as published by the Free Software Foundation - either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, write to:
+#
+#	the Free Software Foundation Inc.
+#	51 Franklin Street, Fifth Floor
+#	Boston, MA 02110-1301, USA
+#
+# or go online at: http://www.gnu.org/licenses/ to view license options.
+#
+# ***** END GPL LICENCE BLOCK *****
+#
+
+bl_info = {
+    "name": "Columns",
+    "author": "Jim Bates, jambay",
+    "version": (0, 11),
+    "blender": (2, 5, 7),
+    "location": "View3D > Add > Mesh > Columns",
+    "description": "Add architectural column(s).",
+    "warning": "WIP - Initial implementation; updates pending and API not final for Blender",
+    "wiki_url": "http://www.uthynq.com/JBDoc/index.php?title=Column",
+    "tracker_url": "http://projects.blender.org/tracker/index.php?"\
+        "func=detail&aid=27655",
+    "category": "Add Mesh"
+}
+
+
+"""
+
+Create a column for use as an architectural element in a scene. Basically a glorified cylinder/cube.
+
+A column consists of three elements; base, shaft, and capital. They can be square or round, straight or tapered.
+ The base and capital are optional.
+
+The shaft may be fluted and twisted.
+
+Only one column is created, at the current 3D cursor, expecting the user to duplicate and place as needed.
+
+This script is based on features from add_mesh_gears, add_curve_aceous_galore.py, and add_mesh_BoltFactory/createMesh.py.
+
+"""
+
+#
+# List of "enhancements"/"fixes" needed to finalize this script.
+#
+# @todo: Round top and bottom of flutes.
+# @todo: Add "plinth" (square platform) to base and "finale" for capital - different proportions for base and capital but same objective.
+# @todo: Create Ionic and Corinthian style capitals. External "mesh", quadrant, mirror-x, select all/join, then mirror-y.
+#    will need to "scale" to match column radius (size to column).
+# @todo: Allow control of negative radius for base and column functions.
+#    Interesting effect (inverts), but want to use separate from column setting.
+#
+
+
+# Version History
+# v0.11 2011/06/14	Added width parameter for base and capital.
+# v0.10 2011/06/13	Consolidated base and capital "add" functions. More styles. Fixed taper with negative radius.
+# v0.09 2011/06/06	Column fluting - 90%. Added "sides" parameter for flutes, not sure I want to fix "odd" behavior.
+# v0.08 2011/05/24	Common function to generate base and capitals, more types added.
+# v0.07 2011/05/21	Added Capitals, more base types, general cleanup.
+# v0.06 2011/05/20	Changed radius usage, separated base from column and use spin to generate base.
+# v0.05 2011/05/19	Added closing faces (top and bottom) to base and column.
+# v0.04 2011/05/17	Major "cleanup"; Flutes now not square, but not rounded either.
+# v0.03 2011/05/16	Made "flutes" a value; added taper and base options to UI; added wiki and tracker links.
+# v0.02 2011/05/14	UI mods and param checks added.
+# v0.01 2011/05/13	Initial implementation.
+
+
+import bpy
+import mathutils
+from math import *
+from bpy.props import *
+
+# A very simple "bridge" tool.
+# Connects two equally long vertex rows with faces.
+# Returns a list of the new faces (list of  lists)
+#
+# vertIdx1 ... First vertex list (list of vertex indices).
+# vertIdx2 ... Second vertex list (list of vertex indices).
+# closed ... Creates a loop (first & last are closed).
+# flipped ... Invert the normal of the face(s).
+#
+# Note: You can set vertIdx1 to a single vertex index to create
+#       a fan/star of faces.
+# Note: If both vertex idx list are the same length they have
+#       to have at least 2 vertices.
+def createFaces(vertIdx1, vertIdx2, closed=False, flipped=False):
+    faces = []
+
+    if not vertIdx1 or not vertIdx2:
+        return None
+
+    if len(vertIdx1) < 2 and len(vertIdx2) < 2:
+        return None
+
+    fan = False
+    if (len(vertIdx1) != len(vertIdx2)):
+        if (len(vertIdx1) == 1 and len(vertIdx2) > 1):
+            fan = True
+        else:
+            return None
+
+    total = len(vertIdx2)
+
+    if closed:
+        # Bridge the start with the end.
+        if flipped:
+            face = [
+                vertIdx1[0],
+                vertIdx2[0],
+                vertIdx2[total - 1]]
+            if not fan:
+                face.append(vertIdx1[total - 1])
+            faces.append(face)
+
+        else:
+            face = [vertIdx2[0], vertIdx1[0]]
+            if not fan:
+                face.append(vertIdx1[total - 1])
+            face.append(vertIdx2[total - 1])
+            faces.append(face)
+
+    # Bridge the rest of the faces.
+    for num in range(total - 1):
+        if flipped:
+            if fan:
+                face = [vertIdx2[num], vertIdx1[0], vertIdx2[num + 1]]
+            else:
+                face = [vertIdx2[num], vertIdx1[num],
+                    vertIdx1[num + 1], vertIdx2[num + 1]]
+            faces.append(face)
+        else:
+            if fan:
+                face = [vertIdx1[0], vertIdx2[num], vertIdx2[num + 1]]
+            else:
+                face = [vertIdx1[num], vertIdx2[num],
+                    vertIdx2[num + 1], vertIdx1[num + 1]]
+            faces.append(face)
+
+    return faces
+
+
+#####
+#
+# @todo: fine-tune curvature for flutes.
+# @todo: handle odd number of sides (flat in middle).
+#
+def add_col_flute(angle, target, zpos, radius, Ad, sides=6):
+    """
+ Create "flute" for column at passed location.
+
+    Parameters:
+        angle - starting point for column faces.
+            (type=float)
+        target - angle offset to end point for column faces.
+            (type=float)
+        zpos - vertical position for vertices.
+            (type=float)
+        radius - column face radius from current 3D cursor position.
+            (type=float)
+        Ad - Flute "depth" offset from radius
+            (type=float)
+        sides - number of faces for flute
+            (type=int)
+
+    Returns:
+        newpoints - a list of coordinates for flute points (list of tuples), [[x,y,z],[x,y,z],...n]
+            (type=list)
+    """
+    newpoints = []
+
+    if sides < 2: sides = 2 # min number of sides.
+
+    halfSides = sides/2 # common value efficiency variable.
+
+    stepD = Ad/halfSides # in and out depth variation per side.
+
+    divSides = 0
+    curStep = 1
+
+    while curStep <= halfSides:
+        divSides += curStep*curStep
+        curStep+=1
+
+    stepCurve = target/(divSides*2) # logorithmic delta along radius for sides.
+
+    curStep = 0
+
+    t = angle
+
+    # curvature in
+    while curStep < halfSides:
+        t = t + (curStep*curStep*stepCurve)
+        x1 = (radius - (stepD * (curStep+1))) * cos(t)
+        y1 = (radius - (stepD * (curStep+1))) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        curStep+=1
+
+    # curvature out - includes mid-point, and end-point...
+    while curStep:
+        t = t + (curStep*curStep*stepCurve)
+        x1 = (radius - (stepD * curStep)) * cos(t)
+        y1 = (radius - (stepD * curStep)) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        curStep-=1
+
+    return newpoints
+
+
+# save a copy of add_col_flute, v 0.8, in case it gets "fixed"...
+# makes flower petal/notch effect...
+def add_notch(angle, target, zpos, radius, Ad, sides=6):
+
+    newpoints = []
+
+    if sides < 2: sides = 2 # min number of sides.
+
+    stepD = Ad/(sides/2) # in and out depth variation per side.
+    stepCurve = target/sides # points along radius for sides.
+
+    curStep = 0
+
+    # curvature in
+    while curStep < sides/2:
+        t = angle + (curStep*stepCurve)
+        x1 = (radius - (stepD * curStep)) * cos(t)
+        y1 = (radius - (stepD * curStep)) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        curStep+=1
+
+    # curvature out
+    while curStep:
+        t = angle + ((sides-curStep)*stepCurve)
+        x1 = (radius - (stepD * curStep)) * cos(t)
+        y1 = (radius - (stepD * curStep)) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        curStep-=1
+
+    # add the end point
+    x1 = radius * cos(angle+target)
+    y1 = radius * sin(angle+target)
+    newpoints.append([x1, y1, zpos])
+
+    return newpoints
+
+
+# save a copy of add_col_flute, v 0.4, in case it gets "fixed"...
+# this makes some interesting "fans" when addendum is more than radius
+def add_sawtooth(angle, target, zpos, radius, Ad, sides=6):
+    newpoints = []
+
+    step = target/sides
+    stepD = Ad/sides
+
+    i = 0
+    while i < sides:
+        t = angle + (i*step)
+        x1 = (radius - (stepD*i)) * cos(t)
+        y1 = (radius - (stepD*i)) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        i+=1
+
+    return newpoints
+
+
+# save a copy of add_col_flute, v 0.5, in case it gets "fixed"...
+# this makes some interesting "fans" when addendum is more than radius
+def add_sawtooth2(angle, target, zpos, radius, Ad, sides=6):
+    newpoints = []
+
+    step = target/sides
+    stepD = Ad/(sides/2)
+
+    # First point
+    x1 = radius * cos(angle)
+    y1 = radius * sin(angle)
+    newpoints.append([x1, y1, zpos])
+
+    # curve in...
+    i = 0
+    while i < sides/2:
+        t = angle + (i*step)
+        x1 = (radius - (stepD * i)) * cos(t)
+        y1 = (radius - (stepD * i)) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        i+=1
+
+    # curve out...
+    while i:
+        t = angle + ((sides - i)*step)
+        x1 = (radius - (stepD * i)) * cos(t)
+        y1 = (radius - (stepD * i)) * sin(t)
+# Interesting... not "regular" if this is only change.
+#        y1 = (radius + (stepD * (sides - i))) * sin(t)
+        newpoints.append([x1, y1, zpos])
+        i-=1
+
+# Also cool -

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list