iCAx开思工具箱
标题:
急问,如何不用在特征列表树上选取方式就能够获得装配组件的procompath
[打印本页]
作者:
liujiangsh
时间:
2006-9-9 07:11
标题:
急问,如何不用在特征列表树上选取方式就能够获得装配组件的procompath
在获取装配信息时,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);
}
欢迎光临 iCAx开思工具箱 (https://t.icax.org/)
Powered by Discuz! X3.3