NX二次开发 UFUN创建球体 UF_MODL_create_sphere1
#include <UF_MODL.h>
//创建球体
bool CreateSphere(const double point[3], const double diam, tag_t& body_tag)
{
tag_t tag = NULL_TAG;
char strDiam[133] = "";
double point1[3] = { point[0],point[1],point[2] };
body_tag = NULL_TAG;
if (diam > 0.00001)
{
sprintf(strDiam, "%.9f", diam);
if (!UF_MODL_create_sphere1(UF_NULLSIGN, point1, strDiam, &body_tag))
{
UF_MODL_ask_feat_body(body_tag, &body_tag);//通过特征获得体
return true;
}
}
return false;
}
extern DllExport void ufsta(char* param, int* returnCode, int rlen)
{
if (UF_initialize())
return;
//创建球体
tag_t body_tag = NULL_TAG;
double point[3] = { 0.0 }, diam = 10.0;
CreateSphere(point, diam, body_tag);
UF_terminate();
}