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

 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;//设置图纸大小、投影视角、视图比例等
13 DrawingInfo.size_state = UF_DRAW_METRIC_SIZE;//设置图纸类型
14 DrawingInfo.size.metric_size_code = UF_DRAW_A4;//设置图纸大小
15 DrawingInfo.drawing_scale = 1.0;//设置比例
16 DrawingInfo.units = UF_PART_METRIC;//设置单位
17 DrawingInfo.projection_angle = UF_DRAW_FIRST_ANGLE_PROJECTION;//设置投影视角
18 tag_t DrawingTag = NULL_TAG;
19 UF_DRAW_create_drawing(DrawingName, &DrawingInfo, &DrawingTag);
20
21 //导入视图(创建Top视图)
22 //找名字获取视图的Tag
23 tag_t TopViewTag = NULL_TAG;
24 UF_OBJ_cycle_by_name_and_type(UF_PART_ask_display_part(), "Top", UF_view_type, false, &TopViewTag);
25
26 UF_DRAW_view_info_t TopViewInfo;
27 UF_DRAW_initialize_view_info(&TopViewInfo);//初始化视图信息
28 double TopDwgPoint[2] = {150.0, 160.0};
29 tag_t TopDrawViewTag = NULL_TAG;
30 UF_DRAW_import_view(DrawingTag, TopViewTag, TopDwgPoint, &TopViewInfo, &TopDrawViewTag);
31
32 //添加投影视图
33 //UF_DRAW_project_infer = 0,自动判断
34 //UF_DRAW_project_above,上
35 //UF_DRAW_project_right,右
36 //UF_DRAW_project_below,下
37 //UF_DRAW_project_left左
38 UF_DRAW_proj_dir_t RightProjection =  UF_DRAW_project_right;
39 double RightDwgPoint[2] = {35.0, 160.0};
40 tag_t RightViewTag = NULL_TAG;
41 UF_DRAW_add_orthographic_view(DrawingTag, TopDrawViewTag, RightProjection, RightDwgPoint, &RightViewTag);
42
43 //视图重命名
44 Drawings::BaseView *baseView1(dynamic_cast<Drawings::BaseView *>(NXOpen::NXObjectManager::Get(TopDrawViewTag)));
45 baseView1->SetName("LSY");
46
47 //更新视图
48 UF_DRAW_update_one_view(DrawingTag, TopDrawViewTag);
49 UF_DRAW_update_one_view(DrawingTag, RightViewTag);
50
51 UF_terminate();

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

时间: 2024-10-09 09:18:16

NX二次开发-NXOPEN更改工程图视图名字baseView1->SetName("LSY");的相关文章

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>

NX二次开发-UFUN移动工程图视图UF_DRAW_move_view

1 #include <uf.h> 2 #include <uf_draw.h> 3 #include <uf_drf.h> 4 #include <uf_obj.h> 5 6 7 8 UF_initialize(); 9 10 //获得当前图纸页的tag 11 tag_t drawing_tag = NULL_TAG; 12 UF_DRAW_ask_current_drawing(&drawing_tag); 13 14 //找名字获取视图tag

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二次开发-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_DRAW_set_view_scale

1 #include <uf.h> 2 #include <uf_draw.h> 3 #include <uf_drf.h> 4 #include <uf_obj.h> 5 6 7 8 UF_initialize(); 9 10 //获得当前图纸页的tag 11 tag_t drawing_tag = NULL_TAG; 12 UF_DRAW_ask_current_drawing(&drawing_tag); 13 14 //找名字获取视图tag

NX二次开发-UFUN获取工程图所有视图tag UF_DRAW_ask_views

1 #include <uf.h> 2 #include <uf_draw.h> 3 #include <uf_drf.h> 4 #include <uf_obj.h> 5 6 7 8 UF_initialize(); 9 10 //获得当前图纸页的tag 11 tag_t drawing_tag = NULL_TAG; 12 UF_DRAW_ask_current_drawing(&drawing_tag); 13 14 //找名字获取视图tag

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