Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 6023

Quirky Indenting in Rhino Python Editor

$
0
0

@krsnadas wrote:

Well, this is a little embarrassing but this piece of code for a tile render script seems to be acting bizarre. The problem seems to be within MoveTarget. The function returns the correct value of center in the first two while loops but in the third while loop, it returns the same value without adding adding distance to it. Why??

def MoveTarget(current,direction,distance):
    if direction == 'Up':
        current.Z= current.Z + distance
    if direction == 'Left':
        current.X= current.X - distance
    if direction == 'Down':
	current.Z= current.Z - distance
    if direction == 'Right':
	current.X= current.X + distance
    return Rhino.Geometry.Point3d(X, Y, Z)

#Move left until the left edge exceeds bb left (X)
while pt[0].X > bb[0].X:
	center= MoveTarget(center, 'Left', horizontal)
	rs.ViewTarget('Front',center)

#Move up until the top edge exceeds bb top (Z)
while pt[2].Z < bb[4].Z:
	center= MoveTarget(center, 'Up', vertical)
	rs.ViewTarget('Front', center)

while pt[2].Z > bb[0].Z:
    #Move right and count until right edge exceeds bb right
    while pt[0].X < bb[1].X:
        center= MoveTarget(center, 'Right', horizontal)
        rs.ViewTarget('Front', center)

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6023

Trending Articles