Hi,
I am trying to change the text properites in the Drawing Table text which created by the program,I checked the error return by the API's it is wokring fine, i could not able to see why the changes not been apply to the text, here is the code,let me know where it is wrong.
#include <ProToolkit.h>
#include <ProDtlitem.h>
#include <ProDtlentity.h>
#include <ProDwgtable.h>
#include <malloc.h>
int user_initialize()
{
ProError err;
FILE *fp;
ProMdl mdl_drg;
ProDwgtabledata tabl_data;
double col_width,row_width;
int n_rows,n_cols;
ProHorzJust hor_jst;
ProPoint3d origin;
ProDwgtable table;
ProDtlnotedata notedata;
ProDtlnoteline *note_lines;
ProDtlnotetext *note_text;
double note_height,note_width;
ProName name=L"filled";
ProCharName name_font;
ProName font_name;
ProDtlnote note;
ProWstring *lines;
char *text="DRAWING TEXT";
ProLine string;
ProCharLine string_text;
ProBoolean note_displayed;
hor_jst = PROHORZJUST_CENTER;
n_cols =1;
n_rows =1;
col_width=92.00;
row_width=14.00;
origin[0]=849.868940; //682.590168;
origin[1]= 111.450970; //466.897233;
origin[2]=0.00;
fp=fopen("test.txt","w+");
ProArrayAlloc(1, sizeof(ProWstring), 1, (ProArray*)&lines);
lines[0] = (wchar_t*)calloc(strlen(text) + 1, sizeof(wchar_t));
ProStringToWstring(lines[0], text);
err = ProMdlCurrentGet(&mdl_drg);
fprintf(fp,"ProMdlCurrentGet:%d\n",err);
err = ProDwgtabledataAlloc(&tabl_data);
fprintf(fp,"ProDwgtabledataAlloc:%d\n",err);
err = ProDwgtabledataColumnsSet(tabl_data,n_cols,&col_width,&a mp;hor_jst);
fprintf(fp,"ProDwgtabledataColumnsSet:%d\n",err);
err = ProDwgtabledataRowsSet(tabl_data,n_rows,&row_width);
fprintf(fp,"ProDwgtabledataRowsSet:%d\n",err);
err = ProDwgtabledataOriginSet(tabl_data,origin);
fprintf(fp,"ProDwgtabledataOriginSet:%d\n",err);
err = ProDwgtabledataSizetypeSet(tabl_data,PRODWGTABLESIZE_SCREEN) ;
fprintf(fp,"ProDwgtabledataSizetypeSet:%d\n",err);
err = ProDrawingTableCreate(mdl_drg,tabl_data,PRO_B_FALSE,&tab le);
fprintf(fp,"ProDrawingTableCreate:%d\n",err);
err = ProDwgtableTextEnter(&table,n_cols,n_rows,lines);
fprintf(fp,"ProDwgtableTextEnter:%d\n",err);
err = ProDwgtableCellNoteGet(&table,n_cols,n_rows,¬e);
fprintf(fp,"ProDwgtableCellNoteGet:%d\n",err);
err = ProDtlnoteDataGet(¬e,NULL,PRODISPMODE_NUMERIC,&no tedata);
fprintf(fp,"ProDtlnoteDataGet:%d\n",err);& nbsp; // PRODISPMODE_SYMBOLIC
err = ProDtlnotedataIsDisplayed(notedata,¬e_displayed);
fprintf(fp,"ProDtlnotedataIsDisplayed:%d\n",err);
fprintf(fp,"Note-Displayed:%d\n",note_displayed);
err = ProDtlnotedataLinesCollect(notedata,¬e_lines);
fprintf(fp,"ProDtlnotedataLinesCollect:%d\n",err);
err = ProDtlnotelineTextsCollect(note_lines[0],¬e_text);
fprintf(fp,"ProDtlnotelineTextsCollect:%d\n",err);
err = ProDtlnotetextHeightGet(note_text[0],¬e_height);
fprintf(fp,"ProDtlnotetextHeightGet:%d\n",err);
fprintf(fp,"Notetext Height:%f\n",note_height);
err = ProDtlnotetextWidthGet(note_text[0],¬e_width);
fprintf(fp,"ProDtlnotetextWidthGet:%d\n",err);
fprintf(fp,"Notetext Width:%f\n",note_width);
err = ProDtlnotetextFontGet(note_text[0],font_name);
fprintf(fp,"ProDtlnotetextFontGet:%d\n",err);
ProWstringToString(name_font,font_name);
fprintf(fp,"Current Font:%s\n",name_font);
err = ProDtlnotetextStringGet(note_text[0],string);
fprintf(fp,"ProDtlnotetextStringGet:%d\n",err);
ProWstringToString(string_text,string);
fprintf(fp,"Current Text:%s\n",string_text);
err = ProDtlnotedataJustifSet(notedata,PRO_HORZJUST_CENTER,PRO_VER TJUST_BOTTOM);
fprintf(fp,"ProDtlnotedataJustifSet:%d\n",err);
err = ProDtlnotetextFontSet(note_text[0],name);
fprintf(fp,"ProDtlnotetextFontSet:%d\n",err);
err = ProDtlnotetextStringSet(note_text[0],L"Sample");
fprintf(fp,"ProDtlnotetextStringSet:%d\n",err);
err = ProDwgtableDisplay(&table);
fprintf(fp,"ProDwgtableDisplay:%d\n",err);
err = ProDrawingTablesUpdate(mdl_drg);
fprintf(fp,"ProDrawingTablesUpdate:%d\n",err);
ProArrayFree((ProArray*)&lines);
ProArrayFree((ProArray*)¬e_lines);
ProArrayFree((ProArray*)¬e_text);
return(0);
}
void user_terminate()
{
}
With regards,
Kishore V
I am trying to change the text properites in the Drawing Table text which created by the program,I checked the error return by the API's it is wokring fine, i could not able to see why the changes not been apply to the text, here is the code,let me know where it is wrong.
#include <ProToolkit.h>
#include <ProDtlitem.h>
#include <ProDtlentity.h>
#include <ProDwgtable.h>
#include <malloc.h>
int user_initialize()
{
ProError err;
FILE *fp;
ProMdl mdl_drg;
ProDwgtabledata tabl_data;
double col_width,row_width;
int n_rows,n_cols;
ProHorzJust hor_jst;
ProPoint3d origin;
ProDwgtable table;
ProDtlnotedata notedata;
ProDtlnoteline *note_lines;
ProDtlnotetext *note_text;
double note_height,note_width;
ProName name=L"filled";
ProCharName name_font;
ProName font_name;
ProDtlnote note;
ProWstring *lines;
char *text="DRAWING TEXT";
ProLine string;
ProCharLine string_text;
ProBoolean note_displayed;
hor_jst = PROHORZJUST_CENTER;
n_cols =1;
n_rows =1;
col_width=92.00;
row_width=14.00;
origin[0]=849.868940; //682.590168;
origin[1]= 111.450970; //466.897233;
origin[2]=0.00;
fp=fopen("test.txt","w+");
ProArrayAlloc(1, sizeof(ProWstring), 1, (ProArray*)&lines);
lines[0] = (wchar_t*)calloc(strlen(text) + 1, sizeof(wchar_t));
ProStringToWstring(lines[0], text);
err = ProMdlCurrentGet(&mdl_drg);
fprintf(fp,"ProMdlCurrentGet:%d\n",err);
err = ProDwgtabledataAlloc(&tabl_data);
fprintf(fp,"ProDwgtabledataAlloc:%d\n",err);
err = ProDwgtabledataColumnsSet(tabl_data,n_cols,&col_width,&a mp;hor_jst);
fprintf(fp,"ProDwgtabledataColumnsSet:%d\n",err);
err = ProDwgtabledataRowsSet(tabl_data,n_rows,&row_width);
fprintf(fp,"ProDwgtabledataRowsSet:%d\n",err);
err = ProDwgtabledataOriginSet(tabl_data,origin);
fprintf(fp,"ProDwgtabledataOriginSet:%d\n",err);
err = ProDwgtabledataSizetypeSet(tabl_data,PRODWGTABLESIZE_SCREEN) ;
fprintf(fp,"ProDwgtabledataSizetypeSet:%d\n",err);
err = ProDrawingTableCreate(mdl_drg,tabl_data,PRO_B_FALSE,&tab le);
fprintf(fp,"ProDrawingTableCreate:%d\n",err);
err = ProDwgtableTextEnter(&table,n_cols,n_rows,lines);
fprintf(fp,"ProDwgtableTextEnter:%d\n",err);
err = ProDwgtableCellNoteGet(&table,n_cols,n_rows,¬e);
fprintf(fp,"ProDwgtableCellNoteGet:%d\n",err);
err = ProDtlnoteDataGet(¬e,NULL,PRODISPMODE_NUMERIC,&no tedata);
fprintf(fp,"ProDtlnoteDataGet:%d\n",err);& nbsp; // PRODISPMODE_SYMBOLIC
err = ProDtlnotedataIsDisplayed(notedata,¬e_displayed);
fprintf(fp,"ProDtlnotedataIsDisplayed:%d\n",err);
fprintf(fp,"Note-Displayed:%d\n",note_displayed);
err = ProDtlnotedataLinesCollect(notedata,¬e_lines);
fprintf(fp,"ProDtlnotedataLinesCollect:%d\n",err);
err = ProDtlnotelineTextsCollect(note_lines[0],¬e_text);
fprintf(fp,"ProDtlnotelineTextsCollect:%d\n",err);
err = ProDtlnotetextHeightGet(note_text[0],¬e_height);
fprintf(fp,"ProDtlnotetextHeightGet:%d\n",err);
fprintf(fp,"Notetext Height:%f\n",note_height);
err = ProDtlnotetextWidthGet(note_text[0],¬e_width);
fprintf(fp,"ProDtlnotetextWidthGet:%d\n",err);
fprintf(fp,"Notetext Width:%f\n",note_width);
err = ProDtlnotetextFontGet(note_text[0],font_name);
fprintf(fp,"ProDtlnotetextFontGet:%d\n",err);
ProWstringToString(name_font,font_name);
fprintf(fp,"Current Font:%s\n",name_font);
err = ProDtlnotetextStringGet(note_text[0],string);
fprintf(fp,"ProDtlnotetextStringGet:%d\n",err);
ProWstringToString(string_text,string);
fprintf(fp,"Current Text:%s\n",string_text);
err = ProDtlnotedataJustifSet(notedata,PRO_HORZJUST_CENTER,PRO_VER TJUST_BOTTOM);
fprintf(fp,"ProDtlnotedataJustifSet:%d\n",err);
err = ProDtlnotetextFontSet(note_text[0],name);
fprintf(fp,"ProDtlnotetextFontSet:%d\n",err);
err = ProDtlnotetextStringSet(note_text[0],L"Sample");
fprintf(fp,"ProDtlnotetextStringSet:%d\n",err);
err = ProDwgtableDisplay(&table);
fprintf(fp,"ProDwgtableDisplay:%d\n",err);
err = ProDrawingTablesUpdate(mdl_drg);
fprintf(fp,"ProDrawingTablesUpdate:%d\n",err);
ProArrayFree((ProArray*)&lines);
ProArrayFree((ProArray*)¬e_lines);
ProArrayFree((ProArray*)¬e_text);
return(0);
}
void user_terminate()
{
}
With regards,
Kishore V