Hello. How can I find out if an element can be placed in a room? First I got the geometry of the room, then I got the geometry of the other elements in the room, then I found the geometry outside the elements as a surface. Thanks for your help.
Youâre going to need to provide more information. What do you mean by âif an element can be placed in a roomâ? If the element fits? If it can avoid intersection with other elements? Do you only care about the footprint of the element? How is it placed? Can it be rotated? Are there requirements that the room must meet?
All of these considerations will affect how you determine what âfitsâ and what doesnât. It sounds like you might have a packing problem but it could be simpler than that. Once we know what kind of problem youâre dealing with, we can start to suggest different approaches or packages.
Hello @Nick_Boyts. I want to find out if a cube with a width of 1 meter can fit in a room without intersection with other elements.
This is called a packing problem. I suggest you look into custom packages or python modules that can help with this. I believe Sparrow has some nodes that should help. Not sure if Refinery is supported anymore, but it used to have packing nodes as well. Itâs also a good idea to look into other threads that cover this kind of topic. The discussions there should give you a good starting point.
Once you have something put together we can answer any specific questions you may have.
Refinery toolkit still works as of 2.19. I havenât checked 3.0 builds. That said there are requirements which make it less useful in my opinion.
I recommend a Python or C# based solution leveraging coordinate systems.
Actually Revit API supported to do that with method IsPointInRoom
:
But you can try with orignal node in OpenMEP package in case use with complex purpose
https://chuongmep.github.io/OpenMEP/api/OpenMEPSandbox.Geometry.Point.html#OpenMEPSandbox_Geometry_Point_IsInPolygonPlus_Autodesk_DesignScript_Geometry_Point_Autodesk_DesignScript_Geometry_Polygon_
@chuongmep Thatâs just finding if a point is in the room. I think OP is trying to find out if a cube fits in the room - zero overlap with anything.
@yaseminV2XL5 âŚ
The packing algorithms arenât as good as humans yetâŚ
But working out if you have 1m squared in a room is a different problem maybe? Could have some fun with that one.
Maybe find the pole of inaccessibility then placing the centre of the object there and seeing if it clashes would be a nice way to go.
@Alien Where should I start for this?
I usually start by Googling and seeing whatâs been done before.
Whatâs this for?
Nah - theyâre plenty good in 2d or 3d - in fact theyâre orders of magnitude faster than we are in many cases. You just have to understand how to use them for what youâre after; this means we have to learn how to build them on our own. This is because in design we rarely âjust want things to fitâ, but instead âwant things to fit so we get a good outcomeâ. And so true packing algorithms arenât usually ideal for our use.
To use an analogy: itâs less about âfit the groceries in the bagâ and more about âfit the groceries in the bag so that cold things stay together and the eggs and bread donât get squished and the load is evenly balanced and I can unload it easily when I get home andâŚâ. And while we can build an algorithm to accomplish any one of those things, we canât build it in such a way as to enable all the things after that last and...
as humans arenât good at listing what all of those are, never mind deciding which are most important in every situation.
I stand by my comment⌠Humans are better at packing, eg, squishing the most stuff in a tight space⌠Putting stuff into a space with enough room left over to swing a moose isnât what Iâd call good packing.
Speed the computers win at. But hey, I can splash paint all over at a great speed, Michelangelo I am not.
The âsampleâ there was built from scratch in about an hour between calls a few months back, and doesnât allow for altering the provided objects in any way (ie no rotation relative to the location or resizing the object to âfill small areas otherwise unusedâ), all of which can be done.
A better example might be finding the way to best utilize stock of cut lumber, a problem which people very much struggle with, yet computers work though very consistently.
not sure guess @Thomas_Corrie have a package there can do soâŚcant remember the nameâŚbut a really good one next time you are shopping in Ikea
@sovitek Love that package.
@jacob.small Iâm not saying computers canât do stuff⌠And iâm not saying that script isnât cool⌠however itâs rectangles in a shape with lots of left over space, and some weird shapes and the computer struggles without super complex code and big processing, using lots of energy.
There are tonnes of articles and research on this subject, some amazing reads. For example MIT came up with a new method last year. And thereâs one from the American Airforce.
however, for the OP, I think my suggestion of pole of inaccessibility will work well for the single item.
If youâre only looking for one object to be placed anywhere within the given space, then I think a voxel workflow could work as well. Viability would be dependent on how âdetailedâ your space may be and would also have some edge cases for really tight areas. But as a quick and dirty method, could work pretty well.
@jacob.small I researched it. But does it only work on rectangles? Does it work in other geometries? Can we do this with PackingRectangles in RefineryToolkit?
@Nick_Boyts Yes,firstly I looking for only one object to be placed anywhere. You mean the VASA package, right?
Most packing algorithms assume regular shapes (typically rectangular or circular). If your objectâs footprint is a 1x1 meter square then you would use that as the packing objects, not the âfullâ geometry of the object.
Thatâs where Iâd start.
We should do this as a fun forum comp
@yaseminV2XL5 is this for work or for study? Iâm wondering why youâd want a 1m cube in a space.