NX二次开发-UFUN工程图表格注释检索默认单元格首选项UF_TABNOT_ask_default_cell_prefs

  1 NX9+VS2012
  2
  3
  4 #include <uf.h>
  5 #include <uf_tabnot.h>
  6 #include <NXOpen/Part.hxx>
  7 #include <NXOpen/PartCollection.hxx>
  8 #include <NXOpen/Session.hxx>
  9 #include <NXOpen/Annotations_TableSectionCollection.hxx>
 10 #include <NXOpen/Annotations_AnnotationManager.hxx>
 11 #include <NXOpen/FontCollection.hxx>
 12
 13
 14 UF_initialize();
 15
 16 //创建表格注释
 17 Annotations::TableSection *nullAnnotations_TableSection(NULL);
 18 Annotations::TableSectionBuilder *tableSectionBuilder1;
 19 tableSectionBuilder1 = workPart->Annotations()->TableSections()->CreateTableSectionBuilder(nullAnnotations_TableSection);
 20 NXOpen::Point3d TablePoint(194.0, 17.0, 0.0);
 21 tableSectionBuilder1->Origin()->SetOriginPoint(TablePoint);
 22 tableSectionBuilder1->SetNumberOfColumns(2);
 23 tableSectionBuilder1->SetNumberOfRows(2);
 24 tableSectionBuilder1->SetRowHeight(20.0);
 25 tableSectionBuilder1->SetColumnWidth(50);
 26 tableSectionBuilder1->Commit();
 27 NXObject *nXObject1;
 28 nXObject1 = tableSectionBuilder1->Commit();
 29 tableSectionBuilder1->Destroy();
 30
 31 //section转tag
 32 tag_t TabularNote = NULL_TAG;
 33 UF_TABNOT_ask_tabular_note_of_section(nXObject1->Tag(), &TabularNote);
 34
 35 //获取第一行的Tag
 36 tag_t Row0Tag = NULL_TAG;
 37 UF_TABNOT_ask_nth_row(TabularNote, 0, &Row0Tag);
 38
 39 //获取第二行的Tag
 40 tag_t Row1Tag = NULL_TAG;
 41 UF_TABNOT_ask_nth_row(TabularNote, 1, &Row1Tag);
 42
 43 //获取第一列的Tag
 44 tag_t Column0Tag = NULL_TAG;
 45 UF_TABNOT_ask_nth_column(TabularNote, 0, &Column0Tag);
 46
 47 //获取第二列的Tag
 48 tag_t Column1Tag = NULL_TAG;
 49 UF_TABNOT_ask_nth_column(TabularNote, 1, &Column1Tag);
 50
 51 //得到第一行第一列单元格的Tag
 52 tag_t Cell0Tag = NULL_TAG;
 53 UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column0Tag, &Cell0Tag);
 54
 55 //得到第一行第二列单元格的Tag
 56 tag_t Cell1Tag = NULL_TAG;
 57 UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column1Tag, &Cell1Tag);
 58
 59 //得到第二行第一列单元格的Tag
 60 tag_t Cell2Tag = NULL_TAG;
 61 UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column0Tag, &Cell2Tag);
 62
 63 //得到第二行第二列单元格的Tag
 64 tag_t Cell3Tag = NULL_TAG;
 65 UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column1Tag, &Cell3Tag);
 66
 67 //写文本
 68 UF_TABNOT_set_cell_text(Cell0Tag, "设计者:");
 69 UF_TABNOT_set_cell_text(Cell1Tag, "卢尚宇");
 70
 71 //合并最底下的单元格
 72 UF_TABNOT_merge_cells(Cell2Tag, Cell3Tag);
 73
 74 //获取合并单元格的行Tag
 75 tag_t MergeRowTag = NULL_TAG;
 76 UF_TABNOT_ask_nth_row(TabularNote, 1, &MergeRowTag);
 77
 78 //获取合并单元格的列Tag
 79 tag_t MergeColumnTag = NULL_TAG;
 80 UF_TABNOT_ask_nth_column(TabularNote, 0, &MergeColumnTag);
 81
 82 tag_t MergeCellTag = NULL_TAG;
 83 UF_TABNOT_ask_cell_at_row_col(MergeRowTag, MergeColumnTag, &MergeCellTag);
 84
 85 //写文本
 86 UF_TABNOT_set_cell_text(MergeCellTag, "版本号:xxxxxxxxxx");
 87
 88 //检索默认单元格首选项
 89 UF_TABNOT_cell_prefs_t  cell_prefs;
 90 UF_TABNOT_ask_default_cell_prefs(&cell_prefs);
 91
 92 //设置单元格首选项
 93 int fontIndex1 = workPart->Fonts()->AddFont("chinesef_fs", NXOpen::FontCollection::TypeNx);//更改字体
 94 cell_prefs.text_font = fontIndex1; //字体
 95 UF_TABNOT_set_cell_prefs(Cell0Tag, &cell_prefs);
 96 UF_TABNOT_set_cell_prefs(Cell1Tag, &cell_prefs);
 97 UF_TABNOT_set_cell_prefs(MergeCellTag, &cell_prefs);
 98
 99
