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;//设置图纸大小、投影视角、视图比例等
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 UF_DRAW_update_one_view(DrawingTag, TopDrawViewTag);
45 UF_DRAW_update_one_view(DrawingTag, RightViewTag);
46
47 UF_terminate();

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

时间: 2024-10-03 18:26:20

NX二次开发-UFUN添加工程图投影视图UF_DRAW_add_orthographic_view的相关文章

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

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二次开发-UFUN设置工程图PNG图片高度UF_DRF_set_image_height

1 #include <uf.h> 2 #include <uf_drf.h> 3 4 5 UF_initialize(); 6 7 //插入PNG 8 char* file_name = "D:\\123.png"; 9 double origin[3] = { 50.0, 50.0, 0.0 }; 10 tag_t ImageTag = NULL_TAG; 11 UF_DRF_create_image_from_file(file_name, NULL_TA

NX二次开发-UFUN设置工程图PNG图片长度UF_DRF_set_image_width

1 #include <uf.h> 2 #include <uf_drf.h> 3 4 5 UF_initialize(); 6 7 //插入PNG 8 char* file_name = "D:\\123.png"; 9 double origin[3] = { 50.0, 50.0, 0.0 }; 10 tag_t ImageTag = NULL_TAG; 11 UF_DRF_create_image_from_file(file_name, NULL_TA

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二次开发-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二次开发-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;//设置图纸