I've been struggling to create a solid solution to extract the moment of inertia of sub-assemblies in an assembly. Essentially, I have a robot model that exists in an assembly. The assembly is built up of many sub-assemblies which are themselves nested assemblies and parts. The sub-assemblies each represent a
"link" in the robot. I'd like to extract the moment of inertia for these "links". Obviously I can just select the assemblies and click mass properties to get the moment of inertia but I need to automate this since the frequency and number of links I will be needing to do this is prohibitive during the design process.
I already have an add-in that does most of what I need but I just can't get the moment of inertia to come out matching the correct inertia as seen in the mass properties box.
I have tried using a recursive get children and getbodies on the components and then using addbodies to a massproperty extracted from the top level model extension. I guess because the various parts are scattered in different documents this method does not work or so I've gathered from the documentation and these forums. The resulting numbers are garbage.
Is there some obvious way to get the mass properties for a subassembly in an assembly document that I am simply not seeing?
Forgive me if there is an obvious solution, good documentation on this API is just non-existent making even trivial matters much harder than they otherwise should be.
I am using C# for my addin but if you have a solution in VBA that is fine I'll just translate it.
The sub-assemblies inertia needs to be at the center of mass and aligned to the top level assembly's coordinate frame. Furthermore I'd like to get the center of mass of the sub-assemblies in the assemblies coordinate system as well.
I've attached a very simple example file consisted of 2 cubes each made of 2 rectangular prisms. The two cubes would be like a link attached at a hinge where the cubes meet.