怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

#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);

 

 

posted on 2021-02-28 12:04  怡宁塑胶模具设计  阅读(674)  评论(0编辑  收藏  举报