/*====================================================================*\ FILE : UgXsecList.c PURPOSE : List all the Xsecs HISTORY.. DATE BUILD AUTHOR MODIFICATIONS 04-dec-97 H-02-02 Stefan $$1 Created \*====================================================================*/ /*---------------------- Pro/Toolkit Includes ------------------------*/ #include /*---------------------- Pro/Develop Includes ------------------------*/ #include "prodevelop.h" /*---------------------- Application Includes ------------------------*/ #include /*---------------------- Function Prototypes -------------------------*/ int user_List_Xsecs(); int user_member_path (); user_List_Xsecs() { Prohandle h_obj, h_xsec, xsec_geom, h_face, h_cont; ProName w_name; ProCharName name; char path[200]; int n_components, c, n_faces, n_conts; int memb_num, *memb_id_tab; ProCharName filename = {'x','s','e','c','s','.','l','s','t','\0'}; ProFileName wfilename; FILE *fp; fp = fopen(filename, "w"); h_obj = pro_get_current_object(); /*-----------------------------------------------------------*\ For each cross section... \*-----------------------------------------------------------*/ for (h_xsec = prodb_first_xsec (h_obj, &n_components); h_xsec != NULL; h_xsec = prodb_next_xsec (h_obj, h_xsec, &n_components)) { /*-----------------------------------------------------------*\ Get the name. \*-----------------------------------------------------------*/ if (prodb_xsec_name (h_obj, h_xsec, w_name) == 0) continue; fprintf(fp,"Cross section %s\n", pro_wstr_to_str (name, w_name)); /*-----------------------------------------------------------*\ Regenerate, so you can extract the geometry. \*-----------------------------------------------------------*/ prodb_regen_parallel_xsec (h_obj, h_xsec); /*-----------------------------------------------------------*\ For each component of the cross section \*-----------------------------------------------------------*/ for (c = 0; c < n_components; c++) { /*-----------------------------------------------------------*\ Get the assembly member and geometry. \*-----------------------------------------------------------*/ prodb_xsec_component (h_obj, h_xsec, c, &memb_num, &memb_id_tab, &xsec_geom); /*-----------------------------------------------------------*\ Print the assembly path of the component. \*-----------------------------------------------------------*/ user_member_path (h_obj, memb_num, memb_id_tab, path); fprintf(fp," Component %2d : %s\n", c, path); /*-----------------------------------------------------------*\ List the component faces and contours. \*-----------------------------------------------------------*/ h_face = xsec_geom; n_faces = 1; do { fprintf(fp, " Face %d, area %f\n", n_faces++, pro_face_area (h_face)); n_conts = 1; for (h_cont = prodb_first_face_contour (h_face); h_cont != NULL; h_cont = prodb_next_face_contour (h_cont)) fprintf(fp, " Contour %d\n", n_conts++); } while ((h_face = prodb_next_part_face (h_face)) != NULL); } } ProInfoWindowDisplay(wfilename, NULL, NULL); } user_member_path (h_obj, memb_num, memb_id_tab, path) Prohandle h_obj; int memb_num, *memb_id_tab; char path[]; { Pro_object_info info; char name[80], type[10],buff[100]; int m; prodb_get_object_info (h_obj, &info); strcpy (path, pro_wstr_to_str (name, info.name)); strcat (path, "."); strcat (path, pro_wstr_to_str (type, info.type)); for (m = 0; m < memb_num; m++) { h_obj = prodb_member_to_object (h_obj, memb_id_tab[m]); prodb_get_object_info (h_obj, &info); sprintf(buff, "/%s.%s[%d]", pro_wstr_to_str (name, info.name), pro_wstr_to_str (type,info.type), memb_id_tab[m]); strcat (path, buff); } }