Geometric Center/Center Location of Listed Elements?

I’m looking to find the Geometric Center Location of Listed elements, so that I can group them together.

Specifically I have am interested in finding the center of various MEP Pipe elements, and would like to be able to select only the elements in which their center is within a particular view/scopebox.

I have a script now that collects elements from a selected view and then sets a parameter value accordingly. Minor issue is that most of the time the pipe is present in two views. So when I run the script for [Scope Box A] it designates [A] in the parameter, however when I continue onto [Scope Box B] which is right next door, it grabs some of the same elements and overrides those values with [B].

Is there a way to select elements, only if their Centers’ are within a View/Scopebox?

1 Like

This would require you getting the element geometry, combining it, then getting the centroid of the combined solid. You’ll probably run into issues combining some of the solids and it’s rather data intensive. You would probably be better off getting the locations of your elements. Any elements with a curve-based location could use the midpoint of the curve.

2 Likes

This should work for most elements:
bounding box from element.
Average of bounding box min point and bounding box max point for the center.
Then find out if your point is within the desired scope box/space/whatnot.

4 Likes

@Nick_Boyts @jacob.small Thank you for your responses. So I’m trying to convert the elements into solids (individually) and I think I might be setting it up wrong in some way. Is the “Element.Solids” node the incorrect node to be using?

Or did I misunderstand you?

1 Like

I do not believe fabrication parts have solids. Try Element.BoundingBox as an alternative in the workflow I mentioned.

2 Likes

That works great, I used the “BoundingBox.Properties” Node from Clockwork and it can output the Centroid.

Now I just have to figure out a way to designate an area and determine individually if the Centroid locations reside within a view or not.

1 Like

Did you figure out how to assign elements by their center within scopebox.

could you please share it.

thanks,

@jacob.small

I did not understand 100% sir.

could you please share something on how do you assign element to boundary box by center of that element.

thanks