zoukankan      html  css  js  c++  java
  • NXOpen 特征、体、线、圆弧、点通过迭代器遍历

    #include <NXOpen/Session.hxx>                  
    #include <NXOpen/Part.hxx>                     
    #include <NXOpen/PartCollection.hxx> 

    #include <NXOpen/Features_FeatureCollection.hxx>

    #include <NXOpen/Features_Feature.hxx>         
    #include <NXOpen/Features_CylinderBuilder.hxx> 
    #include <NXOpen/Features_FeatureCollection.hxx>
    #include <NXOpen/Features_FeatureBuilder.hxx>

    #include <NXOpen/Body.hxx>
    #include <NXOpen/BodyCollection.hxx>
    #include <NXOpen/Line.hxx>
    #include <NXOpen/LineCollection.hxx>
    #include <NXOpen/Point.hxx>
    #include <NXOpen/PointCollection.hxx>
    #include <NXOpen/Arc.hxx>
    #include <NXOpen/ArcCollection.hxx>

    #include <NXOpen/ListingWindow.hxx>

        workPart = theSession->Parts()->Work();

     theSession->ListingWindow()->Open();  //打开信息窗口

     char msg [256];

     Features::Feature* thefeature;
     Features::FeatureCollection *features=workPart->Features();//迭代
     Features::FeatureCollection::iterator itr=features->begin();//获得第一个特征
     std::vector<tag_t> FeatureVecotor;
     for (;itr!=features->end();++itr)        //循环获得所有特征
     {
      thefeature=(*itr); //获得特征赋值给featuresList
      //theSession->ListingWindow()->WriteLine("特征类型:"+thefeature->FeatureType()); //获得特征类型打印
      FeatureVecotor.push_back(thefeature->Tag());
     }
     //遍历body
     std::vector<tag_t> BodyVecotor;
     BodyCollection *bodys = workPart->Bodies();
     for (BodyCollection::iterator itebody = bodys->begin();itebody !=bodys->end();itebody++)
     {
       Body *body=(*itebody);
       BodyVecotor.push_back(body->Tag());
     }
     //遍历line
     std::vector<tag_t> LineVecotor;
     LineCollection *lines = workPart->Lines();
     for (LineCollection::iterator linesite = lines->begin();linesite !=lines->end();linesite++)
     {
      Line *line =(*linesite);
      LineVecotor.push_back(line->Tag());
     }
     //遍历Arc
     std::vector<tag_t> ArcVecotor;
     ArcCollection *arcs = workPart->Arcs();
     for (ArcCollection::iterator arcsite = arcs->begin();arcsite !=arcs->end();arcsite++)
     {
      Arc *arc =(*arcsite);
      arc->Highlight();
      ArcVecotor.push_back(arc->Tag());
     }
     //遍历point
     std::vector<tag_t> PointVecotor;
     PointCollection *points = workPart->Points();
     for (PointCollection::iterator pointsite = points->begin();pointsite !=points->end();pointsite++)
     {
      Point *point =(*pointsite);
      //point->Highlight();
      PointVecotor.push_back(point->Tag());
     }

     sprintf ( msg , "特征的数量:%d",FeatureVecotor.size());
     theSession->ListingWindow()->WriteLine( msg);
     sprintf ( msg , "体的数量:%d",BodyVecotor.size());
     theSession->ListingWindow()->WriteLine( msg);
     sprintf ( msg , "线的数量:%d",LineVecotor.size());
     theSession->ListingWindow()->WriteLine( msg);
     sprintf ( msg , "圆弧的数量:%d",ArcVecotor.size());
     theSession->ListingWindow()->WriteLine( msg);
     sprintf ( msg , "点的数量:%d",PointVecotor.size());
     theSession->ListingWindow()->WriteLine( msg);

    怡宁塑胶模具设计
  • 相关阅读:
    ubuntu下安装VMware tools
    ubuntu 输入su提示认证失败的解决方法
    Squishy Bird 压扁小鸟
    js 毫秒转日期(yy-MM-dd hh:mm:ss)
    js--使用构造器函数来新建对象及操作
    css中table样式
    js 字符串截取
    JavaScript中Math--random()/floor()/round()/ceil()
    canvas draw a image
    html5 canvas simple drawing
  • 原文地址:https://www.cnblogs.com/hqsalanhuang/p/14458586.html
Copyright © 2011-2022 走看看