Read inserted block scale

blocks
unhandled

#1

Hi,
If I have a file with multiple blocks scaled in random factors, can I read the scaling factor somewhere?

I tried _what, but I don’t know exactly how to read Transformation data, it stops making sense when I rotate the block.

Thanks
Jonas


(Pascal Golay) #2

Hi Jonas - looks like GH can help - it has a component for that - I’ll see if I can make it do something useful in this case.

-Pascal


#3

Are you sure about that? Last I checked GH couldn’t read blocks with a plug-in, and being able to back out scale fromm the transformation matrix according to Dale is cumbersome. I wish Rhino would have stored each transformation of a given block so it would be easier reset certain ones without affecting the others.


(Pascal Golay) #4

Well, it has a component, yes, but that only spits out the numbers in the matrix, it does not extract the individual transforms, so, back to the drawing board.

Here’s a python that maybe gets it right - give it a spin -
@djnelson75, @Jonish

ExtractInstanceScaling.py (639 Bytes)

-Pascal


#5

Thanks I will give it a shot. Where in GH do you find the ability to reference blocks? I must be missing something.


(Pascal Golay) #6

Hi Dennis, I used a GUID component, and a python component to get the matrix from the object-

image

-Pascal


#7

Ahh I see. Thanks.


#8

Do I need to download some Python plugin or can it be done via C#?

Thanks
J


(Pascal Golay) #9

Hi J - I’m sure that py file is easy to translate to c#… it’s only a few lines. You can test using
RunPythonScript

or

! -RunPythonScript "Full path to py file inside double-quotes"

If you need it in GH, the same code should work fine in a script component.

GetBlockInstanceScaling.gh (11.6 KB)

-Pascal


#10

Thank Pascal, I guess that solves it. I’m surprised it’s that hard to find out a block scaling factor.

Cheers
Jonas


#11

The python script seems to work for backing out the scaling factor, what if you wanted to find the rotation. How would you go about finding out those values?


(Pascal Golay) #12

Hi Dennis - it’s a little more complicated but possible, I think, I just have not been able to get to it.

-Pascal


#13

I would look into Elefront, which lets you extract block base plane.

Something like…