文章作者:里海
来源网站:https://blog.csdn.net/WangPaiFeiXingYuan
UF_MODL_create_extrude_trim_opts1
Defined in: uf_modl_sweep.h
int UF_MODL_create_extrude_trim_opts1(tag_t * extrude_array, int extrude_count, UF_MODL_SWEEP_TRIM_object_p_t trim_ptr, UF_MODL_SWEEP_TRIM_OPTS trim_options, char * taper_angle, char * limits [ 2 ] , char * offsets [ 2 ] , double region_point [ 3 ] , logical cut_specified, logical solid_body_creation, double dir [ 3 ] , UF_FEATURE_SIGN sign, tag_t target_body, tag_t * * objects, int * object_count )
overview 概述
Creates an extruded feature with trimming options, and perform Boolean
operation with given target body.
创建一个带有修剪选项的挤压特性,并对给定的目标主体执行布尔操作。
UFUN例子
欢迎订阅《里海NX二次开发3000例专栏》https://blog.csdn.net/wangpaifeixingyuan/category_8840986.html,点击链接扫码即可订阅(持续更新中)。已经有几百人订阅,订阅是永久的,无限期阅读,如需帮助请私信。
parameters 参数
tag_t * | extrude_array | Input | List of objects to be extruded. 要挤压的对象列表。 |
int | extrude_count | Input | Count of the objects to be extruded. 要挤压的物体的数量。 |
UF_MODL_SWEEP_TRIM_object_p_t | trim_ptr | Input | The structure that contains the trimming data. 包含裁剪数据的结构。 |
UF_MODL_SWEEP_TRIM_OPTS | trim_options | Input | Trimming options: DO_NOT_EXTEND_TRIM_FACE = do not extend the trimming face, DO_NOT_EXTEND_AND_EXTEND_TRIM_FACE = first do not extend the trimming face and perform boolean operation. If fails, extend the trimming face and perform boolean. EXTEND_FIRST_TRIM_FACE = extend the first trimming face, EXTEND_SECOND_TRIM_FACE = extend the second trimming face, EXTEND_BOTH_TRIM_FACES = extend both trimming faces 修剪选项: DO _ NOT _ EXTEND _ TRIM _ FACE = 不要扩展修剪面,DO _ NOT _ EXTEND _ AND _ EXTEND _ TRIM _ FACE = 首先不要扩展修剪面并执行布尔运算。如果失败,扩大修整面和执行布尔。EXTEND _ FIRST _ TRIM _ FACE = 延伸第一修边面,EXTEND _ SECOND _ TRIM _ FACE = 延伸第二修边面,EXTEND _ BOTH _ TRIM _ FACE = 延伸两个修边面 |
char * | taper_angle | Input | The taper angle for the extrusion. 挤压用锥角。 |
char * | limits [ 2 ] | Input | extrude_count The limits of the extrusion. Only used if the trim_ptr argument is NULL. 挤压的限制。只有在 trime _ ptr 参数为 NULL 时才使用。 |
char * | offsets [ 2 ] | Input | The offsets for open strings 开放字符串的偏移量 |
double | region_point [ 3 ] | Input | The point on the region desired. 所需区域上的点。 |
logical | cut_specified | Input | TRUE or FALSE for region desired. 所需区域为真或假。 |
logical | solid_body_creation | Input | If TRUE, create solid bodies if the input string is closed. Otherwise sheet bodies will be created. 如果为 TRUE,则在输入字符串关闭时创建实体,否则将创建工作表实体。 |
double | dir [ 3 ] | Input | The extrusion direction. 挤压方向。 |
UF_FEATURE_SIGN | sign | Input | The sign of the operation to be performed: UF_POSITIVE = add to target solid UF_NEGATIVE = subtract from target solid UF_UNSIGNED = intersect with target solid 要执行的操作符号: UF _ POSITIVE = 加入到目标固体 UF _ NEGATIVE = 减去目标固体 UF _ UNSIGNED = 与目标固体相交 |
tag_t | target_body | Input | Target body to perform Boolean operation 目标体执行布尔运算 |
tag_t * * | objects | Output to UF_free | An array of extruded feature tags. This must be freed by calling UF_free. 一个挤压的特性标签的数组。这必须通过调用 UF _ free 来释放。 |
int * | object_count | Output | The number of features returned in the objects array. 在对象数组中返回的特性数。 |
C++语言在UG二次开发中的应用及综合分析
- C++ 是C语言的扩展,它既可以执行C语言的过程化程序设计,也可以进行以抽象数据类型为特点的基于对象的设计,以及面向对象的程序设计。C++ 在处理问题规模上具有很大的适应性。
- C++不仅具有计算机高效运行的实用性特征,并且致力于提升大规模程序的编程质量以及程序设计语言的问题描述能力。
在UG二次开发中,C++语言具有以下特点
- C++语言支持多种程序设计风格
- C++的许多特性以库的形式存在,保证了语言的简洁和开发运行的效率
- 与C语言相比,C++引入了面向对象的概念,使得UG二次开发的人机交互界面更加简洁
- 通过借助UG自带的2000多种API函数,结合高级语言C++以及编程软件Visual Studio,可以对UG进行二次开发
- 需要注意的是,市场上的Visual Studio和UG版本众多,并非所有版本都能兼容
程序设计过程通常包括以下步骤:
- 问题分析:对要解决的问题进行深入的分析,理解问题的具体需求和限制。
- 需求定义:明确程序的目标和功能,包括用户需求、系统需求等。
- 设计:根据需求进行设计,包括算法设计、数据结构设计、界面设计等。
- 编码:根据设计的结果,使用一种编程语言将程序代码实现出来。
- 测试:通过各种测试方法来确保程序的正确性,包括单元测试、集成测试、系统测试等。
- 维护:对程序进行修改和完善,以解决可能出现的问题或满足新的需求。
- 文档编写:编写程序文档,描述程序的功能、操作方法、注意事项等。
以下是一个创建体素特征(块、柱、锥、球)的二次开发例子
#include <stdio.h>
#include <stdarg.h>
#include <uf_modl_primitives.h>
#include <uf_ui_ugopen.h>
#include <uf.h>
#include <uf_defs.h>
//封装打印函数,用于将信息打印到信息窗口
//QQ3123197280
int ECHO(const char* szFormat, ...)
{
char szMsg[5000] = "";
va_list arg_ptr;
va_start(arg_ptr, szFormat);
vsprintf_s(szMsg, szFormat, arg_ptr);
va_end(arg_ptr);
UF_UI_open_listing_window();
UF_UI_write_listing_window(szMsg);
return 0;
}
extern DllExport void ufusr(char* param, int* returnCode, int rlen)
{
UF_initialize();
//创建块
UF_FEATURE_SIGN sign = UF_NULLSIGN;
//块起点相对于ABS
double block_orig[3] = { 0.0,0.0,0.0 };
//方向相对于WCS
char* block_len[3] = { "10", "30", "10" };
tag_t blk_obj;//体特征
UF_MODL_create_block1(sign, block_orig, block_len, &blk_obj);
int iEdit = 0;
char* size[3];
UF_MODL_ask_block_parms(blk_obj, iEdit, size);
ECHO("%s,%s,%s\n", size[0], size[1], size[2]);//输出: p6=10,p7=30,p8=10
//创建圆柱
UF_FEATURE_SIGN sign1 = UF_NULLSIGN;
double origin[3] = { 10.0,0.0,10.0 };
char height[] = "20";
char diam[] = "10";
double direction[3] = { 0,0,1 };//方向
tag_t cyl_obj_id;
UF_MODL_create_cyl1(sign1, origin, height, diam, direction, &cyl_obj_id);
int iEdit2 = 0;
char* cDiameter;
char* cHeight;
UF_MODL_ask_cylinder_parms(cyl_obj_id, iEdit2, &cDiameter, &cHeight);
ECHO("%s,%s\n", cDiameter, cHeight);//输出:p9=10,p10=20
UF_free(cDiameter);
UF_free(cHeight);
//创建圆锥
UF_FEATURE_SIGN sign2 = UF_NULLSIGN;
double origin2[3] = { 0.0,0.0,10.0 };
char height2[] = "20";
char* diam2[2] = { "10" ,"5" };
double direction2[3] = { 0,0,1 };//方向
tag_t cone_obj_id;
UF_MODL_create_cone1(sign2, origin2, height2, diam2, direction2, &cone_obj_id);
int iEdit3 = 0;
char* cD1;
char* cD2;
char* cH;
char* cAngle;
UF_MODL_ask_cone_parms(cone_obj_id, iEdit3, &cD1, &cD2, &cH, &cAngle);
ECHO("%s,%s,%s,%s\n", cD1, cD2, cH, cAngle);//输出:p11=10,p12=5,p13=20,p14=7.1250163489018
UF_free(cD1);
UF_free(cD2);
UF_free(cH);
UF_free(cAngle);
//创建球
UF_FEATURE_SIGN sign3 = UF_NULLSIGN;
double douCenter2[3] = { 0.0,0.0,30.0 };
char cDiam[] = "8";
tag_t sphere_obj_id;
UF_MODL_create_sphere1(sign3, douCenter2, cDiam, &sphere_obj_id);
int iEdit4 = 0;
char* cDiam_parm;
UF_MODL_ask_sphere_parms(sphere_obj_id, iEdit4, &cDiam_parm);
ECHO("%s\n", cDiam_parm);//输出:p15=8
UF_free(cDiam_parm);
UF_terminate();
}
extern int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
效果: