[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3830] contrib/py/scripts/addons: rename add mesh cad objects to add mesh building objects to avoid confusion

Brendon Murphy meta.androcto1 at gmail.com
Mon Oct 8 01:45:25 CEST 2012


Revision: 3830
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3830
Author:   meta-androcto
Date:     2012-10-07 23:45:24 +0000 (Sun, 07 Oct 2012)
Log Message:
-----------
rename add mesh cad objects to add mesh building objects to avoid confusion

Added Paths:
-----------
    contrib/py/scripts/addons/add_mesh_building_objects/
    contrib/py/scripts/addons/add_mesh_building_objects/Blocks.py
    contrib/py/scripts/addons/add_mesh_building_objects/Wallfactory.py
    contrib/py/scripts/addons/add_mesh_building_objects/__init__.py
    contrib/py/scripts/addons/add_mesh_building_objects/add_mesh_balcony.py
    contrib/py/scripts/addons/add_mesh_building_objects/add_mesh_beam_builder.py
    contrib/py/scripts/addons/add_mesh_building_objects/add_mesh_sove.py
    contrib/py/scripts/addons/add_mesh_building_objects/add_mesh_window.py
    contrib/py/scripts/addons/add_mesh_building_objects/general.py
    contrib/py/scripts/addons/add_mesh_building_objects/post.py
    contrib/py/scripts/addons/add_mesh_building_objects/rail.py
    contrib/py/scripts/addons/add_mesh_building_objects/retainer.py
    contrib/py/scripts/addons/add_mesh_building_objects/stairbuilder.py
    contrib/py/scripts/addons/add_mesh_building_objects/stringer.py
    contrib/py/scripts/addons/add_mesh_building_objects/tread.py

Removed Paths:
-------------
    contrib/py/scripts/addons/add_mesh_cad_objects/

