VS2010 NX8.5
#include <uf_drf.h>
void UFCreateTextNote(Point3d TextPoint1,NXString NXStext1); //UF创建文本注释
void UFCreateArrowTextNote(Face *ArrowFace,Point3d TextPoint1,NXString NXStext1); //UF创建带箭头文本注释
void HoleTable::UFCreateTextNote(Point3d TextPoint1,NXString NXStext1) //UF创建文本注释
{
try
{
UF_initialize();
//创建不带箭头的注释
char* text_string [1] ;
strcpy(text_string[0], NXStext1.GetLocaleText());//对text[0]进行赋值
double origin_3d [3] = {TextPoint1.X, TextPoint1.Y };
tag_t note_tag = NULL_TAG;
UF_DRF_create_note( 1, text_string, origin_3d, 0, ¬e_tag );
UF_terminate();
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
HoleTable::theUI->NXMessageBox()->Show("UF创建文本注释", NXOpen::NXMessageBox::DialogTypeError, "程序错误,请检查代码");
}
}
void HoleTable::UFCreateArrowTextNote(Face *ArrowFace,Point3d TextPoint1,NXString NXStext1) //UF创建带箭头文本注释
{
try
{
UF_initialize();
//创建带箭头的注释信息
char text[1][MAX_LINE_LENGTH+1] ;//定义
strcpy(text[0], NXStext1.GetLocaleText());//对text[0]进行赋值
double origin_3d1 [3] = { TextPoint1.X, TextPoint1.Y, 0.0 };//文本位置
double model_pos_3d1 [3] = { 10.0, 10.0, 0.0 };
UF_DRF_object_t object1;
tag_t edge1TAG = NULL_TAG;
object1.object_tag = ArrowFace->Tag();
object1.object_view_tag = DrawingVeiwTags[0]->Tag();
object1.object_assoc_type = UF_DRF_end_point ;
object1.object_assoc_modifier = UF_DRF_first_end_point;
tag_t labelTAG = NULL_TAG;
UF_DRF_create_label( 1, text, origin_3d1, UF_DRF_leader_attach_object, &object1, model_pos_3d1, &labelTAG );
UF_terminate();
}
catch(exception& ex)
{
//---- Enter your exception handling code here -----
HoleTable::theUI->NXMessageBox()->Show("UF创建带箭头文本注释", NXOpen::NXMessageBox::DialogTypeError, "程序错误,请检查代码");
}
}