100 UF_terminate();

原文地址:https://www.cnblogs.com/nxopen2018/p/10957372.html

时间: 2024-07-28 21:59:39

NX二次开发-UFUN工程图表格注释检索默认单元格首选项UF_TABNOT_ask_default_cell_prefs的相关文章

NX二次开发-UFUN工程图表格注释获取某一行的tag函数UF_TABNOT_ask_nth_row

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN工程图表格注释获取某一行某一列的tag函数UF_TABNOT_ask_cell_at_row_col

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN工程图表格注释写入文本内容UF_TABNOT_set_cell_text

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN工程图表格注释设置单元格首选项UF_TABNOT_set_cell_prefs

1 NX9+VS2012 2 3 4 #include <uf.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_TableSectionCollection.hxx>

NX二次开发-UFUN读取表格注释内容UF_TABNOT_ask_cell_text

1 NX11+VS2013 2 3 #include <uf.h> 4 #include <uf_ui.h> 5 #include <uf_tabnot.h> 6 #include <NXOpen/Part.hxx> 7 #include <NXOpen/PartCollection.hxx> 8 #include <NXOpen/Session.hxx> 9 #include <NXOpen/Annotations_Table

NX二次开发-UFUN工程图初始化视图信息UF_DRAW_initialize_view_info

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <uf_obj.h> 6 #include <uf_part.h> 7 8 9 UF_initialize(); 10 11 //新建工程图(A4图纸) 12 char* DrawingName = "Sheet1";//设置图纸名字 13 UF_DRAW_info_t DrawingInfo;//设置图纸

NX二次开发-UFUN和NXOpen结合开发中Tag_t对象与TaggedObject对象转换方法

1 本文通过举四个例子来告诉大家在NX二次开发过程中会经常用到UFUN和NXOpen结合去开发,在UFUN中我们得到的是Tag_t对象,在NXOpen中得到的是TaggedObject对象,这两个是需要进行转换的.本文主要知识点为:TaggedObject->tag_t() , NXOpen::NXObjectManager::Get(BodyTag1) , feature1->JournalIdentifier()的用法. 2 3 NX11+VS2013 4 5 #include <u

NX二次开发-UFUN读取工程图注释UF_DRF_ask_text_data

1 //NX9_NXOpenCPP_Wizard1 2 3 // Mandatory UF Includes 4 #include <uf.h> 5 #include <uf_object_types.h> 6 7 // Internal Includes 8 #include <NXOpen/ListingWindow.hxx> 9 #include <NXOpen/NXMessageBox.hxx> 10 #include <NXOpen/UI.h

NX二次开发-UFUN询问注释对象的数据UF_DRF_ask_ann_data

1 //NX9_NXOpenCPP_Wizard1 2 3 // Mandatory UF Includes 4 #include <uf.h> 5 #include <uf_object_types.h> 6 7 // Internal Includes 8 #include <NXOpen/ListingWindow.hxx> 9 #include <NXOpen/NXMessageBox.hxx> 10 #include <NXOpen/UI.h