Solid.Centroid bug with cylinder

There is a bug with Solide.Centroid with cylinders
The point found is 0,0,0
Bug already mentioned on the forum

https://forum.dynamobim.com/t/solid-centroid-returns-point-at-origin/47923

But I can’t find a solution for the moment
Any idea?

Try with your geometry scaling set to medium and see if that changes the outcome.

I saw this solution, but how does it affect the script afterwards?
Otherwise I tested with BoundingBox, but it does the union of each solid in sublist?

Leaving it on medium shouldn’t effect anything other than the geometry display in the Dynamo background preview. In current builds the ‘geometry scaling’ warning has been changed to an information popup instead to reflect this.

The center of a bounding box will not align with the center of a centroid, so this isn’t really a work-around I would recommend.

However if you want to look into it, instead of using a BoundingBox.ByGeometry which is a constructor under bounding box, try a Geometry.BoundingBox node. Alternatively you can use a BoundingBox.ByGeometry with the input set to @@L1

But scaling also talks about the precision of the calculation, right?
Otherwise, any idea for BoundingBox?

Scaling doesn’t impact geometry in a negative way of you leave it on medium.

The one possible exception I can think of is if you are using the display library’s tessellation tools (I only know one package which does this - Dynamo unfold).

Changing the scale to average is not possible.
I removed the display in dynamo and Revit, but it doesn’t change anything

How to get the midpoint of the cylinder axis with Solid or BoundingBox (Knowing that for the moment I have a problem with BoundingBox?

solidcentroid 3

Why not? Just ignore that warning and you’re good.