Sorry for this late answer, I've been bussy with other things....
Don't know about Python (I would like to, but who knows when I will have time...). Anyway , in CATScript you can get data like this (I see that mass and volum there is no problem for you, I just put it here to let others how they can get this parameters, they will find also CoG).
Language="VBSCRIPT"
CATIA.StatusBar = "Calculating inertia data and write user defined properties by ferdo"
'*********************************************************
' Purpose: This macro can be used interactively to compute inertia data for a CATPart
' Creation of some user defined properties
' Inputs : Part Name by selecting in graphic area
' Author: ferdo (Disclaimer: You use this code at your own risk)
'*********************************************************
Sub CATMain()
CATIA.DisplayFileAlerts = False
Dim objSelection 'as Selection
Set objSelection = CATIA.ActiveDocument.Selection
' clear selection
objSelection.Clear
' select root product (I suppose we have CATProduct document here
objSelection.Add CATIA.ActiveDocument.Product
CATIA.StartCommand "DESIGN MODE"
Dim Message, Style, Title, Response, MyString
Message = ( "This macro calculate standard inertia data and write them in user defined properties and works ONLY in CATPart. You can continue, a new window will open" &_
(chr(13)) &_
""&(chr(13))&_
" Do you want to continue ?")
Style = vbYesNo + vbDefaultButton1 'Define buttons.
Title = "Purpose "
Response = MsgBox(Message, Style, Title)
If Response = vbYes Then ' User chose Yes.
MyString = "Yes"
'Acquire the name from the user selection
Dim Doc As ProductDocument
Set Doc = CATIA.ActiveDocument
Dim Prod_Root As Product
Set Prod_Root = Doc.Product
Dim Prods_Root As Products
Set Prods_Root = Prod_Root.Products
Dim oSelection 'As Selection
Set oSelection = Doc.Selection
Dim Status As String
Dim InputObjectType(0)
Dim prt As Part
MsgBox "Select part in graphic area or in specification tree"
oSelection.Clear
InputObjectType(0) = "Part"
Status = oSelection.SelectElement2(InputObjectType, "Select a part", False)
If Status = "Normal" And oSelection.Count = 1 Then
Set prt = oSelection.Item(1).Value
CATIA.StartCommand "Open in new window"
End If
' Find the workbench
Dim TheSPAWorkbench As Workbench
Set TheSPAWorkbench = CATIA.ActiveDocument.GetWorkbench ( "SPAWorkbench" )
' Create the inertia
Dim ProductInertia As Inertia
Set ProductInertia = TheSPAWorkbench.Inertias.Add(prt)
' Get the inertia data
Dim St_Mass 'As Double
St_Mass = ProductInertia.Mass
Dim Coordinates(2)
ProductInertia.GetCOGPosition Coordinates
Dim St_Volume 'As Double
Set objPart = CATIA.ActiveDocument.Part
Set objRef = objPart.CreateReferenceFromObject(objPart.MainBody)
Set objSPAWkb = CATIA.ActiveDocument.GetWorkBench("SPAWorkbench")
Set objMeasurable = objSPAWkb.GetMeasurable(objRef)
St_Volume = objMeasurable.Volume
Dim filename As String
filename = CATIA.ActiveDocument.Name
Set iProduct = CATIA.ActiveDocument.Product
Set parameters1 = iProduct.UserRefProperties
Set iparameter2 = parameters1.CreateString("File_Name", Cstr(filename))
Set iparameter3 = parameters1.CreateString("CATIA_Mass (kg)", Cstr(St_Mass))
Set iparameter4 = parameters1.CreateString("CATIA_Volume (m3)", Cstr(St_Volume))
Set iparameter5 = parameters1.CreateString("Gx", Cstr(Coordinates(0)*1000) & "mm")
Set iparameter6 = parameters1.CreateString("Gy", Cstr(Coordinates(1)*1000) & "mm")
Set iparameter7 = parameters1.CreateString("Gz", Cstr(Coordinates(2)*1000) & "mm")
End If
End Sub
Regards
Fernando