Error with function: InternalObject.getMassMomentofInertiaofOneSelectedBody in 24R1
I use the script to get the moment of inertia of the selected body in Mechanical, which works fine in 23R2, however, the same script doesn't work since 24R1. The error massage is:
Could not convert argument 4 for call to getMassMomentofInertiaofOneSelectedBody.
It seems the arguments for ExtAPI.DataModel.Project.Model.InternalObject.getMassMomentofInertiaofOneSelectedBody have changed at 24R1. Any suggestions?
def GetMoments_byCS(body,CS,unitID=None):
if unitID == None:
unitID = ExtAPI.DataModel.InternalObject["ds"].UnitSystemID
cadUnits = ExtAPI.DataModel.Project.Model.Geometry.InternalObject.CADUnits
sm = ExtAPI.SelectionManager
smio = ExtAPI.SelectionManager.InternalObject
selection = sm.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
selection.Ids = [body.GetGeoBody().Id]
sm.ClearSelection()
sm.AddSelection(selection)
MMI = ExtAPI.DataModel.Project.Model.InternalObject.getMassMomentofInertiaofOneSelectedBody(unitID,cadUnits, smio, 1, CS.ObjectId)
return [MMI.Item(x+1) for x in range(6)]