Get accurate face properties: Centroid, Area, Moment of Inertia and Radius of Gyration

## Description

A little while ago, I had a need for calculating centroids for planar shapes. To be more exact, my students had the need since I gave them an assignment that required this. Not knowing of a plugin for SketchUp that would accomplish this feat, they did it in Rhino or AutoCAD instead.

To rid SketchUp of this shortcoming, I decided to re-use some old Pascal code of mine and try my hand at writing a plugin for this. Here is now the result.

This plugin will calculate area properties for planar shapes (Centroid, Area, Perimeter, Moment of Inertia, Radius of Gyration). These shapes must be drawn parallel to the X-Y plane (the ground plane) in SketchUp (you can lay faces flat in SketchUp using my Flatten Faces plugin). Of course these shapes must be closed so that a single face is generated by SketchUp.

To calculate area/face properties, select one or more of these shapes and choose “Get Face Properties” from the right-click context menu. The plugin will then calculate area properties for each face successively. These will be displayed in a dialog that allows for copying of values. As a final step, a construction point and a set of X-Y crosshairs can be drawn at the area centroid. See the image below for details:

To be able to accurately calculate faces that contain internal holes, you must draw single lines for each internal hole that connect the hole to the face perimeter (as shown in the image above). Watch the following video to learn more about how this plugin works:

**Please note:** There are other plugins available that use a similar concept and draw a centerpoint. Those plugins usually do that for the center of the bounding box, which only in the case of a rectangle coincides with the area centroid. Please note also that if you are looking at curved shapes, the accuracy of the calculations is dependent on the accuracy of the polygonal shape. While SketchUp draws lines exact, curves are always approximated by a polyline.

## Usage

To calculate area properties, select one or more faces and choose **Get Face Properties** from the right-click context menu.

## Downloads

You can now find this plugin in Trimble’s Extension Warehouse. For an easy install (and update notifications), browse to it from inside SketchUp (2013 or newer) and install it directly.

### Alternative Downloads

Download “Face Centroid (RBZ)” as_facecentroid_1-3.rbz – Downloaded 2476 times – 4 KB

Download “Face Centroid (ZIP)” as_facecentroid_1-3.zip – Downloaded 6707 times – 4 KB

To install these files, follow the SketchUp folks’ instructions.** Important if you had installed an older version than v.1.2 of this plugin: **Please delete the files “as_getcentroid.rb” and/or “GetCentroid.rb” in your SketchUp plugins folder. Version 1.2 uses a different file name and subfolder setup.

You can also find this plugin on GitHub.

## Screenshots

These are some verification screenshots. The first image shows simply a rectangle and a triangle and a geometric centroid determination.

The following shape is a quarter of a circle with a radius of 2 ft and an arc made of 12 segments. If the border were a perfect arc, then the area should result to Pi (3.1416 etc.) ft^2 but SketchUp as well as this plugin calculate it as 3.1326 ft^2. This is due to SketchUp approximating all curved edges as polylines.

The image below shows a shape made with a B-Spline plugin and its properties.

## Revision History

**Version 1.3**(3/5/2014):

– Added limit to only use 10 faces at a time

– Removed the need for flipping of faces

– No more @mod variable

– Better unit handling(2/19/2014):**Version**1.2

– Removed the Tools menu item, now only context menu

– Cleaned up code

– Results uses multiline textbox for simplicity

– Properties display now displays model units

– Dialog for option to draw crosshairs(unreleased):**Version**1.1

– Changed results box to WebDialog. Looks nicer and all values

can be copied at the same time.

– Checks normal that face is coplanar to XY

– Adds height so that centroid is shown at height of face(10/11/2008):**Version**1.0

– First version

## References

- Wendehorst,
*Bautechnische Zahlentafeln*(1998). B.G. Teubner, Stuttgart. 28. Auflage.