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?
you cant use 2016 SOLIDWORKS API Help - GetMassProperties2 Method (ISldWorks) if the mass properties were not updated when the model was saved. this is why you are getting a null.
why its returning null when you want all of the components i cant say.
instead of assigning it to a Double array.
double vMassProp = null;
an object (i dont know C# sorry)
Retrieving data ...