## Mash-Rotation-Problem

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Modestiny
Posts: 1
Joined: Fri Dec 22, 2006 1:40 am

### Mash-Rotation-Problem

Hi,

have some problems with blender-python. I have wrote a script wich create a mesh-object, duplicates it, rotate the second 90 degrees and join the second to the first object. At next step the joined object should be rotate 45 degrees. But when I'm going to 3D-Window the joined object wasn't rotated.

Did anybody know what it is?

Thanx

Here the code:

Code: Select all

from Blender import *
from math import *
from Blender.Mathutils import *

omega = 1.618
dia = 0.025
floor_width = 1
floor_height = 2
pillar_rows = 2
pillar_cols = 2

def create_bow(sc, ri, deg, num):
c = (float(dia) * pi) / float(12)
a = (c * omega) / 2
b = omega * a * 2
n = 0
t1 = Mesh.New("Bow_Mash")
r = sqrt(ri * ri * 2) / 2 - dia / 2
for s in range(num):
LocX = (r * sin(((deg * rad) / (num - 1)) * n))# + (2 * a + c)
LocY = (r * cos(((deg * rad) / (num - 1)) * n))# + b
bX = (b * sin(((deg * rad) / (num - 1)) * n))
bY = (b * cos(((deg * rad) / (num - 1)) * n))
points = [[0, LocY + bY, LocX + bX], [a, LocY, LocX], [a + c, LocY, LocX], [(2 * a + c), LocY + bY, LocX + bX]]
t1.verts.extend(points)
edge = [[n * 4 + 0, n * 4 + 1], [n * 4 + 1, n * 4 + 2], [n * 4 + 2, n * 4 + 3]]
t1.edges.extend(edge)
if(n > 0):
t1.edges.extend([[old[0][0], edge[0][0]], [old[0][1], edge[0][1]], [old[1][1], edge[1][1]], [old[2][1], edge[2][1]]])
old = edge
n = n + 1
Mesh.Mode(Mesh.SelectModes['VERTEX'])
for v in t1.verts:
v.sel = 1
ob = Object.New("Mesh", "Bow")
t1.fill()
return(ob, a, c)

def make_cross(sc, ob, a, c):
Window.EditMode(0)
for o in Object.GetSelected():
o.sel = 0
ob.sel = 1
Object.Duplicate(1)
aob = sc.getActiveObject()
ob.LocX = -((2 * a + c) / 2)
aob.LocY = -((2 * a + c) / 2)
ob.join([aob])
ob.LocX = 0.5
ob.makeDisplayList()
Window.RedrawAll()