How to get Coordinates from Block A to Block B using python script in Block B

Hi!
Been looking for a way to get coordinates from one block to another using python script.
Setup is two blocks: A and B. Im trying to get block A’s X coordinate to block B using python script in block B.

I’ve tried to create property for block A which I could read easily, but I can’t get it to work (the value doesn’t change when I move the object).

Happy labor day!

Found this post about PositionMatrix and it solved my problem.

BlockA=app.findComponent(‘BlockA’)
BlockAPosition=BlockA.PositionMatrix
BlockAX=BlockAPosition.P.X
print(BlockAX)

if someone could tell me what the P stands for?

Hi @Unnahi

The application has built-in help documentation that will provide answers to such questions.


The same page also has ready-made examples on how to manipulate position matrices and get the relative position between objects.

1 Like