点击查看详细介绍

通过名称和类型得到对象

xiaoliu8 9年前 6406 61

购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008  QQ号:85585969  


通过名称和类型得到对象

#include <uf_obj.h>
#include <uf_part.h>

//通过名称得到对象
//不管在什么层和是否可见,所有对象都遍历

tag_t disp_part_tag,next_tag=NULL_TAG;
int num=0;
char obj_name[31]="MM"; //对象名称
logical use_occ =TRUE;
int type =UF_solid_type;//对象类型,实体

●●●请先 登陆注册 后查看●●●

disp_part_tag=UF_PART_ask_display_part ( ); //得到当前部件文件标识
UF_OBJ_cycle_by_name_and_type (disp_part_tag,obj_name,type,use_occ,&next_tag);
while(next_tag!=NULL_TAG )
{
num++;
UF_OBJ_set_color(next_tag,20); // 对象修改颜色
UF_OBJ_cycle_by_name_and_type (disp_part_tag,"MM",UF_solid_type,use_occ,&next_tag);
}
UF_UI_write_listing_window("名称为:");
UF_UI_write_listing_window(obj_name);
sprintf(msg, "的对象有%d个\n",num);
UF_UI_write_listing_window(msg);


第2种方法:【对象名称不重复用这种方法比较简单】
// 通过对象名称得到对象 【对象名称不重复用这种方法比较简单】
UF_OBJ_cycle_by_name ("MM", &next_tag );
UF_OBJ_set_color(next_tag,20); // 对象修改颜色

3

最新回复 (61)
  • 宋宇 9年前
    1

    受用了,正在找这个资料

  • xyq407 9年前
    2

    学习中,请多多指导。谢谢

  • wxwxwxwx 9年前
    3

    谢谢分享 。。。。。。。。。。

  • qazqaz000 9年前
    4

    学习中,请多多指导。谢谢

  • q1355188058 8年前
    5

    谢谢,学习中.................................

  • wucrew 8年前
    6

    学习一下,谢谢提供资料

  • leader_ld 8年前
    7

    感谢分享,学习中。。。。。。。。。

  • lzhyi VIP会员 8年前
    8

    学习下,谢谢了00000

  • liu177459528 8年前
    9

    回复:楼主
    感谢分享

  • 罗小小1990 8年前
    10

    学习一下,先看看,非常感谢!

  • huyongde 8年前
    11

    学习下,谢谢了00000

  • h15824295982 8年前
    12

    很好很不错谢谢分享很好很不错谢谢分享

  • George 8年前
    13

    000000000000000000

  • xbp08301666 8年前
    14

    学习中,请多多指导。谢谢

  • bbs1860 8年前
    15

    学习中,谢谢分享!!!

请登录后发表新帖