Face Centroid and Area Properties Extension for SketchUp

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

Displayed results


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.


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.


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.


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


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



51 thoughts on “Face Centroid and Area Properties Extension for SketchUp

  1. Hi, thanks for the great extension. Unfortunately, I cant get it to work b/c it is unsigned. I did download and install through the Extension Warehouse as well as direct install. But its not showing up. I would appreciate if can help me with this issue. Thanks.

    1. It should be signed if you installed it from the warehouse. Alternatively, you can go to the Extension Manager window and click on the gear symbol. Then go e.g. with the unrestricted loading policy.

  2. Hi, and thanks. This came in incredibly handy for optimising built-up sections for a wooden ramp. It was simple to tweak dimensions and design in SKUP, right-click and there is everything needed for deflection, weight, etc. Using the crosshairs I can get the distance to the most distant fiber for stress.

    What are rx and ry though? I thought they might be the x and y for the moment, but it doesn’t appear to be so.

    E: Sketchup 2016,

      1. Back to my Mechanics of Materials text for me.

        Thanks again, was extremely useful to avoid grinding out all the Ad^2 ‘s.

    1. My problem is that I need ^2 and ^4 units. I saw in your Lib that you have some code for area units but I couldn’t figure out how to implement this otherwise. Not sure if my method works with non-English locales, though.

        1. I did look at your library a bit but I also need length^4 for the Moments, so I don’t know yet how to do that.

          Also, when I plot centroid location in Architectural units, I wanted to have a decimal result with a fixed precision. That could be left to the user’s preferences, though (since they can just switch to it).

          1. Ha! Just found an elegant way to determine both the unit as well as the conversion factor:

            # Get the inch conversion factor
            mult = 1 / ( Sketchup.format_length(1)[/([0-9]+)(.|,)([0-9]+)*/].to_f )

            # Get the unit
            unit = Sketchup.format_area(1)[/[a-zA-Z]+/]

            Still a workaround but it works!

  3. Hi Alex. Looking at this plugin, I got a question and a suggestion.

    Question: The plugin says it needs to flip the normal of the faces to point up in the Z axis – why is this? If the order of the vertices matter for the calculation, can you not just reverse the array of vertices depending on the direction of the normal?

    Suggestion: In order to calculate for any face regardless of orientation you could collect the points and transform them to be in the 2D plane before doing your calculation.

    1. Hi Thomas, thanks for looking at this. I think you are correct that it is reasonably easy to make this work for any orientation. I just haven’t had the time to try it out. I’ll try your suggestions for the next update. If you like, feel free to push any code to GitHub for this…

  4. I just updated this plugin to v1.2. It fixes (hopefully) all of the bugs and introduces proper unit handling.

    Update from my site or wait until SketchUp approves it for the Extension Warehouse. If you are updating an older version, make sure you remove the files for the older version first.

  5. Hello Alexander,

    Thanks for the swift answer. The area works ok now. I am having a little trouble with converting the Ix-x values to cm^4. How does this work?

    Thanks, Jan.

    1. I need to add that to the plugin. Am hoping to get to it soon. For now, it might be best to just use Google search. Paste the value in as “100 in^4 in cm^4” and it should translate.

  6. Hello Alexander,

    I tried your plugin on a rectangle with sides of 1 foot. The area it calculates is 144.0000. What could be wrong? Sketchup calculates it as 1 Feet^2.

    Thanks, Jan.

  7. This worked initially however every time i open sketchup 8 (free version, not pro) an error message immediately pops up:
    “Error Loading File as_getcentroid.rb

    undefined method `GetString’ for nil:NilClass”

    And the centroid function doesn’t show in tools or when you right click on a face.? whats going on?

  8. Can someone one great day make a plugin for real working grid? I cant work in GSU without grid. I've tried all "grid' plugins, but all of them are not exactly what i want. Look at 3dsmax or UnrealEd – thats are real grids!

  9. Hi Alex, have you made any updates to this script so inner (encapsulated) voids are taken into account the correct way?

    The workaround that I use now is to temporarily create a narrow "channel" to connect the hole with the outside, with empty space outside the outer perimeter. It works but is cumbersome and needs re-correcting geometry afterwards.

    Wo3Dan / Gerrit

    1. Hi Gerrit,

      I intend to update my non-Ruby Editor plugins next, so this should happen soon.

      The fix I was working on last was similar in that I can separate the exterior vertices with outerloop and then create the channel automatically. I was getting stuck for cases where there were multiple internal voids.

      Cheers, Alex

      1. Hi Alex,

        Thans for the Ruby, makes my life a little easier!
        During the testing I'm experiencing the same problems as you have mentioned, even with only one void the measurement is incorrect. Hope you find the time to correct is soon. Have just another question. Isn't is possible during the calculation process thas the ucs is temporarily automaticly set on the plane that you are calculating. (maybe integrate another scritp). In working with large models it is very timeconsuming to set the plane (that is in Z-direction) on XY-0.
        And maybe it's an idear that the created centroidpoint can be exproted in 3D with the model to DWG.

        Thans anyway for your work!

      2. Hi Alex,

        Thans for the Ruby, makes my life a little easier!
        During the testing I'm experiencing the same problems as you have mentioned, even with only one void the measurement is incorrect. Hope you find the time to correct is soon. Have just another question. Isn't is possible during the calculation process thas the ucs is temporarily automaticly set on the plane that you are calculating. (maybe integrate another scritp). In working with large models it is very timeconsuming to set the plane (that is in Z-direction) on XY-0.
        And maybe it's an idear that the created centroidpoint can be exproted in 3D with the model to DWG.

        Thans anyway for your work!

  10. Terrific plugin – I have been looking for something like this for ages. How far off do you think you are at checking final accuracy? A metric version would be really terrific if that's possible. Thank you!!!!

  11. It looks like you got my message. I was debugging the code and noticed yesterday that fully enclosed polygons inside of other polygons don't work out right. Its because the vertices of any particular face don't differenciate the ones that are part of the outside, from the onces on the inside. A square offset within another square should have it's own centroid subtracted from the outer one. Likewise for multiple enclosed polygons their collective centroids should be subtracted from the outside polygon.

    The problem is, I don't know enough about ruby or the sketchup object model to know if they are kept separate somehow or if you just have to figure it out. But once that is known, it should be relatively straight forward.

      1. I had some luck with face.loops. If you do what you did with each loopin the collection, then it works out great. They must have ordered the inside loops backwards, because you don't even have to subtract out the missing areas – its done automatically just by adding.

        But I don't know about the Moments of inertia. haven't gotten to that part yet. In fact, I don't know how I would use them, really. I'll have to admit ignorance. Aren't they a measure of stiffness in bending, and for figuring out how strong a structure will be, like a beam? I am sure its important to what I am trying to do though.

        I find the centroid helpful, because I am trying to find the balancing point of the various parts of a telescope mount I am making. Finding the 3d centroid would be really helpful for that. Not sure how in ruby though.

        1. Thanks for looking so closely at it. Yes, the outside vertices run in one direction and the inside ones run in another. This takes care of the holes in both the centroid as well as the moment calculations. Both are nifty little algorithms that I found a while ago.

          I'll check tonight if I can make some changes to the code. The problem is that you have to use the same vertices when you are going from the outer loop to the inner loop and back – otherwise parts are missing.

          I have looked around for a 3D code. Would be great to have it, but I haven't been successful so far. I am assuming it would work similar (iterate through vertices).

  12. Quando clico em download aprece um texto apenas e sem calquer opção p/ baixar.

    Oplugnis vem pelo e-mail e é free?

Leave a Reply

Your email address will not be published. Required fields are marked *