怡宁塑胶模具设计

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

C++ 2010  NX8.5

Annotations::TableSection *nullAnnotations_TableSection(NULL);
Annotations::TableSectionBuilder *tableSectionBuilder1;
tableSectionBuilder1 = workPart->Annotations()->TableSections()->CreateTableSectionBuilder(nullAnnotations_TableSection);
tableSectionBuilder1->Origin()->Plane()->SetPlaneMethod(Annotations::PlaneBuilder::PlaneMethodTypeXyPlane);

tableSectionBuilder1->Origin()->SetInferRelativeToGeometry(true);
tableSectionBuilder1->SetNumberOfColumns(6);//设置列数
tableSectionBuilder1->SetNumberOfRows(5);//设置行数
tableSectionBuilder1->SetColumnWidth(12.0);//设置列宽
tableSectionBuilder1->SetRowHeight(7.0);//设置行高
tableSectionBuilder1->Style()->TableSectionStyle()->SetAlignmentPosition(Annotations::TableSectionStyleBuilder::AlignmentPositionTypeTopLeft);
tableSectionBuilder1->Origin()->Plane()->SetPlaneMethod(Annotations::PlaneBuilder::PlaneMethodTypeXyPlane);
tableSectionBuilder1->Origin()->SetInferRelativeToGeometry(true);
Annotations::LeaderData *leaderData1;
leaderData1 = workPart->Annotations()->CreateLeaderData();
leaderData1->SetStubSize(2.0);
tableSectionBuilder1->Leader()->Leaders()->Append(leaderData1);
leaderData1->SetStubSide(Annotations::LeaderSideInferred);
tableSectionBuilder1->Origin()->SetInferRelativeToGeometry(true);
tableSectionBuilder1->Origin()->SetInferRelativeToGeometry(true);

Annotations::Annotation::AssociativeOriginData assocOrigin1;
assocOrigin1.OriginType = Annotations::AssociativeOriginTypeDrag;
View *nullView(NULL);
assocOrigin1.View = nullView;
assocOrigin1.ViewOfGeometry = nullView;
Point *nullPoint(NULL);
assocOrigin1.PointOnGeometry = nullPoint;
assocOrigin1.VertAnnotation = NULL;
assocOrigin1.VertAlignmentPosition = Annotations::AlignmentPositionTopLeft;
assocOrigin1.HorizAnnotation = NULL;
assocOrigin1.HorizAlignmentPosition = Annotations::AlignmentPositionTopLeft;
assocOrigin1.AlignedAnnotation = NULL;
assocOrigin1.DimensionLine = 0;
assocOrigin1.AssociatedView = nullView;
assocOrigin1.AssociatedPoint = nullPoint;
assocOrigin1.OffsetAnnotation = NULL;
assocOrigin1.OffsetAlignmentPosition = Annotations::AlignmentPositionTopLeft;
assocOrigin1.XOffsetFactor = 0.0;
assocOrigin1.YOffsetFactor = 0.0;
assocOrigin1.StackAlignmentPosition = Annotations::StackAlignmentPositionAbove;
tableSectionBuilder1->Origin()->SetAssociativeOrigin(assocOrigin1);

Point3d point1(200, 100, 0.0);//定义点
tableSectionBuilder1->Origin()->Origin()->SetValue(NULL, nullView, point1);//设置表放置位置
tableSectionBuilder1->Origin()->SetInferRelativeToGeometry(true);

NXObject *nXObject1;
nXObject1 = tableSectionBuilder1->Commit();

std::vector<NXObject *> objects1;
objects1 = tableSectionBuilder1->GetCommittedObjects();

tableSectionBuilder1->Destroy();

UF_initialize();

tag_t TabularNote1 = NULL_TAG;
UF_TABNOT_ask_tabular_note_of_section(nXObject1->Tag(), &TabularNote1);//获取表格TAG

