|
马上注册登录,享用更多网站功能!
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
在获取装配信息时,ProCompath是一个很重要的概念,通过它我们可以获得装配体所有的信息。如下的代码就是用来通过ProSelection获取ProCompath的代码。但是这种方式必须通过在特征列表树上点取特征才能够获取ProSelection,从而获取ProCompath. 请问,有没有办法不通过这种点取方式获得ProCompath,而是通过自动访问特征列表方式获取ProCompath呢?急问,谢谢!
/*====================================================================*\
Function : UserAsmcompTransfGet()
Purpose : Find the transformation matrix of the specified component
\*====================================================================*/
int UserAsmcompTransfGet()
{
ProError status;
ProMdl model;
int nb_sel, i;
ProMatrix matrix;
ProAsmcomppath comp_path;
//ProIdTable comp_id_table;
ProSelection *sel_list;
//ProModelitem sel_obj;
//ProFeature feature;
//ProFeattype ftype;
FILE *fp_out=NULL;
ProName w_name;//, wfile_name;
ProCharName name;
status = ProSelect ("prt_or_asm",1,NULL,NULL,NULL,NULL,
&sel_list,&nb_sel);
if (status == PRO_TK_NO_ERROR)
{
if (nb_sel > 0)
{
status = ProSelectionAsmcomppathGet(sel_list[0],
&comp_path);
status = ProAsmcomppathTrfGet (&comp_path,PRO_B_TRUE,matrix);
status = ProAsmcomppathMdlGet(&comp_path,&model);
ProMdlNameGet(model,w_name);
ProWstringToString(name,w_name);
fp_out = fopen("rptfile.txt", "w");
fprintf(fp_out, " ------ Component Location ------ \n\n");
fprintf(fp_out, "Component name : %s\n\n",name);
fprintf(fp_out, "Matrix :\n\n");
for (i=0 ; i<4 ; i++)
fprintf(fp_out, "%f\t%f\t%f\t%f\n",
matrix[0],matrix[1],
matrix[2],matrix[3]);
fclose(fp_out);
ProStringToWstring(w_name,"rptfile.txt");
status = ProInfoWindowDisplay (w_name,NULL,NULL);
if (status != PRO_TK_NO_ERROR)
return (-1);
}
}
return (PRO_TK_NO_ERROR);
} |
|