Face Centroid and Area Properties Extension for SketchUp

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

Displayed results

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 extension 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 first 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 (or the Tools menu). The extension will then calculate area properties for each face successively. All properties will be listed in a leader text 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 extensions 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. You can also find this tool under the Tools menu.

Did you find this extension useful? Contribute to its development with any amount (via PayPal):

Screenshots

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

Face Centroid Plugin: Verification

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.

Face Centroid plugin circle

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

Face Centroid plugin: Bezier

Show Off Your Work

Did you create something amazing with this extension? I would love to see it! You can either upload an image in the comment section below (public) or privately send it to me.

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

Linked below are the installation files (RBZ and ZIP formats) for the current and some previous versions of this extension.

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.

Revision History

  • Version 1.4 (5/6/2020):
    – Code cleanup
    – Fixed loader code
    – Added menu items to Tool menu
    – Added Help link to site
    – Now draws face information as text
    – Face limit increased to 50 (due to new speed)
    – Adds text and crosshairs to new layer
  • 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
  • Version 1.2 (2/19/2014):
    – 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
  • Version 1.1 (unreleased):
    – 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
  • Version 1.0 (10/11/2008):
    – First version

References

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

Comments and Reactions