# Medium height of a volume

#1

Hello,

is there a way to calculate the “medium or avarage height” of a Volume?

thanks

#2

It’s not clear what you mean by “average height”. For example, if you are thinking of a collection of buildings and you want to know the average height of their tops, that is one thing (it assumes that the bottoms are not relevant). If you are thinking of a bunch of shapes and you mean the average difference between their min and max z values, that is a different thing.

So, please provide some more discussion of what you need (an example image would be useful).

#3

Sorry,

what I meant is your second option:

the average difference between their min and max z values

#4

So you mean median not medium?

#5

In italy we call it medium height, what I mean is Zmed=(Zmin+Zmax)/2 for two heigts, but I need it for a Volume with several heigts.

#6

OK. The required math is quite simple, but there is to my knowledge no built-in way to do it via the SketchUp GUI. There might be an extension that provides this statistic, but I don’t know of it.

So, that leaves the question: are you comfortable doing some Ruby programming or purely a non-programmer? Also is the volume a group or component?

#7

I am a non programmer,
the volume is a group.

So in English is called median height?

#8

@daniel.piccinelli There is median and there is average. The average is just that, the average of all the values. Median is the value that’s in the middle of the range. See: https://www.vocabulary.com/articles/chooseyourwords/mean-median-average/

#9

English has terms for various statistics:

• the average, or mean is the sum of the values divided by the number of values
• the median is a number such that half the values are larger and half are smaller. When there is an odd number of values, the median is one of the values. When there is an even number of values, it is usually taken to be half way between the two values closest to the middle.
• the mode is the value that happens the most frequently

If you select the group then open the Ruby Console window and copy-paste the following into it, it will calculate the answer:

``````bb=Sketchup.active_model.selection[0].bounds;(bb.max[2]+bb.min[2])/2
``````

#10

If the volume is of variable height but with straight vertical sides, you would get the average height by dividing its volume with its base area.

Anssi

#11

Are you just interested in the highest point and lowest point in the volume? Or something more like the centre of gravity, which is affected by the shape of the volume?

For example the centre of gravity of a pyramid is lower than that of a cube of the same height on the same level.