Center of Gravity of a Generic Model Element

I am trying to find the center of gravity for a generic model family I use for self perform concrete. I am having a little trouble getting the script to work. The list shows up “empty”. When I do it on a wall it works fine, so I am not sure what I need to change in the family or the script for it to work.

Can you share that family? The issue lies in the fact that Element.Geometry is not working on that family and we (the community) might be able to diagnose it or come up with a different method of getting the info out of it. Does it have nested families? Are there Cad Imports or Meshes inside the family?

This is likely caused by a bug that was recently fixed:


I’ve run into this problem a lot and I’ve come to prefer using the center point of the element’s bounding box.
It’s not only more robust and reliable, but also more lightweight, especially on larger projects.

EDIT: The next release of Clockwork is going to have a node that retrieves the bounding box centroid. You can download it here:
https://raw.githubusercontent.com/andydandy74/ClockworkForDynamo/master/nodes/1.x/BoundingBox.Properties.dyf

The bounding box won’t get you the center of gravity which is weighted by the volume and placement of the element. In the example image, the center of gravity would be offset towards the railing and upwards from the bounding box center.

True. I’ve only used the bounding box centroid to determine element locations for Revit elements that don’t have a location property.
If it has to be the center of gravity and the Dynamo geometry library won’t give you what you want, you could try the Revit API. You can get all the (Revit) solids in a Revit element using Clockwork’s Element.Geometry+ node - this should include the ones that Dynamo can’t convert (which is what is causing the Element.Geometry node to fail). And Revit solids can be queried for their centroids (http://www.revitapidocs.com/2017/42d79808-231b-f802-f574-6b799c95b871.htm) and volumes (http://www.revitapidocs.com/2017/4b4088b8-2096-e7f8-d72f-fc1402592967.htm). Add density to the mix and you have masses for all solids (and their respective centers of gravity).
And then I guess you’ll have to do some maths… :wink:
https://math.stackexchange.com/questions/914723/center-of-mass-in-3d-object

1 Like

I forgot about mass of the element! Yeah… lots of math.

I did a little thing here: http://jbdynamo.blogspot.no/2016/12/ammo-centre-of-gravity.html?m=1 if it could be of any help. It requires a density as a physical property in the elements materials since I was using it for both concrete and steel elements all at once. Do your family have any nested families? Then you may have to extract the subelements before you can get the solids.

1 Like

Hi @bradwitt,

Lately i have also been experimenting with this simple method.
I found it here: https://www.linkedin.com/pulse/center-gravity-dynamo-jason-murray

  • For one element (precast concrete) it seems to give the correct center of gravity.
  • I’m not sure if the below graph creates the right center of gravity for multiple elements (you will have to check that).
  • If you use different materials, i think you need a more complex method, like @jostein_olsen mentioned.

I hope it can help you to solve your problem.

Kind regards,
Mark

1 Like

Thank you all for your help, this helped. I have to go back through the nested families and check to see if they were built correctly, but for the most part it seemed to work!

You can also check this.

Move by vector:
see below thread "zwaartepunten.dyn

Edwin