Centroid and Area Properties Plugin for SketchUp
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. These shapes must be drawn on the X-Y plane (the ground plane) in SketchUp. Of course these shapes must be closed so that a single face is generated by SketchUp.
To calculate area properties, select one or more of these shapes and either choose "Get Face Centroid" from the Tools menu or the right-click context menu. The plugin will then calculate area properties for each face successively. These (area and moments Ix, Iy, Ixy) will then be displayed in a dialog that allows for copying of values. As final step, a construction point and a set of X-Y axes will be drawn at the area centroid. See the image below for details:
There are other plugins available that use a similar concept and draw a centerpoint. This is usually done for the center of the bounding box, which only in the case of a rectangle coincides with the area centroid. One example is the CenterPoint plugin available on Smustard.
Please note also that the accuracy of the calculations is dependent on the accuracy of the polygonal shape. While SketchUp draws lines accurately, curves are always approximated by a polyline.
Downloads
Download the following .rb file and drop it into the SketchUp plugin directory (usually at C:\Program Files\Google\SketchUp\Plugins\ in Windows). Then re-start SketchUp and look for the new menu item in the Tools menu.
Downloaded a total of 905 times
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 24 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.1394 ft^2. This is due to SketchUp approximating all curved edges as polylines.
The image below shows a shape made with the Uniform B-Spline plugin.
Revision History
- 1.0 (10/11/2008) - First version
To-Do
- Let plugin use file's unit system (currently it spits out only feet)
- Add some more parameters: radius of gyration etc.
- Calculate parameters for non-attached shapes
References
Wendehorst, Bautechnische Zahlentafeln (1998). B.G. Teubner, Stuttgart. 28. Auflage.
![[as]](http://www.alexschreyer.net/blog/wp-content/themes/alex-2009/img/as.png)








Discuss this Page
Previous Comments (newest first):
Alex said on December 22, 2008
@Maurice: I know, I know… it’s on my to-do list for winter break!
Maurice Lang said on December 22, 2008
Thanks for the plugin.
Can we have a metric version for the rest of the world please?
edgar farfan said on October 28, 2008
very good