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.
PLEASE NOTE (9/20/2009): I have just noticed a potential bug when the area to be evaluated contains internal “holes” (openings). I will investigate and provide a fix soon. Until then, double-check your results in these cases.
Downloads
GetCentroid for SketchUp v.1.0 (6.5 KB, downloaded 5103 times) - PLEASE NOTE: Right-click on the link and download this Ruby (.rb ending) file. Then 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.
GetCentroid for SketchUp v.1.0 (RBZ version) (2.33 kB, downloaded 214 times) - PLEASE NOTE: Download the RBZ file. Then open SketchUp (v.8 M2 and above) and go to the Preferences dialog. On the Extensions tab, select "Install Extension..." and browse to the file.
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.
- http://alexschreyer.net Alexander Schreyer
- Ee_en_nu
- vodkins
- Gerrit Hubers
- Nico de Bruijn
- Nico de Bruijn
- http://www.neyses.de Michael Neyses
- chris
- Shannon
- billwheaton
- billwheaton
- http://S9K7 ali
- Daniel
- http://DEIELLS Daniel
- Maurice Lang
- http://cnpag.org edgar farfan
![[as]](http://www.alexschreyer.net/blog/wp-content/themes/alex-2012/img/as.png)




