/* Copyright (c) 2024 PTC Inc. and/or Its Subsidiary Companies. All Rights Reserved. */ #include <ProToolkit.h> #include <ProDrawing.h> #include <PTApplsUnicodeUtils.h> /*====================================================================*\ FUNCTION : UsrListSheets() PURPOSE : Command to list sheet info in an information window \*====================================================================*/ int UsrListSheets() { ProDrawing drawing; int n_sheets, sheet; ProName wformat; ProCharName format; ProUnititem units; double width; double height; char unit [PRO_NAME_SIZE]; FILE *fp; ProName wfname; char *fname = "sheets.txt"; /*--------------------------------------------------------------------*\ Open a text file to contain the information to be displayed \*--------------------------------------------------------------------*/ fp = PTApplsUnicodeFopen(fname, "w"); /*--------------------------------------------------------------------*\ Get the current drawing \*--------------------------------------------------------------------*/ ProMdlCurrentGet((ProMdl*)&drawing); /*--------------------------------------------------------------------*\ Get the number of sheets \*--------------------------------------------------------------------*/ ProDrawingSheetsCount(drawing, &n_sheets); for(sheet=1;sheet<=n_sheets;sheet++) { /*--------------------------------------------------------------------*\ Get the drawing sheet size etc. \*--------------------------------------------------------------------*/ ProDrawingSheetSizeGet (drawing, sheet, NULL, &width, &height); ProDrawingSheetUnitsGet (drawing, sheet, &units); /*--------------------------------------------------------------------*\ Get the format used, if any \*--------------------------------------------------------------------*/ if (ProDrawingFormatGet(drawing, sheet, wformat) == PRO_TK_NO_ERROR) ProWstringToString(format, wformat); else strcpy(format,"(NONE)"); /*--------------------------------------------------------------------*\ Print the information to the text file \*--------------------------------------------------------------------*/ ProWstringToString (unit, units.name); ProTKFprintf(fp,"Sheet %d\n", sheet); ProTKFprintf(fp," Width : %lf %s\n", width, unit); ProTKFprintf(fp," Height : %lf %s\n", height, unit); ProTKFprintf(fp," Format : %s\n", format); } /*--------------------------------------------------------------------*\ Close the file, and display it \*--------------------------------------------------------------------*/ fclose(fp); ProStringToWstring(wfname, fname); ProInfoWindowDisplay(wfname, NULL, NULL); return 0; }