购买与咨询 NX 二次开发视频教程,请联系微信号:13890821008 QQ号:85585969
函数结构:UF_CURVE_ask_proj_curve_parents( tag_t proj_curve, tag_t * defining_feature, tag_t * defining_target, tag_t * defining_curve) 函数说明:
给定一个输入投影曲线,确定该功能标识符,所述目标对象标识符(sheet_body/面/平面/ datum_plane),并且限定投影曲线的曲线标识。投影曲线必须是由制造的曲线UF_CURVE_create_proj_curves。您可以通过调用获得这个曲线功能UF_CURVE_ask_proj_curves。如果返回错误投影曲线不属于投影曲线特征。下面的示例创建在原点(0,0,0)与边块的(300,25,150)的长度。该程序创建并投影到线块的面。下一个投影曲线被发现,然后脸部曲线投影到与限定曲线生成投影曲线来确定。
函数参数:
第1个参数为输入:
proj_curve代表参数变量,tag_t 为输入参数类型,曲线标识符,其预测曲线的特征,定义sheet_body/面/面/基准面,并定义曲线都可以找到。
第2个参数为输出:
defining_feature代表参数变量,tag_t * 为输出参数类型,投影曲线有可产生输入曲线标识符。
第3个参数为输出:
defining_target代表参数变量,tag_t * 为输出参数类型,在确定目标的sheet_body/面/面/基准面标识符输入曲线投射。
第4个参数为输出:
defining_curve代表参数变量,tag_t * 为输出参数类型,生成此投影曲线投影曲线特征的定义曲线标识。
UF_CURVE_ask_proj_curve_parents函数实例代码演示:
[quote]
#include <stdio.h>
#include <stdlib.h>
#include <uf.h>
#include <uf_curve.h>
#include <uf_modl.h>
#include <uf_part.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)
{
char messg[133];
printf("%s, line %d: %s\n", file, line, call);
(UF_get_fail_message(irc, messg)) ?
printf(" returned a %d\n", irc) :
printf(" returned error %d: %s\n", irc, messg);
}
return(irc);
}
static void do_ugopen_api(void)
{
int num_faces,i,num_proj_curves;
double origin[3]={0.0,0.0,0.0};
tag_t part_tag,block_tag,curves_to_proj[1];
tag_t *faces,proj_curve_feature,*proj_curves;
tag_t defining_feature,defining_target,defining_curve;
char *part_name = "proj_curve";
char *edge_lens[3]={"300.0","25.0","150.0"};
UF_CURVE_line_t line_data;
UF_CURVE_proj_t proj_data;
uf_list_p_t face_list;
UF_CALL(UF_PART_new(part_name,ENGLISH,&part_tag));
UF_CALL(UF_MODL_create_block1(UF_NULLSIGN,
origin,
edge_lens,
&block_tag));
line_data.start_point[0] = 25.0;
line_data.start_point[1] = 50.0;
line_data.start_point[2] = 25.0;
line_data.end_point[0] = 275.0;
line_data.end_point[1] = 50.0;
line_data.end_point[2] = 125.0;
UF_CALL(UF_CURVE_create_line(&line_data,&curves_to_proj[0]));
printf("curves to project tag = %d\n",curves_to_proj[0]);
UF_CALL(UF_MODL_ask_feat_faces(block_tag,&face_list));
UF_CALL(UF_MODL_ask_list_count(face_list,&num_faces));
faces = (tag_t *)malloc(num_faces * sizeof(tag_t));
for (i = 0;i < num_faces;i++)
{
UF_CALL(UF_MODL_ask_list_item(face_list,
i,
&faces[i]));
printf("face %d of block tag = %d\n",i,faces[i]);
}
UF_CALL(UF_MODL_delete_list(&face_list));
proj_data.proj_type = 3;
proj_data.proj_vec[0] = 0.0;
proj_data.proj_vec[1] = 1.0;
proj_data.proj_vec[2] = 0.0;
proj_data.multiplicity = 2;
UF_CALL(UF_CURVE_create_proj_curves(1,
curves_to_proj,
num_faces,
faces,
3,
&proj_data,
&proj_curve_feature));
printf("proj curve feature tag = %d\n",proj_curve_feature);
UF_CALL(UF_CURVE_ask_proj_curves(proj_curve_feature,
&num_proj_curves,
&proj_curves));
for (i = 0;i < num_proj_curves;i++)
{
UF_CALL(UF_CURVE_ask_proj_curve_parents(proj_curves[i],
&defining_feature,
&defining_target,
&defining_curve));
printf("proj_curves[%d]\n",i);
printf(" belongs to feature tag = %d\n",defining_feature);
printf(" was projected onto tag = %d\n",defining_target);
printf(" was generated by curve tag = %d\n",
defining_curve);
}
UF_free(proj_curves);
free(faces);
}
/*ARGSUSED*/
void ufusr(char *param, int *retcode, int paramLen)
{
if (!UF_CALL(UF_initialize()))
{
do_ugopen_api();
UF_CALL(UF_terminate());
}
}
int ufusr_ask_unload(void)
{
return (UF_UNLOAD_IMMEDIATELY);
}
[/quote]