zoukankan      html  css  js  c++  java
  • NX二次开发-NXOPEN找相切面方法ScRuleFactory()->CreateRuleFaceTangent

     1 #include <uf_defs.h>
     2 #include <uf_ui_types.h>
     3 #include <iostream>
     4 #include <NXOpen/Session.hxx>
     5 #include <NXOpen/UI.hxx>
     6 #include <NXOpen/NXMessageBox.hxx>
     7 #include <NXOpen/Callback.hxx>
     8 #include <NXOpen/NXException.hxx>
     9 #include <NXOpen/BlockStyler_UIBlock.hxx>
    10 #include <NXOpen/BlockStyler_BlockDialog.hxx>
    11 #include <NXOpen/BlockStyler_PropertyList.hxx>
    12 #include <NXOpen/BlockStyler_Group.hxx>
    13 #include <NXOpen/BlockStyler_FaceCollector.hxx>
    14 #include <uf.h>
    15 #include <uf_obj.h>
    16 #include <NXOpen/NXObjectManager.hxx>
    17 #include <NXOpen/PartCollection.hxx>
    18 #include <NXOpen/Face.hxx>
    19 #include <NXOpen/FaceTangentRule.hxx>
    20 #include <NXOpen/ScCollectorCollection.hxx>
    21 #include <NXOpen/ScRuleFactory.hxx>
    22 
    23 
    24         UF_initialize();
    25 
    26         //NXOPEN初始化
    27         NXOpen::Session *theSession = NXOpen::Session::GetSession();
    28         NXOpen::Part *workPart(theSession->Parts()->Work());
    29         NXOpen::Part *displayPart(theSession->Parts()->Display());
    30 
    31         //选择面控件
    32         PropertyList* FaceSelectProps = face_select0->GetProperties();
    33         std::vector<NXOpen::TaggedObject*> faces = FaceSelectProps->GetTaggedObjectVector("SelectedObjects");
    34         delete FaceSelectProps;
    35         FaceSelectProps = NULL;
    36 
    37         tag_t FaceTag = faces[0]->Tag();
    38 
    39         //对选中的面设置颜色
    40         UF_OBJ_set_color(FaceTag, 186);
    41 
    42         //给入一个面
    43         NXOpen::Face *face1(dynamic_cast<NXOpen::Face *>(NXOpen::NXObjectManager::Get(FaceTag)));
    44 
    45         //使用NXOPEN相切面规则
    46         std::vector<NXOpen::Face *> boundaryFaces1(0);
    47         NXOpen::FaceTangentRule *faceTangentRule1;
    48         faceTangentRule1 = workPart->ScRuleFactory()->CreateRuleFaceTangent(face1, boundaryFaces1, 0.050000000000000003);
    49         std::vector<NXOpen::SelectionIntentRule *> rules1(1);
    50         rules1[0] = faceTangentRule1;
    51 
    52         NXOpen::ScCollector* scCollector1 = workPart->ScCollectors()->CreateCollector();
    53         scCollector1->ReplaceRules(rules1, false);
    54 
    55         std::vector<NXOpen::TaggedObject*> BB = scCollector1->GetObjects();
    56         for (int i = 0; i < BB.size(); i++)
    57         {
    58             UF_OBJ_set_color(BB[i]->Tag(), 1);
    59         }
    60 
    61         UF_terminate();

  • 相关阅读:
    ghost版本xp安装iis的问题
    装vs2005 sp1出现数字签名错误的解决办法
    FLEX对整个截屏或单个UI进行截图
    在Apache环境下成功的运行ASP.NET
    向园子的高手们求救 关于45斜视地图的寻路
    第一次在博客里面写东西
    在 Linux 下运行 ASP.NET 2.0
    sql left join inner jion 区别
    C# 图片识别(支持21种语言)
    5、Java并发编程:Lock
  • 原文地址:https://www.cnblogs.com/nxopen2018/p/11069949.html
Copyright © 2011-2022 走看看