AnsweredAssumed Answered

c# addin: GetMassProperties2 Method (ISldWorks) always returns null

Question asked by Madhavi Patil on Feb 15, 2018
Latest reply on Feb 15, 2018 by Jacob Corder


c# addin:

I want to fetch the mass, volume, density, surface for given model (ModelDoc2 Mdl).

1. I tried ISldWorks::GetMassProperties2 but it always returns null.
          string configName = iSwApp.GetActiveConfigurationName(Mdl.GetPathName());
           vMassProp = iSwApp.GetMassProperties2(Mdl.GetPathName(), configName, 1);           

2. I have also tried

           ModelDocExtension swModelExt = default(ModelDocExtension);

            swModelExt = Mdl.Extension;

            vMassProp = (double[])swModelExt.GetMassProperties2(1, out nStatus, false);

           // vMassProp = (double[])swModelExt.GetMassProperties2(1, out nStatus, true);  // this returns value but I want Mass for the whole model and not for just selected components.


Could someone help me understand what am I missing here?