3 Replies Latest reply on Jan 30, 2014 2:41 PM by Joshua Temple

    Difference between vMassProp(5) and massProp.Mass?

    Joshua Temple

      Good morning, Gentlemen:



      I have a macro that to export the mass properties from an active SW assembly into Excel.  We've been working on this for a while and it's been working great.  However, recently I've noticed that a new set of models needs extra attention.  The total weight in the macro output and the total weight in SW Mass properties tool do not match as they should.  In a 10kg assembly, the difference is about .7kg (less).



      I'm not certain what the cause is or where the issue is.  I've tried both different ways to pull the mass properties.  But I believe part of the issue may be my ignorance as to what the real difference is.  Both pull the incorrect weight, and both of their weights are different.  In this case massProp.Mass is worse.


      I've attached the entire macro.  Anyone is welcome to use it if they need it. 


      Also, if there is an internal tool within SW to do what I'm doing with this Macro, I'd LOVE to hear about it. 




      Edit: the line is line 403.

        • Re: Difference between vMassProp(5) and massProp.Mass?
          Joshua Temple

          Can anyone give me a clue?  I've looked in the API help section, but I haven't answered this question.




          What is the difference between vMassProp(5) and massProp.Mass?

            • Re: Difference between vMassProp(5) and massProp.Mass?
              Jacob Corder

              Hi Joshua.


              From what i can see the IMassProperty interface allows you to add bodies to the calculation much like how the interface works in solidworks for getting mass properties.


              On the other hand the VMassProp(5) "Mass" is of all bodies in the part regardless if they are visible or hidden, im not sure if it will calculate suppressed bodies(features that created them are suppressed). so it appears that one is customizable and the other is not. By Customizable i mean you can specify which bodies to measure.


              In your case you need to be using the iMassProperty interface to add the bodies that are unsuppressed in the configuration of the Component that you are using. otherwise if it has any more bodies that are suppressed, it will also include their masses in the calculation.


              So you want to go through each body and checked if it is required for you to measure. so check if it is hidden or if the feature that created the body is suppressed. i would just check if it is visible using body2.Visible. I Cant remember if that will error on you or exactly how to check if it should be added.


              So create a part with a lot of features and configs with suppressed features that will verify this and run both IMassProperty.Mass and Modeldoc2.Extension.GetMassProperties


              Hope this helps. you may find that there isnt a difference.