Space location parameter for ducts and pipes

Hello,

I am looking for a way to assign a shared parameter to MEP elements that indicates which space they are located in. I found a YouTube video showing how to assign the space to all elements that have a calculation point.

However, the problem is with ducts and pipes, which do not have a calculation point. I wrote a script where I retrieve the coordinates of the given elements. Since these elements are essentially lines, I calculate the midpoint of the line and compare it to the space coordinates. If the element’s coordinates are within a space, I assign the space name to my custom parameter (KM RE).

I have 16 spaces and 1703 ducts. As output, I only get 1 correct result, or in some cases 16 correct results when I change the lacing of Element.SetParameterByName, but I can’t achieve better results.

How should I adjust the lacing, or how should I write a better script to successfully assign the space name to the parameter for ducts and pipes, indicating the space where each element is located?

Since you’re comparing a list of volumes to a list of lines, you need a crosslace - each space needs to be checked against each line. This should produce, for each line, a sublist of trues/falses - you’d look for the index value of the trues as they would match the index value of the corresponding space.

A few things:

  • Unless something changed in recent versions of Dynamo, I believe bounding boxes are orthogonal rectangles. You might get some false positives based on space geometry (non-rectangular, off-angled spaces generating larger-than-applicable boxes).
  • GeniusLoci has some really good geometry comparison/intersect nodes that are computationally efficient - right now you have a little over 28,000 comparisons to make, and that take a while to process.
1 Like

There’s an archilab node Elements in Space which can do the heavy lifting

1 Like