# Revit and Dynamo – Finding the Centroid (CoG) of Revit elements

I was recently asked by a contractor if Revit could report on the centroid of selected objects to facilitate crane lifts. For those of you that know Revit well the answer if normally no. However, Dynamo is really useful for this sort of task. I have created a simple family to represent the Centroid and added three shared parameters to report on the X,Y and Z coordinates.

As you can see from the above Dynamo graph the method is fairly simple and can be really useful for a number of scenarios in construction planning.

Here is a quick video showing the use of the Dynamo Graph.

## 18 thoughts on “Revit and Dynamo – Finding the Centroid (CoG) of Revit elements”

1. Tom Panzenhagen says:

Thank you for this post, very helpful. Is it possible to get the dimensions (Length and Width) from a specific corner of the element to the center of gravity? If so, any suggestions on how to pull that information?

1. Hi Tom,

We can get the bounding box and then work out the x and y from the centroid. It will depend on the shape of the element. Perhaps we could get a parameter value for length or width and get the value?

1. Tom says:

I was not able to find a way to link the two (centroid and the bounding box) so gave up on that. But thanks for the suggestion.

2. nancy says:

@ Lawrenceh – Can I have clearer image of the dynamo graph? or a file sample . I have the same problem and this would really help me so much!

3. Vinod Venkatesh says:

Hi Lawrenceh,
Thanks for the article, I can get the CoG based on density.
But I am wondering is there a way to calculate CoG based on weight? i want Revit to consider the form and weight of an object.

1. Hi Vinod, the blog is really describing centre of mass as opposed to centre of gravity. Just out of interest, what is the reason that you require this variance?

4. Hi Nancy, You should just be able to ‘zoom up’ on the post image. they are all 300ppi.

5. Vinod Venkatesh says:

Hi Lawrenceh,
I need to find out the Centre of buoyancy and Centre of gravity,the structural element would be combination of wood and concrete, so based on the concrete and wood weight the Centre of buoyancy and gravity changes.

6. Hi Vinod,

I think you can cut the solid at the water level and then calculate the CoG of the displaced water (the solid volume under water).

7. Vinod Venkatesh says:

Thank you Lawrenceh, so what i understand is i need to calculate individual element based on respective element weight right..

8. I think this will be correct. I would image that you could create a model line in Revit to represent the water level, create a surface in Dynamo and then use this to split the solids. You can then find the centroid of this which should be the centre of buoyancy

9. Vinod Venkatesh says:

Hi Lawrenceh,
Sorry to bother, is CoG is totally dependent on shape of geometry or also weight of the geometry? is there any possible way to calculate the CoG of multiple elements of same volume but different weight.

10. jh says:

Hi Lawrence,
This is exactly what I am after.
Is it possible to post a more high-res image of the Graph – It is a little bit too hard to read.

JH

1. Yep, let me check for you, I may still have the images

11. hi Lawrenceh,
Thank you for the article.
But I am having trouble when selecting model elements.
In my block of Element.Geometry and Flatten, it shows that my element contain solid and line, so it cannot be done when I use Solid.ByUnion because line is not solid.

So exactly how can I select my elements by solid only? (I have already turned off the analytical model before selecting.)

Thank you again.

1. Hi,

I think the best approach here is to filter your elements so only solids can pass into the union node. Try getting the element.name and then using the == node to return true or false. You can then filter the list of elements by the Boolean mask.