zoukankan      html  css  js  c++  java
  • NXOpen 通过迭代器获取工作部件的体、面、边、点

    C++ 2010

    //用户代码

     theSession->ListingWindow()->Open();
     theSession->ListingWindow()->WriteLine("制作:Alan Huang QQ:185266370");

     std::vector<Edge *> edges; //边容器
     std::vector<Face *> faces; //面容器
     NXOpen::Point3d p1 ,p2; //边的两端点
     double len; //边长
     char msg [256];

     BodyCollection *bodys = workPart->Bodies();
     for (BodyCollection::iterator ite = bodys->begin();ite !=bodys->end();ite++)
     {
      Body *body=(*ite);
      sprintf ( msg , "实体TAG:%d",body->Tag());
      theSession->ListingWindow()->WriteLine( msg);
      edges = body->GetEdges() ; //获取实体的所有边
      faces = body->GetFaces(); //获取实体的所有面

     }

     for ( int i = 0 ; i < faces.size();i++)
     {
      sprintf ( msg , "面TAG:%d",faces[i]->Tag());
      theSession->ListingWindow()->WriteLine( msg);
     }

     for ( int i = 0 ; i < edges.size();i++)
     {
      Edge *edge = edges[i];
      sprintf ( msg , "边TAG:%d",edges[i]->Tag());
      theSession->ListingWindow()->WriteLine( msg);
      len = edge->GetLength(); //获取边长
      sprintf ( msg , "边的长度:%.2f",len);
      theSession->ListingWindow()->WriteLine( msg);
      edge->GetVertices(&p1,&p2); //获取边的两个端点
      sprintf ( msg , "端点P1:%.2f %.2f %.2f 端点P2:%.2f %.2f %.2f",p1.X,p1.Y,p1.Z,p2.X,p2.Y,p2.Z);
      theSession->ListingWindow()->WriteLine( msg);
     }

    怡宁塑胶模具设计
  • 相关阅读:
    [转]zxing二维码的生成和解码 j2se
    [转]Android的网络与通信
    (转)Firefox:浏览器内置数据库之路
    dom Framework oop模块
    我的框架 别名机制
    获取屏幕的PDI值
    mass Framework lang模块
    王云飞 《绿色生活》(附译文)
    dom Framework query模块
    dom Framework核心模块发布!(更新)
  • 原文地址:https://www.cnblogs.com/hqsalanhuang/p/14428322.html
Copyright © 2011-2022 走看看