hexagon logo

aggregate_mass via Python code

Hello,
 
I am looking for a way to calculate the moments of inertia of a part at a specific reference marker with Pyton code.
 
I would like to avoid the trick of calling a cmd line within my Python code.
 
Regards,
Chris
  • Hi Chriss!
     
    Just run:
     
    import Adams
    Adams.evaluate_exp("AGGREGATE_MASS({.Model_1.PART_2, .Model_1.PART_3}, .Model_1.ground.MARKER_3, 'inertias')")
     
    if you have the marts and markers stored in object p2,p3 and m3 then do (using f-strings):
    import Adams
    inertias = Adams.evaluate_exp(f"AGGREGATE_MASS({{{p2.full_name}, {p3.full_name}}}, {m3.full_name}, 'inertias')")
     
    Regards
    Thomas