[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2951] contrib/py/scripts/addons/ add_mesh_stairs: Began implementing the treads of the circular staircase.
Paul Marshall
portsidepaul at hotmail.com
Fri Jan 27 05:39:50 CET 2012
Revision: 2951
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2951
Author: brikbot
Date: 2012-01-27 04:39:45 +0000 (Fri, 27 Jan 2012)
Log Message:
-----------
Began implementing the treads of the circular staircase. WARNING: there is a serious problem with the face generation with the circular staircase tread code will crash Blender.
Modified Paths:
--------------
contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py
contrib/py/scripts/addons/add_mesh_stairs/tread.py
Modified: contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py 2012-01-25 22:15:35 UTC (rev 2950)
+++ contrib/py/scripts/addons/add_mesh_stairs/stairbuilder.py 2012-01-27 04:39:45 UTC (rev 2951)
@@ -110,15 +110,17 @@
rad1 = FloatProperty(name = "Inner Radius",
description = "Inner radius for circular staircase",
min = 0.0, max = 1024.0,
- default = 0.2)
+ soft_max = 10.0,
+ default = 0.25)
rad2 = FloatProperty(name = "Outer Radius",
description = "Outer radius for circular staircase",
- min = 0.0001, max = 1024.0001,
- default = 0.5)
- deg = IntProperty(name = "Degrees",
- description = "Degrees per step",
- min = 5, max = 45, step = 5,
- default = 20)
+ min = 0.0, max = 1024.0,
+ soft_min = 0.015625, soft_max = 32.0,
+ default = 1.0)
+ deg = FloatProperty(name = "Degrees",
+ description = "Number of degrees the stairway rotates",
+ min = 0.0, max = 92160.0, step = 5.0,
+ default = 450.0)
center = BoolProperty(name = "Center Pillar",
description = "Generate a central pillar",
default = False)
@@ -166,6 +168,12 @@
description = "Number of cross section supports",
min = 2, max = 1024,
default = 4)
+ #special circular tread properties:
+ tread_slc = IntProperty(name = "Slices",
+ description = "Number of slices each tread is composed of",
+ min = 1, max = 1024,
+ soft_max = 16,
+ default = 4)
#for posts
make_posts = BoolProperty(name = "Make Posts",
@@ -294,14 +302,15 @@
box = layout.box()
box.prop(self, 'make_treads')
if self.make_treads:
- if not self.use_original:
+ if not self.use_original and self.typ != "id4":
box.prop(self, 'typ_t')
else:
self.typ_t = "tId1"
- box.prop(self, 'tread_w')
+ if self.typ != "id4":
+ box.prop(self, 'tread_w')
box.prop(self, 'tread_h')
box.prop(self, 'tread_t')
- if self.typ != "id2":
+ if self.typ not in ["id2", "id4"]:
box.prop(self, 'tread_o')
else:
self.tread_o = 0.0
@@ -313,6 +322,8 @@
box.prop(self, 'tread_sp')
if self.typ_t in ["tId3", "tId4", "tId5"]:
box.prop(self, 'tread_sn')
+ elif self.typ == "id4":
+ box.prop(self, "tread_slc")
# Posts
box = layout.box()
@@ -384,21 +395,39 @@
run = self.run
G=General(rise,run,self.tread_n)
if self.make_treads:
- Treads(G,
- typ,
- typ_t,
- run,
- self.tread_w,
- self.tread_h,
- self.run,
- self.rise,
- self.tread_t,
- self.tread_o,
- self.tread_n,
- self.tread_tk,
- self.tread_sec,
- self.tread_sp,
- self.tread_sn)
+ if typ != "id4":
+ Treads(G,
+ typ,
+ typ_t,
+ run,
+ self.tread_w,
+ self.tread_h,
+ self.run,
+ self.rise,
+ self.tread_t,
+ self.tread_o,
+ self.tread_n,
+ self.tread_tk,
+ self.tread_sec,
+ self.tread_sp,
+ self.tread_sn)
+ else:
+ Treads(G,
+ typ,
+ typ_t,
+ self.deg,
+ self.rad2,
+ self.tread_h,
+ self.run,
+ self.rise,
+ self.tread_t,
+ self.rad1,
+ self.tread_n,
+ self.tread_tk,
+ self.tread_sec,
+ self.tread_sp,
+ self.tread_sn,
+ self.tread_slc)
if self.make_posts and (self.rEnable or self.lEnable):
Posts(G,
rise,
Modified: contrib/py/scripts/addons/add_mesh_stairs/tread.py
===================================================================
--- contrib/py/scripts/addons/add_mesh_stairs/tread.py 2012-01-25 22:15:35 UTC (rev 2950)
+++ contrib/py/scripts/addons/add_mesh_stairs/tread.py 2012-01-27 04:39:45 UTC (rev 2951)
@@ -15,11 +15,11 @@
#
# Paul "BrikBot" Marshall
# Created: September 19, 2011
-# Last Modified: September 20, 2011
+# Last Modified: January 26, 2012
# Homepage (blog): http://post.darkarsenic.com/
# //blog.darkarsenic.com/
#
-# Coded in IDLE, tested in Blender 2.59.
+# Coded in IDLE, tested in Blender 2.61.
# Search for "@todo" to quickly find sections that need work.
#
# ##### BEGIN GPL LICENSE BLOCK #####
@@ -42,22 +42,23 @@
#
# ##### END GPL LICENSE BLOCK #####
+import mathutils
from copy import copy
-from math import sqrt
-from mathutils import Vector
+from math import radians, sqrt
+from mathutils import Matrix, Vector
class Treads:
- def __init__(self,G,typ,typ_t,run,w,h,d,r,toe,o,n,tk,sec,sp,sn):
+ def __init__(self,G,typ,typ_t,run,w,h,d,r,toe,o,n,tk,sec,sp,sn,deg=4):
self.G = G #General
self.typ = typ #Stair type
self.typ_t = typ_t #Tread type
- self.run = run #Stair run
- self.w=w #tread width
+ self.run = run #Stair run. Degrees if self.typ == "id4"
+ self.w=w #tread width. Is outer radius if self.typ == "id4"
self.h=h #tread height
- self.d=d #tread run
+ self.d=d #tread run. Ignore for now if self.typ == "id4"
self.r=r #tread rise
self.t=toe #tread nosing
- self.o=o #tread side overhang
+ self.o=o #tread side overhang. Is inner radius if self.typ == "id4"
self.n=n #number of treads
self.tk=tk #thickness of tread metal
self.sec=sec #metal sections for tread
@@ -68,6 +69,7 @@
else:
self.sp=0
self.sn=sn #number of cross sections
+ self.deg = deg #number of section per "slice". Only applys if self.typ == "id4"
self.tId2_faces = [[0,1,2,3],[0,3,4,5],[4,5,6,7],[6,7,8,9],[8,9,10,11],
[12,13,14,15],[12,15,16,17],[16,17,18,19],
[18,19,20,21],[20,21,22,23],[0,1,13,12],[1,2,14,13],
@@ -175,7 +177,7 @@
coords3.append(Vector([self.d - self.tk, baseY, height]))
for i in range(4):
coords3.append(coords3[i] + Vector([0, cW, 0]))
-
+
# Make the treads:
for i in range(self.n):
if self.typ_t == "tId1":
@@ -210,3 +212,31 @@
j += Vector([self.d, 0, self.r])
for j in coords:
j += Vector([self.d,0,self.r])
+ # Circular staircase:
+ elif self.typ in ["id4"]:
+ start = [Vector([0, -self.o, 0]), Vector([0, -self.o, -self.h]),
+ Vector([0, -self.w, 0]), Vector([0, -self.w, -self.h])]
+ print("CHAOS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
+ self.d = radians(self.run) / self.n
+ for i in range(self.n):
+ coords = []
+ # Base faces. Should be able to append more sections:
+ tId4_faces = [[0, 1, 3, 2]]
+ t_inner = Matrix.Rotation(-self.t / self.o, 3, 'Z')
+ coords.append(t_inner * start[0])
+ coords.append(t_inner * start[1])
+ t_outer = Matrix.Rotation(-self.t / self.w, 3, 'Z')
+ coords.append(t_outer * start[2])
+ coords.append(t_outer * start[3])
+ k = 0
+ for j in range(self.deg + 1):
+ k = (j * 4) + 4
+ tId4_faces.append([k, k + 2, k + 6, k + 4])
+ tId4_faces.append([k + 1, k + 3, k + 7, k + 5])
+ tId4_faces.append([k, k + 1, k + 5, k + 4])
+ tId4_faces.append([k + 2, k + 3, k + 7, k + 6])
+ rot = Matrix.Rotation(((self.d * j) / self.deg) + (self.d * i), 3, 'Z')
+ for v in start:
+ coords.append((rot * v) + Vector([0, 0, self.r * i]))
+ self.G.Make_mesh(coords, tId4_faces, 'treads')
+ return
More information about the Bf-extensions-cvs
mailing list