[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2636] contrib/py/scripts/addons/ add_mesh_stairs: Bux fixes & continued setup for C-channel code.

Paul Marshall portsidepaul at hotmail.com
Sun Nov 20 19:12:26 CET 2011


Revision: 2636
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2636
Author:   brikbot
Date:     2011-11-20 18:12:25 +0000 (Sun, 20 Nov 2011)
Log Message:
-----------
Bux fixes & continued setup for C-channel code.

Modified Paths:
--------------
    contrib/py/scripts/addons/add_mesh_stairs/__init__.py
    contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py
    contrib/py/scripts/addons/add_mesh_stairs/stringer.py

Modified: contrib/py/scripts/addons/add_mesh_stairs/__init__.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_stairs/__init__.py	2011-11-20 11:50:31 UTC (rev 2635)
+++ contrib/py/scripts/addons/add_mesh_stairs/__init__.py	2011-11-20 18:12:25 UTC (rev 2636)
@@ -1,6 +1,6 @@
 # Paul "BrikBot" Marshall
 # Created: July 24, 2011
-# Last Modified: Spetember 20, 2011
+# Last Modified: November 20, 2011
 # Homepage (blog): http://post.darkarsenic.com/
 #                       //blog.darkarsenic.com/
 #
@@ -31,8 +31,8 @@
     "name": "StairBuilder",
     "author": "Nick van Adium",
     "version": (1,1),
-    "blender": (2, 5, 9),
-    "api": 40249,
+    "blender": (2, 6, 0),
+    "api": 41875,
     "location": "View3D > Add > Stairs",
     "description": "Creates a straight-run staircase with railings and stringer",
     "warning": "Add-on is very feature incomplete beyond basic functionality.",

Modified: contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py	2011-11-20 11:50:31 UTC (rev 2635)
+++ contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py	2011-11-20 18:12:25 UTC (rev 2636)
@@ -44,7 +44,7 @@
 #       - "T" staircase
 #
 # Last Modified By: Paul "brikbot" Marshall
-# Last Modification: August 29, 2011
+# Last Modification: November 20, 2011
 
 #-----------------------------------------------------------
 # BEGIN NEW B2.5/Py3.2 CODE
@@ -229,6 +229,9 @@
                            description = "Number of stringers to generate",
                            min = 1, max = 10,
                            default = 1)
+    string_dis = BoolProperty(name = "Distributed",
+                              description = "Use distributed stringers",
+                              default = False)
     string_w = FloatProperty(name = "Stringer width",
                              description = "Width of stringer as a percentage of tread width",
                              min = 0.0001, max = 100.0,
@@ -283,6 +286,7 @@
                 box.prop(self, 'rEnable')
                 box.prop(self, 'lEnable')
         else:
+            self.use_original = False
             box.prop(self, 'rEnable')
             box.prop(self, 'lEnable')
             
@@ -349,8 +353,10 @@
             if self.typ == "id1":
                 if self.typ_s == "sId1" and not self.use_original:
                     box.prop(self, 'string_n')
+                    box.prop(self, 'string_dis')
                 elif self.typ_s in ["sId2", "sId3"]:
                     box.prop(self, 'string_n')
+                    box.prop(self, 'string_dis')
                     box.prop(self, 'string_h')
                     box.prop(self, 'string_tw')
                     box.prop(self, 'string_tf')
@@ -442,8 +448,8 @@
                          self.tread_o,
                          self.string_tw,
                          self.string_tf,
-                         not self.string_g,
-                         self.string_tp)
+                         self.string_tp,
+                         not self.string_g)
             elif typ == "id3":
                 Stringer(G,
                          typ,
@@ -461,7 +467,7 @@
                          self.string_tf,
                          self.string_tp,
                          not self.string_g,
-                         1, False)
+                         1, False, False)
             else:
                 Stringer(G,
                          typ,
@@ -480,5 +486,6 @@
                          self.string_tp,
                          not self.string_g,
                          self.string_n,
+                         self.string_dis,
                          self.use_original)
         return {'FINISHED'}

Modified: contrib/py/scripts/addons/add_mesh_stairs/stringer.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_stairs/stringer.py	2011-11-20 11:50:31 UTC (rev 2635)
+++ contrib/py/scripts/addons/add_mesh_stairs/stringer.py	2011-11-20 18:12:25 UTC (rev 2636)
@@ -13,7 +13,7 @@
 # 
 # Paul "BrikBot" Marshall
 # Created: September 19, 2011
-# Last Modified: September 20, 2011
+# Last Modified: November 20, 2011
 # Homepage (blog): http://post.darkarsenic.com/
 #                       //blog.darkarsenic.com/
 #
@@ -46,27 +46,28 @@
                                 intersect_line_line)
 
 class Stringer:
-    def  __init__(self,G,typ,typ_s,rise,run,w,h,nT,hT,wT,tT,tO,tw,tf,tp,g,nS = 1,notMulti=True):
+    def  __init__(self,G,typ,typ_s,rise,run,w,h,nT,hT,wT,tT,tO,tw,tf,tp,g,nS=1,dis=False,notMulti=True):
         self.G = G #General
         self.typ = typ # Stair type
         self.typ_s = typ_s # Stringer type
         self.rise = rise #Stair rise
         self.run = run #Stair run
         if notMulti:
-            self.w=w/100 #stringer width
+            self.w = w / 100 #stringer width
         else:
-            self.w=(wT*(w/100))/nS
+            self.w = (wT * (w / 100)) / nS
         self.h = h #stringer height
