/*===========================================================================*\ FILE : ProTestSymDefInfo.c PURPOSE: Symdef - demo & test. Print information about all sym def in current drawing HISTORY: DATE AUTHOR MODIFICATIONS 24-Feb-99 I-03-20 akh $$1 Create 03-Mar-00 J-01-03 akh $$2 ProDrawingDtlsymdefsCollect doesn't require sheet argument. \*===========================================================================*/ #include #include #include #include #include #include #include #include #include #include #include "TestError.h" #include "UtilMessage.h" #include "UtilString.h" #include "UtilNames.h" #define BOOL_TO_STR(a) (a)?("TRUE"):("FALSE") /*=========================================================================*\ Function: ProTestSymDefInfoAttach() Purpose: Print info about all attache from symdata Returns: PRO_TK_NO_ERROR if success; \*=========================================================================*/ ProError ProTestSymDefInfoAttach(FILE *fp, ProDtlsymdefdata symdata) { ProError error; int n_attache; ProDtlsymdefattach *attaches; double entity_parameter; ProVector location; int entity_id, n; ProCharLine astr; ProDtlsymdefattachType type; /*-------------------------------------------------------------*\ Check data \*-------------------------------------------------------------*/ if((fp==NULL)||(symdata==NULL)) return(PRO_TK_BAD_INPUTS); error = ProDtlsymdefdataAttachGet(symdata, &attaches); TEST_CALL_REPORT ("ProDtlsymdefdataAttachGet()", "ProTestSymDefInfoAttach()", error, error != PRO_TK_NO_ERROR); if(error!=PRO_TK_NO_ERROR) return(-1); /*-------------------------------------------------------------*\ Calculate attaches count \*-------------------------------------------------------------*/ error = ProArraySizeGet((ProArray)attaches, &n_attache); TEST_CALL_REPORT ("ProArraySizeGet()", "ProTestSymDefInfoAttach()", error, error != PRO_TK_NO_ERROR); if(error!=PRO_TK_NO_ERROR) n_attache = 0; fprintf(fp,"\t\tAttaches count:%d\n", n_attache); if(n_attache>0) for(n=0; n0) { fprintf(fp,"\t\t\t\tNote count: %d\n",n_notes); for(k=0; k0) */ /*-------------------------------------------------------------*\ Free notes array \*-------------------------------------------------------------*/ if(notes!=NULL) { error = ProArrayFree((ProArray*)¬es); TEST_CALL_REPORT ("ProArrayFree()", "ProTestSymDefInfo()", error, error != PRO_TK_NO_ERROR); notes = NULL; } return(0); } ProError ProTestSymDefInfo() { ProError error; FILE *fp=NULL; ProPath wstr; ProCharLine astr; char file_name[] = "DrwSymDef.info"; ProDrawing drawing; int i, j; int n_symdef, n_sheets; int entity, line, text; int id; ProDtlsymdef *symdefs; ProDtlsymdefdata symdata; ProBoolean elbow, angle_fixed; double height; ProDtlsymdefdataHeighttype type; int current_sheet; /*-------------------------------------------------------------*\ Get handle to the current drawing \*-------------------------------------------------------------*/ error = ProMdlCurrentGet((ProMdl*)&drawing); TEST_CALL_REPORT ("ProMdlCurrentGet()", "ProTestSymDefInfo()", error, error != PRO_TK_NO_ERROR); if(error!=PRO_TK_NO_ERROR) return(PRO_TK_GENERAL_ERROR); /*-------------------------------------------------------------*\ Open file for print symdef information \*-------------------------------------------------------------*/ if ((fp = fopen(file_name, "w")) == NULL) { printf("Cannot open output file\n"); return (PRO_TK_GENERAL_ERROR); } /*-------------------------------------------------------------*\ Get sheets count in the current drawing \*-------------------------------------------------------------*/ error = ProDrawingSheetsCount(drawing, &n_sheets); TEST_CALL_REPORT ("ProDrawingSheetsCount()", "ProTestSymDefInfo()", error, error != PRO_TK_NO_ERROR); /*-------------------------------------------------------------*\ Store current sheet id \*-------------------------------------------------------------*/ error = ProDrawingCurrentSheetGet( drawing, ¤t_sheet ); TEST_CALL_REPORT ("ProDrawingCurrentSheetGet()", "ProTestSymDefInfo()", error, error != PRO_TK_NO_ERROR); fprintf(fp,"Sheets count: %d\n", n_sheets); for(i=0; i