Updating mass properties using JLink
I'm trying to update/override the mass properties of a model from an application using the asynchronous J-Link API. I created a method which takes in a solid and a Hash of the mass property/value pairs. Everything succeeds with no errors/exceptions, however, the values do not change in Creo. I understand most of these properties are calculated and it's probably not a good idea to set them anyway, however, I do want to be able to set the density. Thoughts?
public void updateCADProperties(Solid solid, HashMap<String, Double> values){
MassProperty properties = null;
try {
properties = solid.GetMassProperty(null);
properties.SetMass(values.get("mass"));
properties.SetDensity(values.get("density"));
properties.SetSurfaceArea(values.get("surfaceArea"));
properties.SetVolume(values.get("volume"));
} catch (jxthrowable e) {
e.printStackTrace();
}
}
Thanks In Advance,
Bill

