Boolean Solids only if they Intersect


#1

Using the Boolean Union, Reduce, and First of Lists nodes I can join several solids into one.

I’d like the nodes to only bind solids that intersect with each other. So if I’ve got 2 sets of intersecting solids that don’t intersect each other I’d like the nodes to return 2 solids rather than 1. Any thoughts on how to do this?

Thanks


#2

I don’t have dynamo .7 with me at the moment, but I would either look to see if there is a solid/surface intersection test, or you can create a simple collision test using axis aligned bounding boxes, that won’t work all the time, but will be fast.

If Boolean Intersection exists, you can just see if it returns something right?


#3

Maybe the method Geometry.DoesIntersect can help :slight_smile:

Using DesignScript in a Code Block Node:

SolidAB=SolidA.DoesIntersect(SolidB)?SolidA.Union(SolidB):{SolidA,SolidB};

If you are using it a lot, maybe you can integrate it in a function for easy use (and when load library is available again you will get a node directly after loading the function)

def UnionOnlyIfIntersect (SolidA, SolidB)

{return=SolidA.DoesIntersect(SolidB)?SolidA.Union(SolidB):{SolidA,SolidB};
};

By the way, you can join several solids directly with UnionAll

 


#4

So only in 0.7.0?

That’s a problem because that version doesn’t have an Element to Solid node (yet?) and that precedes the series I’m working on now.


#5

03

I haven’t checked if it is working, but it seems that we have already the node in 0.7.0. If you are taking the solids from another program (they are not done natively in Revit), import from SAT works really well.

 


#6

Maybe I’m using it wrong but it’s not doing what I expect.

Previously, in 0.6.3, I used an Element to Solid node that took a list of Revit elements and converted them to solids. When I attempt the same here I get an error.


#7

Hey Greg,

If you try the daily builds, pBoyer recently put in some pretty miraculous functionality with Element.Geometry. This does a conversion from just about any Revit element into more pure geometry (there are a couple dicey things, like revolves I believe).

2014-05-07_2229


#8

I have implemented the DS function in a custom node with some additional functionality when joining set of solids.
03

I have tried to publish it with the package manager , but I am getting an error. You can download here anyway:

SolidA and SolidB can be individual solids or list of solids. In the case that SolidA and/or SolidB are lists of solids, “Join before” is a true/false argument that control if the solids of the list will be joined in a global solid before, or the method will be applied element by element. If both are individual solids, true or false in “Join Before” doesn’t make any difference.

When SolidA and SolidB are both list of solids, and “Join before” is false, both lists must have the same number of elements. The solids will be compared in pairs. The solid of one list, against the solid in the same position in the other list, returning the solid joined or the pair of original solids if they do not intersect.

When either SolidA or SolidB is a individual object and the other is a list, and “Join before” is false, the result will be the individual solid joined with only the solids of the list that intersect. This is maybe the most interesting funcionality

02

The possibility of using functions inside a custom node is only available from some days ago. So make sure that you are using the latest build.

Give it a try and please let me know how is going