Pack rectangle works but place rectangle in wrong position

Hi everyone,

I am using the GREAT node from Refinery package Packing.PackRectangles node. It works fine for the packing part, but place all the packed rectangles in the wrong position, with a kind of offset… I have been looking for a reason but I can’t find one!

Does anyone has an idea or has already faced the issue? Maybe @JacobSmall, pro of Generative design might be a savior? (Thanks for the AU course btw !! great !)

Containers (6 rectangles)

Results:

Script:

Can you try to remove the @L1 on the containers input, and disable all geometry previews except the initial containers outline and the count come rectangles? If that doesn’t solve it please share the data set and I’ll add it to my list for tonight.

1 Like

Thanks for your help Jacob !

Here are the lines of the initials containers.

Here are the packed rectangles withtout @L1

Here with @L1

Grid along corridor.dyn (140.2 KB)

So what I can see is that it actually work fine work the packing part. The algorithm goes well, just these rectangles are not in the right sport. Sometimes not event in the rght direction. It is as if the node reshaped my contaners rectangle and switched width and length.

Just did a test for one of my accounts, and the behavior replicates. Some steps to resolve:

  1. Get the boundingbox of the object sets, and each container.
  2. If the container box is wider or longer than the objects (helps to build a vector by the min and max point of the bounding boxes), rotate all objects in the container by 90, otherwise leave them in place.
  3. Build a vector from the object set bounding box’s minimum point to the container’s bounding box minimum point.
  4. Move the rotated (or not) container set by the vector. Watch your lacing and list levels here.

With that you should be good to go.

1 Like

It worked fine with the translation.
I just need to translate the elements.

So here is the result:
I give dynamo one polyline that is the center of my corridor, and two widths in and out of that corridor. I obtain this result, based on 4 typologies of room (each with a different width), randomly placed (at the moment):

Thanks to Refinery package, the rooms have been placed along the blue corridor. Now let’s run that with Generative design, proximity score etc…

Thanks a lot !
1,5 day of work but the result is here :slight_smile:

6 Likes

Amazing!!!
Could you share the script?

1 Like

This is brilliant - would be amazing if you were able to give a breakdown on how you achieved this

2 Likes

I agree. This would be a good user group presentation, or AU session. :slight_smile:

3 Likes

Thanks Guys !
I will post the script from last year soon on this thread if you want it :slight_smile:

@JacobSmall I didn’t have much time in the last 10 months to push that forward, but I will :slight_smile:
By the way, I was exploring a new approach, with a different strategy, and I face the same problem with the “Packing.Packrectangles” node… I did the exact same thing as last time, but to translate the rectangles to the right position is not as simple as last time… I don’t see any logic this time… Do you know if you guys are planning to update the node ? to fix this bug ?

It works around the courtyards, but not in the other areas… and sometimes the rectangles are placed horizontally, some times vertically… I cant figure out why haha :wink:Roomplacing_R22_v3.dyn (420.2 KB)

Because your containers are all nearly the same depth as your objects, perhaps using a 2D bin packing algorithm to place a coordinate system would be better suited? Will take some coding of your own, but shouldn’t be too hard and the results would be entirely in your control.

Hmm interesting !
I have been definitely exploring this direction.

Thanks a lot Jacob !! I will keep you I touch with my results, and if they are conclusive why not talk about a potential AU session next year :slight_smile:

And btw I have the same problem with small items to pack:

So it looks like it is not related to the size of items or containers… If never you have an other idea :slight_smile: But again a thousand time for your answers

I tried again this morning with the Miscellany Package nodes. They worked great, but I have have a problem for 2 container :slight_smile:

All my containers and items are generated on 0,0,0. I can then translate them easily to the right position. 10 out of 12 are generated in the right direction (vertically or horiz.), only 2 of them (number 10 and 12) are turned… It is quite funny :slight_smile: and annoying haha
@Thomas_Corrie any ideas ?

It looks correct at first sight, because the correct amount of horiz and vertical containers are generated, but it is not because of these 2 containers that are wrong…

I think I found the solution.

The rectangles generated out of my surfaces were somehow turned. It means that Rect.Width and Rect.Height didn’t not match Rect.DeltaX and Rect.DeltaY ! Then the binpacking issue makes sense, because it is recreating some containers based on their Width and Length, matching respectively X and Y . (and Z…)

So I reordered my points properly, and it works:

image

@JacobSmall I think these changes might make the default PackRectangle node work better as well :slight_smile: I need to test that

2 Likes

Hey @JacobSmall !
Just to keep you in touch I have succeeded, and the script works well.

The only thing is that it doesn’t achieve to create more than one preview, even if the output look are correctly calculated… Do you have any idea why ? I think that must be a common issue. I never had with the old GD version (or refinery):

First time I have seen this… let me loop in development. :slight_smile:

Hi,

If you switch to the list view what numerical values are displayed for the second and third grid options?

Thanks,

Neal, QA for the Generative Design team


I guess it is just a diplay issue. Because when I playing with it it kind of work. I quit, I restart, I go to another study, or to the list view as @Neal_Burnham suggested and it somehow works sometimes :slight_smile:

Maybe @JacobSmall you want to right a feedback on this topic… I guess it is not especially related to my study :slight_smile: