本文主要是介绍NX二次开发消息打印,可用于调试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
通过函数重载可打印各种类型的数据,通过 UF_UI_is_listing_window_open判断打印消息窗口是否打开,如果打开就不用重复打开
void message(double value, int style)
{char msg[256];sprintf_s(msg, "%f", value);if (style){logical response;UF_UI_is_listing_window_open(&response);if (response){UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}else{UF_UI_open_listing_window();UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}}else{uc1601(msg,1);}
}
void message(int value, int style)
{char msg[256];sprintf_s(msg, "%d", value);if (style){logical response;UF_UI_is_listing_window_open(&response);if (response){UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}else{UF_UI_open_listing_window();UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}}else{uc1601(msg, 1);}
}
void message(tag_t value, int style)
{char msg[256];sprintf_s(msg, "%d", value);if (style){logical response;UF_UI_is_listing_window_open(&response);if (response){UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}else{UF_UI_open_listing_window();UF_UI_write_listing_window(msg);UF_UI_write_listing_window("\n");}}else{uc1601(msg, 1);}
}
void message(char* value, int style)
{if (style){logical response;UF_UI_is_listing_window_open(&response);if (response){UF_UI_write_listing_window(value);UF_UI_write_listing_window("\n");}else{UF_UI_open_listing_window();UF_UI_write_listing_window(value);UF_UI_write_listing_window("\n");}}else{uc1601(value, 1);}
}
void message(string value, int style)
{if (style){logical response;UF_UI_is_listing_window_open(&response);if (response){UF_UI_write_listing_window(value.c_str());UF_UI_write_listing_window("\n");}else{UF_UI_open_listing_window();UF_UI_write_listing_window(value.c_str());UF_UI_write_listing_window("\n");}}else{char msg[256];strcmp(value.c_str(), msg);uc1601(msg, 1);}
}
这篇关于NX二次开发消息打印,可用于调试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!