【NX二次开发】获取尺寸信息,获取尺寸的值,获取PMI的值
也可用于获取PMI的尺寸值
源码:
#include "me.hpp" int doJob(); extern DllExport void ufusr(char *param, int *returnCode, int rlen) { UF_initialize(); doJob(); UF_terminate(); } extern int ufusr_ask_unload(void) { return (UF_UNLOAD_IMMEDIATELY); } int doJob() { tag_t tagDimension = NULL_TAG; while (!(UF_OBJ_cycle_objs_in_part1(UF_PART_ask_display_part(), UF_dimension_type, &tagDimension)) && tagDimension) { //方式1 int dim_subtype = 0; double dim_origin[3]; UF_DRF_dim_info_p_t dimInfo; UF_DRF_ask_dim_info(tagDimension, &dim_subtype, dim_origin, &dimInfo); string strText = dimInfo->text_info->text->full_string; print("strText = %s\n", strText.c_str()); //方式2 int num_main_text = 0; char** main_text; int num_dual_text = 0; char** dual_text; UF_DRF_ask_dimension_text(tagDimension, &num_main_text, &main_text, &num_dual_text, &dual_text); if (num_main_text == 1) { print("mainText = %s\n", main_text[0]); } UF_free(main_text); UF_free(dual_text); } return 0; }