How can I get the moments of inertia on a body?
Pernelle Marone-Hitz
Member, Moderator, Employee Posts: 864
✭✭✭✭
Best Answer
-
The following code can be used:
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)]
2
Answers
-
Note that this solution relies on undocumented commands, which are outside of any Quality Assurance (QA) programs and may not be forward compatible. Use at your own risk.
1