Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

write a note to a drawing in Asynchronous

zwj23232

New member
friends,
i want to write a note to a drawing in Asynchronous Mode,but i failed.the code is as follow. but when i use the same code
under synchronous mode, it works well( a note can be written successfully). some body tell me that maybe writting a note
in Asynchronous Mode is imporssible, i dont know whether it is true.if anybody get an idea,please reply ,thanks!


ProError i =ProDrawingCurrentSheetGet ((ProDrawing)model,&sheet);/////
ProError i01 =ProDrawingOverlayviewGet ((ProDrawing)model, sheet, &view1);///////////////////////?
ProDtlnotetextAlloc(&text);
ProDtlnotetextHeightSet(text, -1.0);
ProDtlnotetextWidthSet(text, -1.0);
ProDtlnotetextSlantSet(text, 0.0);
ProDtlnotetextThicknessSet(text, 0.0);


ProStringToWstring(font, "font");
ProDtlnotetextFontSet(text, font);


ProLine wstr;
ProCharLine str="itisanote";
ProStringToWstring(wstr, str);
ProDtlnotetextStringSet(text, wstr);


ProDtlnotelineAlloc(&line);
ProDtlnotelineTextAdd(line, text);
ProDtlnotetextFree (text);
ProDtlnotedataAlloc((ProDrawing)model, &note_data);
ProDtlnotedataLineAdd(note_data, line);


ProError i6 =ProDtlattachAlloc(PRO_DTLATTACHTYPE_FREE, view1, location, NULL, &new_attach);
ProError i5 =ProDtlnotedataAttachmentSet(note_data, new_attach);


ProError i11 =ProDtlnoteCreate ((ProDrawing)model, NULL, note_data, &new_note);
/////////// i have tested that the code above can be executed successfully.
ProError i12 =ProDtlnoteShow(&new_note);// the error occurs at this sentence,the error message is PRO_TK_GENERAL_ERROR.
if( i12 != PRO_TK_NO_ERROR )
{
CString s;
s.Format("noteShow Error :%d",i12);
AfxMessageBox(s);
}
else
{
AfxMessageBox("noteDraw");
}
 

Sponsor

Back
Top