NX二次开发 NXOpen获得面积、体积
//获得对象体积(g/立方毫米)(输入实体或组)默认accuracy = 0.99 (推荐,和UG本身命令测量结果一样)
double NX_AskFaceArea(const tag_t face_tag, const double accuracy)
{
std::vector<tag_t> faces;
if (NULL_TAG == face_tag)
return 0.0;
faces.clear();
faces.push_back(face_tag);
return NX_AskFaceAreas(faces, accuracy);
}
double NX_AskFaceAreas(const std::vector<tag_t> faces, const double accuracy)
{
int i = 0;
NXOpen::IParameterizedSurface* face1 = NULL;
double area = 0.0, accuracy_tol = accuracy;
vector< NXOpen::IParameterizedSurface* > faces1;
faces1.clear();
if (0 == (int)faces.size())
return area;
if (accuracy_tol < 0.9)
accuracy_tol = 0.9;
if (accuracy_tol > 1.0)
accuracy_tol = 1.0;
try
{