zoukankan      html  css  js  c++  java
  • 获取面面积,资料来自录制和网友分享

     1 #include <NXOpen/MeasureBuilder.hxx>
     2 #include <NXOpen/MeasureFaceBuilder.hxx>
     3 #include <NXOpen/MeasureFaces.hxx>
     4 #include <NXOpen/Unit.hxx>
     5 #include <NXOpen/UnitCollection.hxx>
     6 #include <NXOpen/NXObject.hxx>
     7 #include <NXOpen/NXObjectManager.hxx>
     8 
     9 double GetFaceArea(Face* face)//获取面积
    10 {
    11     Session* theSession = Session::GetSession();
    12     Part* workPart(theSession->Parts()->Work());
    13     Part* displayPart(theSession->Parts()->Display());
    14     NXObject* nullNXObject(NULL);
    15     NXOpen::MeasureFaceBuilder* measureFaceBuilder1;
    16     measureFaceBuilder1 = workPart->MeasureManager()->CreateMeasureFaceBuilder(nullNXObject);
    17     std::vector<IParameterizedSurface*> objects1(1);
    18     objects1[0] = face;
    19     MeasureFaces* measureFaces1;
    20     measureFaces1 = workPart->MeasureManager()->NewFaceProperties(NULL, NULL, 0.9999, objects1);
    21     measureFaceBuilder1->Commit();
    22     ///measureFaceBuilder1->FaceObjects()->Clear();
    23     measureFaceBuilder1->Destroy();
    24     theSession->CleanUpFacetedFacesAndEdges();
    25     double areaValue = measureFaces1->Area();
    26     return areaValue;
    27 }
    28 
    29 double GetFaceArea(tag_t face)//获取面积//重载tag_t
    30 {
    31     Session* theSession = Session::GetSession();
    32     Part* workPart(theSession->Parts()->Work());
    33     Part* displayPart(theSession->Parts()->Display());
    34     NXObject* nullNXObject(NULL);
    35     NXOpen::MeasureFaceBuilder* measureFaceBuilder1;
    36     measureFaceBuilder1 = workPart->MeasureManager()->CreateMeasureFaceBuilder(nullNXObject);
    37     std::vector<IParameterizedSurface*> objects1(1);
    38     objects1[0] = dynamic_cast<NXOpen::Face*>(NXObjectManager::Get(face));
    39     //NXOpen::Unit* unit1(dynamic_cast<NXOpen::Unit*>(workPart->UnitCollection()->FindObject("SquareMilliMeter")));
    40     //NXOpen::Unit* unit2(dynamic_cast<NXOpen::Unit*>(workPart->UnitCollection()->FindObject("MilliMeter")));
    41     MeasureFaces* measureFaces1;
    42     measureFaces1 = workPart->MeasureManager()->NewFaceProperties(NULL, NULL, 0.9999, objects1);
    43     measureFaceBuilder1->Commit();
    44     ///measureFaceBuilder1->FaceObjects()->Clear();
    45     measureFaceBuilder1->Destroy();
    46     theSession->CleanUpFacetedFacesAndEdges();
    47     double areaValue = measureFaces1->Area();
    48     return areaValue;
    49 }
  • 相关阅读:
    Mybatisplus<一> Springboot框架使用MybatisPlus代码自动生成器
    今日收获
    今日收获
    字典特征提取
    sklearn数据集的导入及划分
    文本特征提取
    MySQL基础笔记
    docker笔记
    BOM 中的location对象和history对象
    完善 原生Js 实现的简单无缝滚动轮播图
  • 原文地址:https://www.cnblogs.com/liuxiaoqing1/p/13678741.html
Copyright © 2011-2022 走看看