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

How to move an object only in x axis

$
0
0

@architecthanhao wrote:

I’m trying to move some boxes in their z-axis, but not in x and y axes. Below is my code. However, the last line coed moves my boxes in same x, y axes. How can I keep x, y axes only move the z aixs?

        if red < 40 and green < 40 and blue < 100:
            width = 6000
            depth = 6000
            height = 3000
            p1 = [i/3,j,0]
            p2 = rs.VectorAdd (p1, [width,0,0])
            p3 = rs.VectorAdd (p2, [0,depth,0])
            p4 = rs.VectorAdd (p3, [-width,0,0])
            p5 = rs.VectorAdd (p1, [0,0,height])
            p6 = rs.VectorAdd (p2, [0,0,height])
            p7 = rs.VectorAdd (p3, [0,0,height])
            p8 = rs.VectorAdd (p4, [0,0,height])
            boxGarage = rs.AddBox ([p1, p2, p3, p4, p5, p6, p7, p8])
            rs.ObjectColor(boxGarage, (red, green, blue))
            for l in range(height):
                rs.MoveObject(boxGarage, (0, 0, random.randint(0,l)))

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 5835

Latest Images

Trending Articles



Latest Images