NX11+VS2013

 #include <uf.h>
#include <uf_ui.h>
#include <uf_tabnot.h>
#include <NXOpen/Part.hxx>
#include <NXOpen/PartCollection.hxx>
#include <NXOpen/Session.hxx>
#include <NXOpen/Annotations_TableSectionCollection.hxx>
#include <NXOpen/Annotations_AnnotationManager.hxx>
#include <NXOpen/FontCollection.hxx> UF_initialize(); //创建表格注释
Annotations::TableSection *nullAnnotations_TableSection(NULL);
Annotations::TableSectionBuilder *tableSectionBuilder1;
tableSectionBuilder1 = workPart->Annotations()->TableSections()->CreateTableSectionBuilder(nullAnnotations_TableSection);
NXOpen::Point3d TablePoint(194.0, 17.0, 0.0);
tableSectionBuilder1->Origin()->SetOriginPoint(TablePoint);
tableSectionBuilder1->SetNumberOfColumns();
tableSectionBuilder1->SetNumberOfRows();
tableSectionBuilder1->SetRowHeight(20.0);
tableSectionBuilder1->SetColumnWidth();
tableSectionBuilder1->Commit();
NXObject *nXObject1;
nXObject1 = tableSectionBuilder1->Commit();
tableSectionBuilder1->Destroy(); //section转tag
tag_t TabularNote = NULL_TAG;
UF_TABNOT_ask_tabular_note_of_section(nXObject1->Tag(), &TabularNote); //获取第一行的Tag
tag_t Row0Tag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote, , &Row0Tag); //获取第二行的Tag
tag_t Row1Tag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote, , &Row1Tag); //获取第一列的Tag
tag_t Column0Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote, , &Column0Tag); //获取第二列的Tag
tag_t Column1Tag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote, , &Column1Tag); //得到第一行第一列单元格的Tag
tag_t Cell0Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column0Tag, &Cell0Tag); //得到第一行第二列单元格的Tag
tag_t Cell1Tag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(Row0Tag, Column1Tag, &Cell1Tag); //得到第二行第一列单元格的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); //写文本
UF_TABNOT_set_cell_text(Cell0Tag, "<WRef2*0@SBA>");
UF_TABNOT_set_cell_text(Cell1Tag, "卢尚宇"); //合并最底下的单元格
UF_TABNOT_merge_cells(Cell2Tag, Cell3Tag); //获取合并单元格的行Tag
tag_t MergeRowTag = NULL_TAG;
UF_TABNOT_ask_nth_row(TabularNote, , &MergeRowTag); //获取合并单元格的列Tag
tag_t MergeColumnTag = NULL_TAG;
UF_TABNOT_ask_nth_column(TabularNote, , &MergeColumnTag); tag_t MergeCellTag = NULL_TAG;
UF_TABNOT_ask_cell_at_row_col(MergeRowTag, MergeColumnTag, &MergeCellTag); //写文本
UF_TABNOT_set_cell_text(MergeCellTag, "版本号:xxxxxxxxxx"); //检索默认单元格首选项
UF_TABNOT_cell_prefs_t cell_prefs;
UF_TABNOT_ask_default_cell_prefs(&cell_prefs); //设置单元格首选项
int fontIndex1 = workPart->Fonts()->AddFont("chinesef_fs", NXOpen::FontCollection::TypeNx);//更改字体
cell_prefs.text_font = fontIndex1; //字体
UF_TABNOT_set_cell_prefs(Cell0Tag, &cell_prefs);
UF_TABNOT_set_cell_prefs(Cell1Tag, &cell_prefs);
UF_TABNOT_set_cell_prefs(MergeCellTag, &cell_prefs); //读取单元格内容
char* cell_text;
UF_TABNOT_ask_cell_text(Cell0Tag, &cell_text); //分割字符串
string strCellText = cell_text;
string strRight = (strCellText.substr(strCellText.find("@") + , strCellText.find(" ")));//提取右值
string strLift = (strRight.substr(, strRight.find(">")));//提取左值 //打印
char msg[];
sprintf_s(msg, "此单元格关联的部件属性为:%s", strLift);
uc1601(msg, ); UF_terminate();
Caesar卢尚宇
2019年12月15日

NX二次开发-读取图纸表格注释与部件属性关联的名字的更多相关文章

  1. NX二次开发-UFUN工程图表格注释section转tag函数UF_TABNOT_ask_tabular_note_of_section

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

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

    NX9+VS2012 #include <uf.h> #include <uf_tabnot.h> #include <NXOpen/Part.hxx> #incl ...

  8. 【NX二次开发】按层查找工作部件中的对象 UF_LAYER_cycle_by_layer

    第一次调用 :返回第一个启用层中的第一个对象. 第二次调用 :返回下一个已启用层中的下一个对象. 最后一次调用:当所有对象都被耗尽时,将返回object_tag = NULL_TAG. 在循环数据库时 ...

  9. NX二次开发-UFUN创建工程图注释UF_DRF_create_note

    NX9+VS2012 #include <uf.h> #include <uf_drf.h> #include <NXOpen/Annotations_Note.hxx& ...

随机推荐

  1. 在CMake中启用VS2017的C++17特性

    VS2017的C++17特性默认并未开启,需要在编译参数中手动开启.找到项目的CMakeLists.txt,在查找编译器的代码后面加入如下内容即可. ") include(CheckCXXC ...

  2. ajax json jQuery提示parsererror错误解决办法

    $.ajax({ type:'POST', url:'<%=basePath%>/xxx.do', dataType:'JSON', data:{ }, success:function( ...

  3. Case Closed?

    Finally, we'll want a way to test whether a file we've opened is closed. Sometimes we'll have a lot ...

  4. flex: 1在ios10.2系统手机端的换行布局失败问题

    使用flex:1要追加flex-basis: auto;可以简写flex: 1 1 auto; 表格不可以用flex布局

  5. RN 0.6以后react-navigation 导航报错null is not an object (evaluating '_RNGestureHandlerModule.default.Direction')

    很久没用RN了之前用的时候还是很早的版本,现在有了很大的变化,感觉比之前成熟了很多重新看下.先整下导航 参考地址:https://reactnavigation.org/docs/en/getting ...

  6. tomcat8.5在centos部署阿里云免费证书

    最近在做微信小程序,部署完服务器之后,发现报了个错误,说是我的域名不在以下合法域名列表中.对比了一下才发现我的域名还是http的没升级到https,之后我就到阿里云去申请了证书.中间有一次审核失败,查 ...

  7. (转)openfire插件开发(一)

    转:http://blog.csdn.net/lovexieyuan520/article/details/37774909 1. 在上一篇博文中,我介绍了Openfire3.9.3源代码导入ecli ...

  8. 解决spring boot中普通类中使用service为null 的方法

    我使用的是springboot+mybatisplus +mysql1.创建一个SpringUtil工具类 import org.springframework.beans.BeansExceptio ...

  9. Ubuntu 没有 无线网 RTL8821ce 8111 8186

    1.将ubuntu的linux内核版本更改到4.14(其他版本不兼容这个无线网卡的驱动) 1.1 找到内核版本 #到 Ubuntu网站http://kernel.ubuntu.com/~kernel- ...

  10. 20140506 visio 画布大小 栈实现队列 堆空闲内存地址链表 堆最大可分配的内存 可用内存链表

    1.调整visio的画布大小 按住Ctrl鼠标移动到画布边缘即可 2.两个栈实现一个队列 一个栈用于入队,一个用于出队 #include<iostream> #include<sta ...