-        self.nT=nT #number of treads
-        self.hT=hT #tread height
-        self.wT=wT #tread width
-        self.tT=tT #tread toe
+        self.nT = nT #number of treads
+        self.hT = hT #tread height
+        self.wT = wT #tread width
+        self.tT = tT #tread toe
         self.tO = tO #Tread overhang
         self.tw = self.w * (tw / 100) #stringer web thickness
         self.tf = tf #stringer flange thickness
         self.tp = 1 - (tp / 100) #stringer flange taper
         self.g = g #does stringer intersect the ground?
-        self.nS=nS #number of stringers
+        self.nS = nS #number of stringers
+        self.dis = dis #Use distributed stringers
         # Default stringer object (classic / sId1):
         self.faces1=[[0,1,3,2],[1,5,3],[3,5,4],[6,7,9,8],[7,11,9],[9,11,10],
                      [0,2,8,6],[0,1,7,6],[1,5,11,7],[2,3,9,8],[3,4,10,9],[4,5,11,10]]
@@ -102,11 +103,15 @@
         # C-beam stringer (C-Beam / sId3):
         self.faces4=[[]]
         self.Create()
-        
+
+
     def Create(self):
         if self.typ == "id1":
             if self.typ_s == "sId1":
-                offset = (self.wT / (self.nS + 1)) - (self.w / 2)
+                if self.dis or self.nS == 1:
+                    offset = (self.wT / (self.nS + 1)) - (self.w / 2)
+                else:
+                    offset = 0
                 for i in range(self.nS):
                     for j in range(self.nT):
                         coords = []
@@ -121,9 +126,12 @@
                         for k in coords:
                             k += j*Vector([self.run, 0, self.rise])
                         self.G.Make_mesh(coords,self.faces1,'stringer')
-                    offset += self.wT / (self.nS + 1)
+                    if self.dis or self.nS == 1:
+                        offset += self.wT / (self.nS + 1)
+                    else:
+                        offset += (self.wT - self.w) / (self.nS - 1)
             elif self.typ_s == "sId2":
-                self.IBeam()
+                self.I_beam()
         elif self.typ == "id2":
             if self.typ_s == "sId1":
                 coords = []
@@ -142,7 +150,9 @@
                     i += Vector([0, self.w + self.wT, 0])
                 self.G.Make_mesh(coords, self.faces2, 'stringer')
             elif self.typ_s == "sId2":
-                self.HousedIBeam()
+                self.housed_I_beam()
+            elif self.typ_s == "sId3":
+                self.housed_C_beam()
         elif self.typ == "id3":
             h = (self.rise - self.hT) - self.rise #height of top section
             for i in range(self.nT):
@@ -155,7 +165,10 @@
                     coords.append(coords[j] + Vector([0,self.wT,0]))
                 self.G.Make_mesh(coords, self.G.faces, 'stringer')
 
-    def IBeam(self):
+        return {'FINISHED'}
+
+
+    def I_beam(self):
         mid = self.w / 2
         web = self.tw / 2
         # Bottom of the stringer:
@@ -164,7 +177,12 @@
         topZ = -self.rise - self.hT
         # Vertical taper amount:
         taper = self.tf * self.tp
-        offset = (self.wT / (self.nS + 1)) - mid
+
+        if self.dis or self.nS == 1:
+            offset = (self.wT / (self.nS + 1)) - mid
+        else:
+            offset = 0
+
         # taper < 100%:
         if self.tp > 0:
             for i in range(self.nS):
@@ -197,7 +215,154 @@
                                                          Vector([0, 0, topZ]),
                                                          Vector([0, 0, 1]))
                 self.G.Make_mesh(coords, self.faces3a, 'stringer')
+
+                if self.dis or self.nS == 1:
+                    offset += self.wT / (self.nS + 1)
+                else:
+                    offset += (self.wT - self.w) / (self.nS - 1)
+        # taper = 100%:
+        else:
+            for i in range(self.nS):
+                coords = []
+                coords.append(Vector([0, offset,                baseZ]))
+                coords.append(Vector([0, offset + (mid - web),  baseZ + self.tf]))
+                coords.append(Vector([0, offset + (mid - web),  topZ - self.tf]))
+                coords.append(Vector([0, offset,                topZ]))
+                coords.append(Vector([0, offset + self.w,       topZ]))
+                coords.append(Vector([0, offset + (mid + web),  topZ - self.tf]))
+                coords.append(Vector([0, offset + (mid + web),  baseZ + self.tf]))
+                coords.append(Vector([0, offset + self.w,       baseZ]))
+                for j in range(8):
+                    coords.append(coords[j]+Vector([self.run * self.nT, 0, self.rise * self.nT]))
+                self.G.Make_mesh(coords, self.faces3b, 'stringer')
                 offset += self.wT / (self.nS + 1)
+                
+        return {'FINISHED'}
+
+
+    def housed_I_beam(self):
+        webOrth = Vector([self.rise, 0, -self.run]).normalized()
+        webHeight = Vector([self.run + self.tT, 0, -self.hT]).project(webOrth).length
+        vDelta_1 = self.tf * tan(self.G.angle)
+        vDelta_2 = (self.rise * (self.nT - 1)) - (webHeight + self.tf)
+        flange_y = (self.w - self.tw) / 2
+        front = -self.tT - self.tf
+        outer = -self.tO - self.tw - flange_y
+
+        coords = []
+        if self.tp > 0:

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-extensions-cvs mailing list