admin 发表于 2013-12-20 15:09:07

NX二次开发源码:查找当前工作部件所有的圆柱表面代码

NX二次开发源码:查找当前工作部件所有的圆柱表面代码

static void do_ugopen_api()
{
Session *theSession = Session::GetSession();
Part *workPart = theSession->Parts()->Work();
BodyCollection *bc = workPart->Bodies();
ListingWindow *lw = theSession->ListingWindow();
int count = 0 ;
// get the body then to get the faces
for(BodyCollection::iterator it = bc->begin();it!=bc->end();it++)
{
   Body *body = (*it);
   // get faces
   std::vector<Face*> faces = body->GetFaces();
   for(int j =0 ; j <faces.size();j++)
   {
   Face *face = faces;
if ( face->SolidFaceType()==Face::FaceTypeCylindrical)
{
   face->Highlight();
   count++;
}
   }
}
lw->Open();
char msg;
sprintf(msg,"The Cylinder faces count is :%d\n",count);
lw->WriteLine(msg);

}
<p> </p>

UG晓晓 发表于 2015-7-26 08:31:27

牛啊,就是复制乱码
页: [1]
查看完整版本: NX二次开发源码:查找当前工作部件所有的圆柱表面代码