FreeCAD: How to calculate a volume, surface area and gravity center of a shape?

Update: January 7, 2018
FreeCAD 0.17
  1. Select [View]-[Panels]-[Python console] in menu bar to display Python console].

  2. If you enter following commands, each value will be displayed in Python console.

    • If you want to calculate a surface area : App.ActiveDocument.getObject("Your object name").Shape.Area
    • If you want to calculate a volume : App.ActiveDocument.getObject("Your object name").Shape.Volume
    • If you want to calculate a gravity center  : App.ActiveDocument.getObject("Your object name").Shape.CenterOfMass
  3. Note: If shape's ShapeType is "Compound", a gravity center cannot be calculated with the method previously described. To check shape's ShapeType, execute following command.

    • App.ActiveDocument.getObject("Your object name").Shape.ShapeType

    If shape's ShapeType is "Compound", you can use Shape.solids to get each solid's gravity center.

    • App.ActiveDocument.getObject("Your object name").Shape.Solids[0].CenterOfMass
    • App.ActiveDocument.getObject("Your object name").Shape.Solids[1].CenterOfMass
    • ...
Python console Python console