NX二次开发-NXOPEN创建工程图表格Annotations::TableSectionBuilder *tableSectionBuilder1;

  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/10957485.html

时间: 2024-11-09 03:48:15

NX二次开发-NXOPEN创建工程图表格Annotations::TableSectionBuilder *tableSectionBuilder1;的相关文章

NX二次开发-NXOPEN更改工程图视图名字baseView1-&gt;SetName(&quot;LSY&quot;);

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 UF_initialize(); 9 10 //新建工程图(A4图纸) 11 char* DrawingName = "Sheet1";//设置图纸名字 12 UF_DRAW_info_t DrawingInfo;//设置图纸大小.

NX二次开发-NXOpen读取工程图注释note1-&gt;GetText();

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_drf.h> 5 #include <NXOpen/Annotations_Note.hxx> 6 #include <NXOpen/NXObjectManager.hxx> 7 8 9 UF_initialize(); 10 11 //创建注释 12 char* TextString[] = {"Caesar卢尚宇"}; 13 double

NX二次开发-NXOPEN将工程图转成PDF文件

1 NX9+VS2012 2 3 #include <uf.h> 4 #include <uf_draw.h> 5 #include <NXOpen/PrintPDFBuilder.hxx> 6 #include <NXOpen/Drawings_DrawingSheet.hxx> 7 #include <NXOpen/NXObjectManager.hxx> 8 #include <NXOpen/PlotManager.hxx> 9

NX二次开发-NXOPEN自动切换到工程图模块

UFUN的API里是没有切换到工程图的函数的,NXOPEN里是有方法可以用的.不过应该是不支持NX9以下的版本. NX9的不能录制出来,在UI类里有方法 1 NX9+VS2012 2 3 #include <uf.h> 4 #include <NXOpen/UI.hxx> 5 #include <NXOpen/MenuBar_MenuBarManager.hxx> 6 7 8 9 NXOpen::UI *theUI = NXOpen::UI::GetUI(); 10 1

NX二次开发-NXOPEN工程图导出CAD图纸DxfdwgCreator *dxfdwgCreator1;

没有什么可以看的,NXOPEN直接录制一下导出CAD就可以了.录制出来自己挑需要的代码拿过来改一下. 1 NX9+VS2012 2 3 4 #include <NXOpen/Part.hxx> 5 #include <NXOpen/PartCollection.hxx> 6 #include <NXOpen/Session.hxx> 7 #include <NXOpen/DxfdwgCreator.hxx> 8 #include <NXOpen/Dex

NX二次开发-NXOpen获取边的端点NXOpen::Edge::GetVertices

1 NX9+VS2012 2 3 #include <NXOpen/Features_BlockFeatureBuilder.hxx> 4 #include <NXOpen/Features_FeatureCollection.hxx> 5 #include <NXOpen/NXException.hxx> 6 #include <NXOpen/Body.hxx> 7 #include <NXOpen/BodyCollection.hxx> 8

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_DRAW_add_orthographic_view

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 UF_initialize(); 9 10 //新建工程图(A4图纸) 11 char* DrawingName = "Sheet1";//设置图纸名字 12 UF_DRAW_info_t DrawingInfo;//设置图纸大小.

NX二次开发-UFUN将工程图中的点坐标映射到建模绝对坐标UF_VIEW_map_drawing_to_model

1 #include <uf.h> 2 #include <uf_ui.h> 3 #include <uf_draw.h> 4 #include <uf_view.h> 5 #include <uf_curve.h> 6 7 8 9 UF_initialize(); 10 11 //在工程图里创建点 12 double p1[3] = { 106.905267, 139.431151 }; 13 14 //获得图纸页tag 15 int num_