隐藏同色对象

void 隐藏同色()
{
	UF_initialize();
	//单选对象对话框
	char 提示语[] = "选择对象,隐藏对象同色的所有对象", 对话框title[] = "单选对象隐藏同色", msg[256];

	int 选择范围 = UF_UI_SEL_SCOPE_WORK_PART, 响应, color_number, number_conse = 0;

	tag_t Object_tag, 视图tag;

	UF_OBJ_disp_props_t disp_props0;

	double adCursor[3];

	UF_UI_select_with_single_dialog(提示语, 对话框title, 选择范围, NULL, NULL, &响应, &Object_tag, adCursor, &视图tag);
	if (Object_tag != NULL_TAG)
	{
		UF_OBJ_ask_display_properties(Object_tag, &disp_props0);
		color_number = disp_props0.color;
	}
	else {
		uc1601("没有选择如何对象", 1);
		return;
	}

	UF_DISP_set_highlight(Object_tag, 0);



	tag_t NextTag = NULL_TAG;
	UF_OBJ_disp_props_t disp_props;
	do
	{
		NextTag = UF_OBJ_cycle_all(UF_PART_ask_display_part(), NextTag);//遍历工作部件所有对象

		logical IsDisplayable;
		UF_OBJ_is_displayable(NextTag, &IsDisplayable);//获取显示在NX交互界面的对象

		if (IsDisplayable == true)
		{

			UF_OBJ_ask_display_properties(NextTag, &disp_props);//获取对象显示属性
			if (disp_props.blank_status == UF_OBJ_NOT_BLANKED && disp_props.color == color_number)
			{
				number_conse++;
				UF_OBJ_set_blank_status(NextTag, UF_OBJ_BLANKED);//隐藏同色对象
			}

		}

	} while (NextTag != NULL_TAG);

	sprintf(msg, "隐藏了*%d个对象!*", number_conse);
	uc1601(msg, 1);
	//UF_LAYER_set_all_but_work(4);
	//UF_LAYER_set_status(1, 1);
	//UF_LAYER_set_status(10, 2);

	UF_terminate();
}

  

posted @ 2019-12-22 01:46  老婆饼里有老婆  阅读(177)  评论(0编辑  收藏  举报