Closed DynaBimm closed 1 year ago
I dont think bulletsharp is an easy fix for your issue inside Revit.
However, I will give it a try to see if I can code an alternative function to the OOTB function.
It's not about Revit, where we can use Bimorph nodes. Often we need to find intersections of Solids in Dynamo only, before interacting with Revit. Some additional thread about using Bullet physics for Collision Detection: https://pybullet.org/Bullet/phpBB3/viewtopic.php?t=12706
Thanks a lot!
Well, you started mentioning "DoesIntersect". That is a function inside Revit, and you complained that this was slow. Besides, it is a bit out of my scope to implement “bullet physics”. However, I have a solution for your clash detection which might do the job faster then you are used to.
It looks like the below image. I have made two functions, and if I can manage it, will it be released next time I upload a new build
The functions takes an element (or list of elements) and check if any element is intersecting, it can then either return the element or a boolean
Well, all Orchid is all about speed and completeness!
But imagine, we're talking about Solids in Dynamo Sandbox. No Revit yet. 10000 solids, some of them are intersecting. If we use Geometry.DoesIntersect, it will calculate 10000^10000 times, it takes so much time. And if we'll have some effective multithreaded algorithm(maybe Bullet), we can calculate intersections much faster. After that, we unite intersecting solids, getting info and generating families in Revit. I'm using it for cutting walls and floors with MEP systems. If we have 5 tubes near, we cut only one hole. In terms of speed, i'm avoiding interaction with Revit, until possible. The generation of unnecessary objects in Revit costs me about 1 hour each time with complex buildings.
Thanks for you patience!
From a computational point of view is the problem is more or less the same whether it is in Revit or somewhere else. If you take 1000 elements and compare those against 1000 elements, then it is an n2 problem. This is the worst kind of problem.
That’s why I tried to see if there was some kind of other way to do it.
I looked at the options in the revit api and found that this could be solved slightly differently. It is still a problem that demands more than a big O solution would do.
I have not calculated my function, but I presume that the Revit team has done this. Meaning when I use the API filtering methods, then will I expect they are designed to be as fast as possible.
If I then implement that as clever as I can, then should this be the most efficient way to do it.
By having a node there takes two inputs, this shows me that it will end up in the worst-case scenario, while one input gives an idea that this is much faster. I tried even to make some algorithm in the function there could make it even faster.
If I find some more time, I will try to expand the “Intersection” functions, however, I am working on filtering nodes at the moment and has released a series of nodes for that, but they do take my spare time at the moment due to the complexity in filters.
You're absolutely right!
That's why i talking about Bullet. It's API can track many collisions in real time. It uses some much more effective than n2. I think, that is possible just use some "Bulletsharp.dll" and get results back to Dynamo.
"Bulletsharp is .NET wrapper for the Bullet physics library", and API is here: https://pybullet.org/Bullet/BulletFull/ Some info from this page: "Bullet can be used in several ways, as Full Rigid Body simulation, as Collision Detector Library...".
And one more thing about using Revit for collision detection. For now, i'm using Bimorph nodes, Element.IntersectsSolid. It's very fast. But i have to generate Revit elements(copies of my solids) just for finding intersections between that solids! Then i delete this temporary elements, process collision data and make final Revit elements. Too many unnecessary steps, i think.
Thanks a lot!
My function does not need "another" to see if there is collisions, however, I have expanded the function so it possible to filter against specific "categories" is such is provided. In my opinion is testing against other elements a "slow" way to check it, however, most likely the most needed way to do it for smaller datasets. Large datasets should not test thousands of elements against thousands of elements.
This is how nodes look now
I think this issue has been covered during the subsequent releases. I am closing this issue marked as solved.
Hello!
Often we need DoesIntesect info for thousands of solids, especially for MEP purposes. Bult-in detection is very slow, if we need 1000x1000 collision info, it calculates 1000^1000 times. Can we use bulletsharp for collisions detection? This engine has multithreading and has fast algorithm. Github Page: https://andrestraks.github.io/BulletSharp/
And some additional info about collisions in Bullet: https://pybullet.org/Bullet/phpBB3/viewtopic.php?f=9&t=12863&p=42631&hilit=GJK#p42631
Once again, thanks a lot for Orchid!