在建模的时候,部件导航器里的特征按建模顺序是有特征时间戳记的。
我们可以根据特征时间戳记的名字来判断哪个特征在前,哪个在后。
#include <uf.h> #include <uf_ui.h> #include <uf_modl.h> #include <uf_obj.h> UF_initialize(); //由名字找到体 tag_t object = NULL_TAG; UF_OBJ_cycle_by_name("MAIN", &object); //找到体上的所有特征 uf_list_p_t feature_tag_list; UF_MODL_ask_body_feats(object, &feature_tag_list); //获取链表的数量 int count = 0; UF_MODL_ask_list_count(feature_tag_list, &count); UF_UI_open_listing_window(); for (int i = 0; i < count; i++) { //获取链表里的所有tag tag_t FeatsTag = NULL_TAG; UF_MODL_ask_list_item(feature_tag_list, i, &FeatsTag); //获取特征的类型 char* feature_type; UF_MODL_ask_feat_type(FeatsTag, &feature_type); //打印出所有特征 char msg[256]; sprintf_s(msg, "%s ", feature_type); //UF_UI_write_listing_window(msg); string name = feature_type; if (name == "SIMPLE HOLE") { //获取特征的时间戳记名字 char *FeatureName; UF_MODL_ask_feat_name(FeatsTag, &FeatureName); //打印 char msg1[256]; sprintf_s(msg1, "%s ", FeatureName); UF_UI_write_listing_window(msg1); } if (name == "BLEND") { //获取特征的时间戳记名字 char *FeatureName; UF_MODL_ask_feat_name(FeatsTag, &FeatureName); //打印 char msg1[256]; sprintf_s(msg1, "%s ", FeatureName); UF_UI_write_listing_window(msg1); } if (name == "RECT_PAD") { //获取特征的时间戳记名字 char *FeatureName; UF_MODL_ask_feat_name(FeatsTag, &FeatureName); //打印 char msg1[256]; sprintf_s(msg1, "%s ", FeatureName); UF_UI_write_listing_window(msg1); } } UF_terminate(); Caesar卢尚宇 2019年7月13日