Whenever you ask “what is the Y direction for block1” the answer is always (0, 1, 0) in block1’s own coordinate space, because that’s the Y axis. The more interesting question is “what is the Y direction for block1 in the coordinate space of N”, where N is some other node.
In this case, since you’re talking about rotating your brush to match the block’s orientation, perhaps you mean you want to know the Y direction of block1 in the coordinate space of the brush’s parent node, which is the same coordinate space in which you will need to rotate the brush. To ask this question, you can ask Panda:
v = brush.getParent().getRelativeVector(block1, (0, 1, 0))
But I don’t honestly know you are going to do with that vector. It’s just a direction; it’s not a rotation. If you want to rotate the brush to the same orientation as the block, you have to ask for the block’s HPR rotation in the coordinate space of the brush’s parent:
hpr = block1.getHpr(brush.getParent())
brush.setHpr(hpr)
A shorter way to do the same thing is with:
brush.setHpr(block1, 0, 0, 0)
which asks the brush to set itself to hpr (0, 0, 0) in block1’s coordinate space, which is the same thing as block1’s hpr expressed in the brush’s parent’s coordinate space.
But all of this relies on the assumption that the rotations you speak of are expressed in scene graph transforms. I don’t know where your blocks came from, but if you created the stack of blocks in a modeling package such as Blender, and then exported the whole scene into Panda via an egg file, then the individual transforms of the blocks may be baked into the vertices, and no longer available to you. In this case, block1.getHpr() will always return (0, 0, 0) no matter which coordinate space you ask it to switch to, since all blocks will have the same coordinate space. If this is your case, then you will need to use more caution when converting your scene to Panda, and add the appropriate tags to each block so that Panda knows not to bake out the transforms.
David