/* NXOpen创建球 */
void xy_NXOPEN_creat_sphere::gma_creat_sphere()
{
try
{
//---- Enter your callback code here -----
//对C++环境初始化
NXOpen::Session *theSession = NXOpen::Session::GetSession();
NXOpen::Part *workPart(theSession->Parts()->Work());
NXOpen::Part *displayPart(theSession->Parts()->Display());
//创建球
NXOpen::Features::Sphere *nullNXOpen_Features_Sphere(NULL);
NXOpen::Features::SphereBuilder *sphereBuilder1;
sphereBuilder1 = workPart->Features()->CreateSphereBuilder(nullNXOpen_Features_Sphere);
sphereBuilder1->SetType(NXOpen::Features::SphereBuilder::TypesCenterPointAndDiameter); //设置类型
sphereBuilder1->Diameter()->SetRightHandSide("100"); //设置直径
NXOpen::NXObject *nXObject1;
nXObject1 = sphereBuilder1->Commit();
sphereBuilder1->Destroy();
}
catch (exception& ex)
{
//---- Enter your exception handling code here -----
xy_NXOPEN_creat_sphere::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
}
}