NX9+VS2012

     #include <uf.h>
#include <uf_obj.h>
#include <uf_modl.h>
#include <uf_part.h> UF_initialize(); //遍历当前显示部件所有体
std::vector<tag_t> SolidVector;
tag_t ObjectTag = NULL_TAG;
int Type, SubType, Body_Type;
int Count = ;
char msg[];
UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
while (ObjectTag != NULL_TAG)
{
UF_OBJ_ask_type_and_subtype(ObjectTag, &Type, &SubType);
if (SubType == UF_solid_body_subtype)
{
UF_MODL_ask_body_type(ObjectTag, &Body_Type);
if (Body_Type == UF_MODL_SOLID_BODY)
{
UF_OBJ_set_color(ObjectTag, );
SolidVector.push_back(ObjectTag);
Count++;
}
}
UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(), UF_solid_type, &ObjectTag);
} //求所有体的最大边界
double MaxBox[] = {, , , -, -, -};
for (int i = ; i < Count; i++)
{
double Box[];
UF_MODL_ask_bounding_box(SolidVector[i], Box);
MaxBox[] = MaxBox[] < Box[]? MaxBox[]:Box[];
MaxBox[] = MaxBox[] < Box[]? MaxBox[]:Box[];
MaxBox[] = MaxBox[] < Box[]? MaxBox[]:Box[];
MaxBox[] = MaxBox[] > Box[]? MaxBox[]:Box[];
MaxBox[] = MaxBox[] > Box[]? MaxBox[]:Box[];
MaxBox[] = MaxBox[] > Box[]? MaxBox[]:Box[];
} //转换
char Length[], Width[], Height[];
sprintf(Length, "%f", MaxBox[] - MaxBox[]);
sprintf(Width, "%f", MaxBox[] - MaxBox[]);
sprintf(Height, "%f", MaxBox[] - MaxBox[]); char* Len[];
Len[] = Length;
Len[] = Width;
Len[] = Height; //创建块
double Ori[] = {MaxBox[], MaxBox[], MaxBox[]};
tag_t BlkTag = NULL_TAG;
UF_MODL_create_block1(UF_NULLSIGN, Ori, Len, &BlkTag); //特征找体
tag_t BodyTag = NULL_TAG;
UF_MODL_ask_feat_body (BlkTag,&BodyTag); //设置透明度
UF_OBJ_set_translucency(BodyTag, ); UF_terminate();

NX二次开发-算法篇-创建最大边界包容盒的更多相关文章

  1. NX二次开发-算法篇-判断找到两个数组里不相同的对象

    NX9+VS2012 #include <uf.h> #include <uf_curve.h> #include <uf_modl.h> #include < ...

  2. NX二次开发-算法篇-vector函数排序(例子:遍历所有点并排序)

    NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_curve.h> #include <u ...

  3. NX二次开发-算法篇-冒泡排序(例子:遍历所有点并排序)

    NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_curve.h> #include <u ...

  4. NX二次开发-算法篇-随便找个不规则的体,找出面的中心点的Z坐标最高和最低的面,高亮显示

    NX9+VS2012 #include <uf.h> #include <uf_evalsf.h> #include <NXOpen/Body.hxx> #incl ...

  5. NX二次开发-算法篇-找相切面

    方法1:通过判断相邻面公共边的光顺性来找相切面 1 #include <uf.h> 2 #include <uf_modl.h> 3 #include <uf_obj.h ...

  6. NX二次开发-UFUN建模创建特征组UF_MODL_create_set_of_feature

    NX11+VS2013 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建块 UF_FEATURE_SIGN ...

  7. NX二次开发-通过数组创建矩阵

    函数:UF_CSYS_create_matrix() 函数说明:通过数组创建矩阵. 用法: #include <uf.h> #include <uf_csys.h> exter ...

  8. NX二次开发-UFUN获取面的内外边界UF_MODL_ask_loop_list_item

    NX11+VS2013 #include <uf.h> #include <uf_modl.h> #include <NXOpen/Face.hxx> #inclu ...

  9. NX二次开发-创建(临时)坐标系

    函数:UF_CSYS_create_csys() . UF_CSYS_create_temp_csys() 函数说明:创建坐标系 .创建临时坐标系 用法: #include <uf.h> ...

随机推荐

  1. css 垂直居中、水平居中

    在父元素.子元素未知的情况下居中有两种方法: 第一种方法: .partent{ display:flex; justify-content:center; align-items:center; } ...

  2. Dart编程实例 - Dart 面向对象编程

    Dart编程实例 - Dart 面向对象编程 class TestClass { void disp() { print("Hello World"); } } void main ...

  3. auth 模块使用篇

    from django.cintrib import auth #登录模块  只要用auth模块一旦登录 就可以在项目的任意地方用request.user 拿到当前的用户对象  再通过 request ...

  4. Yii2的一些问题

    Yii2中删除能不能串着用 Yii2中find.findAll有什么区别 Yii2中User::findOne($id)和User::find->where(['id'=>1])-> ...

  5. PHP FILTER_VALIDATE_FLOAT 过滤器

    定义和用法 FILTER_VALIDATE_FLOAT 过滤器把值作为浮点数来验证. Name: "float" ID-number: 259 实例 <?php $var=1 ...

  6. JZOI1062 【USACO2013JAN】invite

    #include <bits/stdc++.h> #define ll long long #define INF 2147483647 #define ll_INF 9223372036 ...

  7. 2019 wannafly winter camp day5-8代码库

    目录 day5 5H div2 Nested Tree (树形dp) 5F div2 Kropki (状压dp) 5J div1 Special Judge (计算几何) 5I div1 Sortin ...

  8. 多图上传控制器及模型代码(2)thinkphp5+layui实现多图上传保存到数据库,可以实现图片自由排序,自由删除。

    公共css代码 <style> .layui-upload-img { width: 90px; height: 90px; margin: 0; } .pic-more { width: ...

  9. Intel Pin基础

    参考:http://software.intel.com/sites/landingpage/pintool/docs/62732/Pin/html/ http://blog.nruns.com/bl ...

  10. Codeforces 1189A Keanu Reeves

    题目链接:http://codeforces.com/problemset/problem/1189/A 思路:统计1 和 0 的个数,不相等拆开字符串,否则不拆. AC代码: #include< ...