Thanks Artem, it works great!
I wonder if that means the main reason my original code didn't work was a casting problem? Funny way to express itself.
Thanks for the help, I've been banging my head against this one for far too long.
--Tyler
Thanks Artem! this gets me 90% of the way to what I need. It seems that the swMass.AddBodies has no effect on the mass properties... so if I want to combine the properties of two distinct selected components, I'm not quite sure how to do it. But at least I could manually add the masses of...
Artem,
So the exception appears to be that GetBodies2 will return null if there are no bodies associated with a bottom level feature (maybe a suppressed part?), so you can't get the length of a null object array. No biggie there...
however, the mass properties never update to the selected...
Artem,
So the source that I received didn't quite work for me... Sometimes it will only return the total mass of the entire assembly instead of the selected part (for instance, when I select a single part), and other times it will just throw an exception "Object reference not set to an...
So actually I had been selecting parts instead of subassemblies, I don't think that was the problem. GetBodies2 would return an object array with a couple elements, but when I call AddBodies with that array, it throws the exception.. "Attempted to read or write protected memory. This is often...
Hello,
I'm trying to write a C# program to get the mass properties of a selected subassembly in a large assembly. I thought I was following the documentation properly, but I run into one of two problems:
the "AddBodies" function for a mass property object throws an exception if I use the...