Hi,
I am trying to rotate a body by 180D on the Z axis using InsertMoveCopyBody2().
The rotation is fine but the center of rotation is different from the value I get by querying using GetMassProperties than the values I get from doing through the UI. The sample part file is attached.
Center Of Mass as per UI = 27.735, -0.0005, 21.5419
Center of mass using API = 21.334, -0.0005, -29.2937
The density of the material is obtained using GetUserPreferenceDoubleValue((int)swUserPreferenceDoubleValue_e.swMaterialPropertyDensity). I cross checked this with the body density calculation (mass/volume) and both values are the same.
The values I mentioned above are for the body named Boss-Extrude1[1] in the attached part. A sample of the rotation I am trying to achieve through API is also present as a feature (Body-Move/Copy1) in the attached file.
Please advise.
Thanks,
Hersh
Sample Code
bool status = swModel.Extension.SelectByID2("Boss-Extrude1[1]", "SOLIDBODY", 0, 0, 0, false, 1, null, 0);
if (status)
{
double[] bodyMassProperties = body.GetMassProperties(m_iSwApp.GetUserPreferenceDoubleValue((int)swUserPreferenceDoubleValue_e.swMaterialPropertyDensity));
IFeature feature = swModel.FeatureManager.InsertMoveCopyBody2(0, 0, 0, 0, bodyMassProperties[0], bodyMassProperties[1], bodyMassProperties[2], 3.1415926535898, 0, 0, false, 1);
swModel.ClearSelection2(true);
}