Volume, center of mass and matrix of inertiaFor all solids you can get:
- volume - add
Shape.Volumeattribute to object,
- center of mass - add
- matrix of inertia - add
Cone (height = 40 mm, radius = 30 mm) named "Revolution"
Vector (6.11835e-15, 6.99401e-16, 30)
MatrixOfInertia attribute output needs some explanation:
Returns the matrix of inertia. It is a symmetrical matrix.So, we have 3 moments of inertia:
The coefficients of the matrix are the quadratic moments of inertia.
| Ixx Ixy Ixz 0 |
| Ixy Iyy Iyz 0 |
| Ixz Iyz Izz 0 |
| 0 0 0 1 |
The moments of inertia are denoted by Ixx, Iyy, Izz.
The products of inertia are denoted by Ixy, Ixz, Iyz.
The matrix of inertia is returned in the central coordinate system (G, Gx, Gy, Gz) where G is the centre of mass of the system and Gx, Gy, Gz the directions parallel to the X(1,0,0) Y(0,1,0) Z(0,0,1) directions of the absolute cartesian coordinate system.
Further explanation - FreeCAD forum.
Area of faceYou can measure area of face, simply add
Areaattribute. If you need area of a sketch, convert one to a face:
>>> face = Part.Face(App.ActiveDocument.getObject("Sketch").Shape)
If you have a solid (eg. a Pad), select face or faces on the solid object, and use this script:
area = 0.0
for o in Gui.Selection.getSelectionEx() :
for s in o.SubObjects:
area = s.Area
print "Area of selected face:" ,area