On This Page
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 videos below to learn more about how this extension 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 and Videos
Following are some verification screenshots. The first image shows 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 nonlinear shape made with a B-Spline plugin and its properties.
Extension Terms and Conditions
BY INSTALLING, ACCESSING OR USING THIS SOFTWARE, YOU (THE USER) AGREES TO BE BOUND BY THE TERMS AND CONDITIONS AS PROVIDED BELOW.
LICENSE:
This is free software, provided under the GPL license (https://www.gnu.org/licenses/gpl-3.0.html).
(c) Alexander Schreyer, alexschreyer.net
DISCLAIMER:
THIS SOFTWARE IS PROVIDED ‘AS IS’ AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR ANY COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF OR IN CONNECTION WITH THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN THIS SOFTWARE.
WHERE APPLICABLE, THIRD-PARTY MATERIALS AND THIRD-PARTY PLATFORMS ARE PROVIDED ‘AS IS’ AND THE USER OF THIS SOFTWARE ASSUMES ALL RISK AND LIABILITY REGARDING ANY USE OF (OR RESULTS OBTAINED THROUGH) THIRD-PARTY MATERIALS OR THIRD-PARTY PLATFORMS.
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. You can also find this plugin on GitHub.
TIP: Installing Extensions in SketchUp
To install these files, follow the SketchUp folks’ instructions.
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.
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.