购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
创建螺旋扫掠体的示例代码

以下 CreateHelical 为自定义函数,功能为创建一条螺旋线,并将该螺旋线作为引导线,相关函数原型可以参考帖子:https://www.ugapi.com/thread-10037.html
示例代码:
tag_t helicalTag = CreateHelical(strVal, origin, xd, yd);
UF_CURVE_line_t
line_coords;
UF_STRING_t
s_guide,
s_section,
s_law,
s_spine;
UF_METHOD_t
orientation,
scaling;
int
alignment = 1,
body_type = 1,
inter = UF_MODL_LINEAR;
double
tol[3] = { 0, 0, 0 };
tag_t
body_id;
/* 创建导向曲线 */
UF_MODL_init_string_list(&s_guide);
UF_MODL_create_string_list(1, 1, &s_guide);
s_guide.num = 1;
s_guide.string[0] = 1;
s_guide.dir[0] = 1;
s_guide.id[0] = helicalTag; //将前面创建的螺旋线作为引导线
/* 创建截面曲线 */
UF_MODL_init_string_list(&s_section);
UF_MODL_create_string_list(1, 4, &s_section);
s_section.num = 1;
s_section.string[0] = 4;
s_section.dir[0] = 1;
line_coords.start_point[0] = 0.0;
line_coords.start_point[1] = 0.0;
line_coords.start_point[2] = 0.0;
line_coords.end_point[0] =0.0;
line_coords.end_point[1] =0.0;
line_coords.end_point[2] =0.0;
line_coords.end_point[1] = 1;
UF_CURVE_create_line (&line_coords, &s_section.id[0] );
UF_VEC3_copy(line_coords.end_point, line_coords.start_point);
line_coords.end_point[2] = 1;
UF_CURVE_create_line (&line_coords, &s_section.id[1] );
UF_VEC3_copy(line_coords.end_point, line_coords.start_point);
line_coords.end_point[1] = 0;
UF_CURVE_create_line (&line_coords, &s_section.id[2] );
UF_VEC3_copy(line_coords.end_point, line_coords.start_point);
line_coords.end_point[2] = 0;
UF_CURVE_create_line (&line_coords, &s_section.id[3] );

●●●请先
登陆 或
注册 后查看●●●
UF_MODL_create_sweep ( &s_guide,
&s_section,
&s_spine,
&orientation,
&scaling,
&alignment,
&inter,
&body_type,
UF_NULLSIGN,
tol,
&body_id );
UF_MODL_free_string_list(&s_guide);
UF_MODL_free_string_list(&s_section);
UF_MODL_free_string_list(&s_spine);
UF_MODL_free_string_list(&s_law);