NX二次开发-算法篇-创建最大边界包容盒
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二次开发-算法篇-创建最大边界包容盒的更多相关文章
- NX二次开发-算法篇-判断找到两个数组里不相同的对象
NX9+VS2012 #include <uf.h> #include <uf_curve.h> #include <uf_modl.h> #include < ...
- NX二次开发-算法篇-vector函数排序(例子:遍历所有点并排序)
NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_curve.h> #include <u ...
- NX二次开发-算法篇-冒泡排序(例子:遍历所有点并排序)
NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_curve.h> #include <u ...
- NX二次开发-算法篇-随便找个不规则的体,找出面的中心点的Z坐标最高和最低的面,高亮显示
NX9+VS2012 #include <uf.h> #include <uf_evalsf.h> #include <NXOpen/Body.hxx> #incl ...
- NX二次开发-算法篇-找相切面
方法1:通过判断相邻面公共边的光顺性来找相切面 1 #include <uf.h> 2 #include <uf_modl.h> 3 #include <uf_obj.h ...
- NX二次开发-UFUN建模创建特征组UF_MODL_create_set_of_feature
NX11+VS2013 #include <uf.h> #include <uf_modl.h> UF_initialize(); //创建块 UF_FEATURE_SIGN ...
- NX二次开发-通过数组创建矩阵
函数:UF_CSYS_create_matrix() 函数说明:通过数组创建矩阵. 用法: #include <uf.h> #include <uf_csys.h> exter ...
- NX二次开发-UFUN获取面的内外边界UF_MODL_ask_loop_list_item
NX11+VS2013 #include <uf.h> #include <uf_modl.h> #include <NXOpen/Face.hxx> #inclu ...
- NX二次开发-创建(临时)坐标系
函数:UF_CSYS_create_csys() . UF_CSYS_create_temp_csys() 函数说明:创建坐标系 .创建临时坐标系 用法: #include <uf.h> ...
随机推荐
- Thread.Join理解
Thread.Join:Blocks the calling thread until a thread terminates MainThread里面起了一个SubThread,从SubThread ...
- 【LeetCode 3】无重复字符的最长子串
描述 [题解] 尺取法 对于[l..r]这段 如果新加进来的s[r]有和之前的重复. 那么就不用重新开始了. 直接递增左区间. 让这段没有重复数字了再说. *****然后再把s[r]加进去. [代码] ...
- docker安装(4)
centos6 docker安装 wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo yum install -y ...
- Java-框架-Dubbo:Dubbo
ylbtech-Java-框架-Dubbo:Dubbo Dubbo是阿里巴巴公司开源的一个高性能优秀的服务框架,使得应用可通过高性能的 RPC 实现服务的输出和输入功能,可以和Spring框架无缝集成 ...
- python excel单元格及样式
python excel单元格及样式: #!/usr/bin/env python # -*- coding: utf-8 -*-” #只对当前文件的中文编码有效 # Filename : Write ...
- 1010 Radix (25 分)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The an ...
- Hyperledger:常见加密算法分类列表
算法原理查询:http://mathworld.wolfram.com 加密散列函数 (消息摘要算法,消息认证码,MD算法) Keyed-hash message authentication c ...
- 序列化之 TLV
目录 序列化之 TLV 1. 紧凑模式 2. 可扩展性 3. 更好的可扩展性 4. 自解释性 5. 跨语言特性 6. 代码自动化:IDL语言 7. 总结 序列化之 TLV 通信协议可以理解两个节点之间 ...
- php ZipArchive 压缩整个文件夹
// Get real path for our folder $rootPath = realpath('folder-to-zip'); // Initialize archive object ...
- Python学习笔记(七)——魔法方法
1.构造和析造 魔法方法就是被双下划线包围的方法 __init__()方法 __init__方法默认没有参数,返回值为none.类实例化对象需有明确的初始化步骤要重写函数 >>> c ...