Added: contrib/py/scripts/addons/add_mesh_building_objects/Blocks.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_building_objects/Blocks.py	                        (rev 0)
+++ contrib/py/scripts/addons/add_mesh_building_objects/Blocks.py	2012-10-07 23:45:24 UTC (rev 3830)
@@ -0,0 +1,1683 @@
+# ***** 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 *****
+
+
+##
+#
+# Module notes:
+#
+# Grout needs to be implemented.
+# consider removing wedge crit for small "c" and "cl" values
+# wrap around for openings on radial stonework?
+# auto-clip wall edge to SMALL for radial and domes.
+# unregister doesn't release all references.
+# repeat for opening doesn't distribute evenly when radialized - see wrap around
+#   note above.
+# if opening width == indent*2 the edge blocks fail (row of blocks cross opening).
+# if openings overlap fills inverse with blocks - see h/v slots.
+# Negative grout width creates a pair of phantom blocks, seperated by grout
+#   width, inside the edges.
+# if block width variance is 0, and edging is on, right edge blocks create a "vertical seam".
+#
+##
+
+# <pep8-80 compliant>
+
+import bpy, time, math
+from random import random
+from math import fmod, sqrt, sin, cos, atan
+
+#A few constants
+SMALL = 0.000000000001
+NOTZERO = 0.01 # for values that must be != 0; see UI options/variables -
+# sort of a bug to be fixed.
+PI = math.pi
+
+#global variables
+
+#General masonry Settings
+settings = {'w': 1.2, 'wv': 0.3, 'h': .6, 'hv': 0.3, 'd': 0.3, 'dv': 0.1,
+            'g': 0.1, 'gv': 0.07, 'gd': 0.01, 'gdv': 0.0, 'b': 0, 'bv': 0,
+            'f': 0.0, 'fv': 0.0, 't': 0.0, 'sdv': 0.1, 'hwt': 0.5, 'aln':0,
+            'wm': 0.8, 'hm': 0.3, 'dm':0.1,
+            'woff':0.0, 'woffv':0.0, 'eoff':0.3, 'eoffv':0.0, 'rwhl':1,
+            'hb':0, 'ht':0, 'ge':0, 'physics':0}
+# 'w':width 'wv':widthVariation
+# 'h':height 'hv':heightVariation
+# 'd':depth 'dv':depthVariation
+# 'g':grout 'gv':groutVariation 'gd':groutDepth 'gdv':groutDepthVariation
+# 'b':bevel 'bv':bevelVariation
+# 'f':flawSize 'fv':flawSizeVariation 'ff':flawFraction
+# 't':taper
+# 'sdv':subdivision(distance or angle)
+# 'hwt':row height effect on block widths in the row (0=no effect,
+#     1=1:1 relationship, negative values allowed, 0.5 works well)
+# 'aln':alignment(0=none, 1=rows w/features, 2=features w/rows)
+#     (currently un-used)
+# 'wm':width minimum 'hm':height minimum 'dm':depth minimum
+# 'woff':row start offset(fraction of width)
+# 'woffv':width offset variation(fraction of width)
+# 'eoff':edge offset 'eoffv':edge offset variation
+# 'rwhl':row height lock(1 is all blocks in row have same height)
+# 'hb':bottom row height 'ht': top row height 'ge': grout the edges
+# 'physics': set up for physics
+
+# dims = area of wall (face)
+dims = {'s':0, 'e':PI*3/2, 'b':0.1, 't':12.3} # radial
+# 's':start x or theta 'e':end x or theta 'b':bottom z or r 't':top z or r
+# 'w' = e-s and h = t-b; calculated to optimize for various operations/usages
+#dims = {'s':-12, 'e':15, 'w':27, 'b':-15., 't':15., 'h':30}
+#dims = {'s':-bayDim/2, 'e':bayDim/2, 'b':-5., 't':10.} # bay settings?
+
+radialized = 0 # Radiating from one point - round/disc; instead of square
+slope = 0 # Warp/slope; curved over like a vaulted tunnel
+# 'bigblock': merge adjacent blocks into single large blocks
+bigBlock = 0 # Merge blocks
+
+# Gaps in blocks for various apertures.
+#openingSpecs = []
+openingSpecs = [{'w':0.5, 'h':0.5, 'x':0.8, 'z':2.7, 'rp':1, 'b':0.0,
+                 'v':0, 'vl':0, 't':0, 'tl':0}]
+# 'w': opening width, 'h': opening height,
+# 'x': horizontal position, 'z': vertical position,
+# 'rp': make multiple openings, with a spacing of x,
+# 'b': bevel the opening, inside only, like an arrow slit.
+# 'v': height of the top arch, 'vl':height of the bottom arch,
+# 't': thickness of the top arch, 'tl': thickness of the bottom arch
+
+# Add blocks to make platforms.
+shelfExt = 0
+#shelfSpecs = []
+shelfSpecs = {'w':0.5, 'h':0.5, 'd': 0.3, 'x':0.8, 'z':2.7}
+# 'w': block width, 'h': block height, 'd': block depth (shelf size; offset from wall)
+# 'x': horizontal start position, 'z': vertical start position
+
+# Add blocks to make steps.
+stepMod = 0
+stepSpecs = {'x':0.0, 'z':-10, 'w':10.0, 'h':10.0,
+    'v':0.7, 't':1.0, 'd':1.0 }
+# 'x': horizontal start position, 'z': vertical start position,
+# 'w': step area width, 'h': step area height,
+# 'v': riser height, 't': tread width, 'd': block depth (step size; offset from wall)
+
+
+    #easier way to get to the random function
+def rnd(): return random()
+
+    #random number from -0.5 to 0.5
+def rndc(): return (random() - 0.5)
+
+    #random number from -1.0 to 1.0
+def rndd(): return (random() - 0.5)*2.0
+
+
+#Opening Test suite
+#opening test function
+
+def test(TestN = 13):
+    dims = {'s':-29., 'e':29., 'b':-6., 't':TestN*7.5}
+    openingSpecs = []
+    for i in range(TestN):
+        x = (random() - 0.5) * 6
+        z = i*7.5
+        v = .2 + i*(3./TestN)
+        vl = 3.2 - i*(3./TestN)
+        t = 0.3 + random()
+        tl = 0.3 + random()
+        rn = random()*2
+        openingSpecs += [{'w':3.1 + rn, 'h':0.3 + rn, 'x':float(x),
+                          'z':float(z), 'rp':0, 'b':0.,
+                          'v':float(v), 'vl':float(vl),
+                          't':float(t), 'tl':float(tl)}]
+    return dims, openingSpecs
+
+#dims, openingSpecs = test(15)
+
+
+#For filling a linear space with divisions
+def fill(left, right, avedst, mindst=0.0, dev=0.0, pad=(0.0,0.0), num=0,
+         center=0):
+    __doc__ = """\
+    Fills a linear range with points and returns an ordered list of those points
+    including the end points.
+
+    left: the lower boundary
+    right: the upper boundary
+    avedst: the average distance between points
+    mindst: the minimum distance between points
+    dev: the maximum random deviation from avedst
+    pad: tends to move the points near the bounds right (positive) or
+        left (negative).
+        element 0 pads the lower bounds, element 1 pads the upper bounds
+    num: substitutes a numerical limit for the right limit.  fill will then make
+        a num+1 element list
+    center: flag to center the elements in the range, 0 == disabled
+        """
+
+    poslist = [left]
+    curpos = left+pad[0]
+
+    # Set offset by average spacing, then add blocks (fall through);
+    # if not at right edge.
+    if center:
+        curpos += ((right-left-mindst*2)%avedst)/2+mindst
+        if curpos-poslist[-1]<mindst: curpos = poslist[-1]+mindst+rnd()*dev/2
+
+        # clip to right edge.
+        if (right-curpos<mindst) or (right-curpos< mindst-pad[1]):
+            poslist.append(right)
+            return poslist
+
+        else: poslist.append(curpos)
+
+    #unused... for now.
+    if num:
+        idx = len(poslist)
+
+        while idx<num+1:
+            curpos += avedst+rndd()*dev
+            if curpos-poslist[-1]<mindst:
+                curpos = poslist[-1]+mindst+rnd()*dev/2
+            poslist.append(curpos)
+            idx += 1
+
+        return poslist
+
+    # make block edges
+    else:
+        while True: # loop for blocks
+            curpos += avedst+rndd()*dev
+            if curpos-poslist[-1]<mindst:
+                curpos = poslist[-1]+mindst+rnd()*dev/2
+            # close off edges at limit
+            if (right-curpos<mindst) or (right-curpos< mindst-pad[1]):
+                poslist.append(right)
+                return poslist
+
+            else: poslist.append(curpos)
+
+
+#For generating block geometry
+def MakeABlock(bounds, segsize, vll=0, Offsets=None, FaceExclude=[],
+               bevel=0, xBevScl=1):
+    __doc__ = """\
+    MakeABlock returns lists of points and faces to be made into a square
+            cornered block, subdivided along the length, with optional bevels.
+    bounds: a list of boundary positions:
+        0:left, 1:right, 2:bottom, 3:top, 4:back, 5:front
+    segsize: the maximum size before lengthwise subdivision occurs
+    vll: the number of vertexes already in the mesh. len(mesh.verts) should
+            give this number.
+    Offsets: list of coordinate delta values.
+        Offsets are lists, [x,y,z] in
+            [
+            0:left_bottom_back,
+            1:left_bottom_front,
+            2:left_top_back,
+            3:left_top_front,
+            4:right_bottom_back,
+            5:right_bottom_front,
+            6:right_top_back,
+            7:right_top_front,
+            ]
+    FaceExclude: list of faces to exclude from the faces list.  see bounds above for indices
+    xBevScl: how much to divide the end (+- x axis) bevel dimensions.  Set to current average radius to compensate for angular distortion on curved blocks
+    """
+
+    slices = fill(bounds[0], bounds[1], segsize, segsize, center=1)
+    points = []
+    faces = []
+
+    if Offsets == None:
+        points.append([slices[0],bounds[4],bounds[2]])
+        points.append([slices[0],bounds[5],bounds[2]])
+        points.append([slices[0],bounds[5],bounds[3]])
+        points.append([slices[0],bounds[4],bounds[3]])
+
+        for x in slices[1:-1]:
+            points.append([x,bounds[4],bounds[2]])
+            points.append([x,bounds[5],bounds[2]])
+            points.append([x,bounds[5],bounds[3]])
+            points.append([x,bounds[4],bounds[3]])
+
+        points.append([slices[-1],bounds[4],bounds[2]])
+        points.append([slices[-1],bounds[5],bounds[2]])
+        points.append([slices[-1],bounds[5],bounds[3]])
+        points.append([slices[-1],bounds[4],bounds[3]])
+
+    else:

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list