tag_t Row0Tag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote1, 0, &Row0Tag);//获取第一行的Tag
tag_t Row1Tag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote1, 1, &Row1Tag);//获取第二行的Tag
tag_t Row2Tag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote1, 2, &Row2Tag);//获取第三行的Tag

tag_t Column0Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 0, &Column0Tag);//获取第一列的Tag
tag_t Column1Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 1, &Column1Tag);//获取第二列的Tag
tag_t Column2Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 2, &Column2Tag);//获取第三列的Tag
tag_t Column3Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 3, &Column3Tag);//获取第四列的Tag
tag_t Column4Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 4, &Column4Tag);//获取第五列的Tag
tag_t Column5Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 5, &Column5Tag);//获取第六列的Tag

tag_t CellRow0Column0Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column0Tag, &CellRow0Column0Tag);//得到第一行第一列单元格的Tag
tag_t CellRow0Column5Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column5Tag, &CellRow0Column5Tag);//得到第一行第六列单元格的Tag

tag_t CellRow1Column0Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column0Tag, &CellRow1Column0Tag);//得到第二行第一列单元格的Tag
tag_t CellRow1Column1Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column1Tag, &CellRow1Column1Tag);//得到第二行第二列单元格的Tag
tag_t CellRow1Column2Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column2Tag, &CellRow1Column2Tag);//得到第二行第三列单元格的Tag
tag_t CellRow1Column3Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column3Tag, &CellRow1Column3Tag);//得到第二行第四列单元格的Tag
tag_t CellRow1Column4Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column4Tag, &CellRow1Column4Tag);//得到第二行第五列单元格的Tag
tag_t CellRow1Column5Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column5Tag, &CellRow1Column5Tag);//得到第二行第六列单元格的Tag

UF_TABNOT_merge_cells(CellRow0Column0Tag, CellRow0Column5Tag);//合并单元格(第一列到第六列)
tag_t MergeRowTag1 = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote1, 0, &MergeRowTag1);//获取合并单元格的行Tag
tag_t MergeColumnTag1 = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote1, 0, &MergeColumnTag1);//获取合并单元格的列Tag
tag_t MergeCellTag1 = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(MergeRowTag1, MergeColumnTag1, &MergeCellTag1);//获取合并单元格的Tag

tag_t Cell2Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column0Tag, &Cell2Tag);//得到第二行第一列单元格的Tag

tag_t Cell3Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row1Tag, Column1Tag, &Cell3Tag);//得到第二行第二列单元格的Tag

//检索默认单元格首选项
UF_TABNOT_cell_prefs_t cell_prefs;//结构体(单元格的格式)
UF_TABNOT_ask_default_cell_prefs(&cell_prefs);

//设置单元格首选项(单元格的格式)
cell_prefs.text_color = 186; //字的颜色
cell_prefs.horiz_just=UF_TABNOT_just_center;//水平居中
cell_prefs.text_density = 1;//字的线条粗细(1标准,2粗体,3细)
cell_prefs.text_height = 4.0;//设置字的高度
UF_TABNOT_set_cell_prefs(MergeCellTag1, &cell_prefs);

UF_TABNOT_set_cell_text(MergeCellTag1, "锣牙加工列表");//写文本
UF_TABNOT_set_cell_text(CellRow1Column0Tag, "序号");//写文本
UF_TABNOT_set_cell_text(CellRow1Column1Tag, "规格");//写文本
UF_TABNOT_set_cell_text(CellRow1Column2Tag, "座标 X");//写文本
UF_TABNOT_set_cell_text(CellRow1Column3Tag, "座标 Y");//写文本
UF_TABNOT_set_cell_text(CellRow1Column4Tag, "深度");//写文本
UF_TABNOT_set_cell_text(CellRow1Column5Tag, "备注");//写文本

UF_terminate();

 

posted on 2021-03-28 09:34  怡宁塑胶模具设计  阅读(470)  评论(0编辑  收藏  举报