Nesting component

Hello, I’m creating a plugin nesting, I’m working with components but I’m having difficulty in terms of rotation, it doesn’t respect the definition of x, y and z global.

    components.sort_by of the |component|
      size_score = component.bounds.width * component.bounds.height
      aspect_ratio_score = (component.bounds.width / component.bounds.height).abs
      random_factor = rand

-size_score * (1 + random_factor) * (1 + aspect_ratio_score)
    End
  End

Please post code with preceding and following lines containing three backtick characters so the forum software formats it for display. As is, your code is hard to read!

Also please edit your forum profile to contain correct information instead of lazy nonsense.

3 Likes

OK. Edited

I don’t see any connection between the subject of the topic, your question and the code you posted. The code have missing lines, syntax errors and wrong method.

In fact your post have less sense than what you written in your forum profile information. Both are completely pointless.

Sorry, I’ll try to express it better, I’m having difficulty in a code, I created a nesting plugin for furniture parts, when I rotate the part the code reads the boundaries of the component globally and not its actual size.

What did you edit?

I guess the code you posted above is a part of your “nesting plugin”.
Since you wrote it, can you please explain row by row what it means, and how does it connected to any kind of rotation?
Can you explain whatever the “nesting plugin” means?

Have you heard about:

The ComponentInstance #transformation method is used to retrieve the transformation of this instance.

The Group #transformation method is used to retrieve the transformation for the group.