May I ask how to find the Angle of a Block in Python?

May I ask how to find the Angle of a Block in Python?

If I already inserted a Block, how can I select the Block [4096] and find out its angle.

Thanks

Andres

Hi,
If you know how to convert it to angle, you can get the transformation matrix of the inserted block with this rhinoscriptsyntax function :

| BlockInstanceXform(object_id) | Returns the location of a block instance relative to the world coordinate
| system origin (0,0,0). The position is returned as a 4x4 transformation
| matrix
| Parameters:
| object_id = The identifier of an existing block insertion object

I can’t give you more explanation cause I studied this too long ago. But it might be possible to extract the angle from this matrix. You make a quick search on Google …

Hi Andres,
you can get the transformation of the block and use it to PointTransform the coordinates which give you the angle you are interested in.

HTH, Jess

Jess

Thanks so much, I will try to figure out the angle today…

Andres

BaptisteC

Thanks a lot!!!

Andres

You’re welcome.
Please note that one transformed axis does not cover all possible rotations of a block transformation.
There is a rvb script from Dale to decompose a transformation matrix. Should not be too hard to convert to Python:
https://github.com/mcneel/rhinoscript/blob/master/DecomposeXform.rvb

Good Luck,
Jess