【UG\NX二次开发】UF 获取所有注释(UF_DRF_ask_ann_data、uc5574)


//检测是否是需要注释类型
tag_t get_ann(tag_t object)
{
	char note[255] = "";
	int count = 0, i = 0, type = 0, subtype = 0, response = 0;
	char message[133] = "";
	double cursor[3] = { 0,0,0 }, dir[3] = { 0,0,1 }, point[3] = { 0,0,0 };
	double box[6], radius1 = 0, radius2 = 0;
	int norm_dir = 0;
	int num = 0;
	double radius[2], positions[6], params[4];
	tag_t view = NULL_TAG;
	int object_type = 100;
	tag_t display_part = NULL_TAG;
	int body_type = 0, body_subtype = 0;
	UF_OBJ_disp_props_t disp_props;
	char* feature_name = "";
	tag_p_t exp_tags;
	double upper_left[3];
	double  length = 0;
	double  height = 0;
	int ann_data[10];
	char* cr3 = new char[255];  //或直接char cr3[255]="";
	int ir4 = 0;;
	int ir5 = 0;
	int search_mask[4] = { 1,1,1,1 };
	int cycle_flag = 0;
	int ann_data_type = 0;
	int ann_data_form = 0;
	int num_segments = 0;
	double ann_origin[2] = { 0,0 };
	double radius_angle = 0;
	UF_CALL(UF_initialize());
	display_part = UF_PART_ask_display_part();
	num = 0;
	UF_CALL(UF_DRF_ask_ann_data(&object, search_mask, &cycle_flag, ann_data, &ann_data_type, &ann_data_form, &num_segments, ann_origin, &radius_angle));
	int ip1 = 1;
	char* text_string[100];
	num = 0;
	tag_t first_object = NULL_TAG;
	while (ip1 <= num_segments && num_segments >= 1) {
		uc5574(ip1++, ann_data, cr3, &ir4, &ir5);//内容获取
		CString noteA = cr3;
		int resp = noteA.Find("<U>", 0);
		if (resp != -1) {
			first_object = object;
			//uc1601(cr3, 1);
		}
	}
	return first_object;
}
//获取所有注释
void find_note(vector<tag_t>& note_tag_list) {
	note_tag_list.clear();
	int note_tag_list_count = 0;
	tag_t work_part = UF_ASSEM_ask_work_part();
	tag_t object = NULL_TAG;
	int type = 0, subtype = 0;
	tag_t note_tag = NULL_TAG;
	UF_OBJ_cycle_objs_in_part(work_part, 25, &object);
	while (object != NULL_TAG) {
		UF_OBJ_ask_type_and_subtype(object, &type, &subtype);
		if (subtype == 1) {
			note_tag = get_ann(object);
			if (note_tag != NULL_TAG)
			{
				note_tag_list.push_back(note_tag);
			}
		}
		UF_CALL(UF_OBJ_cycle_objs_in_part(work_part, 25, &object));
	}
}

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

社恐猫

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值