cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

adding a symbol into drawing

Sekar1
13-Aquamarine

adding a symbol into drawing

Hi,

 

I could not get any toolkit api to add an image into drawing. So I am trying to add a symbol instead of drawing.

Is there any toolkit api to do this ?

will ProSymbolDesignate() help ?

 

Thanks

 

 

 

1 REPLY 1

First you need to retrieve the symbol

ProDrawingDtlsymdefRetrieve((ProDrawing) mdl, sympath, symname_xml, PRO_VALUE_UNUSED, PRO_B_TRUE, &symdef);

and after the retrivement has no errors you can place it.

ProDtlsyminstdata sdata;
ProDtlattach attach;
ProDtlsyminst syminst;

writeRunnerLog_d(L"Symbol is retrieved", 0, 1);
/*--------------------------------------------------------------------*\ 
Allocate the symbol instance decription 
\*--------------------------------------------------------------------*/
if (ProDtlsyminstdataAlloc((ProDrawing) mdl, &sdata) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 1", 2);

/*--------------------------------------------------------------------*\ 
Set the definition this is an instance of 
\*--------------------------------------------------------------------*/     
if (ProDtlsyminstdataDefSet(sdata, &symdef) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 2", 2);

if (ProDtlsyminstdataGroupoptionsSet(sdata, PRO_DTLSYMINST_GROUP_ALL, NULL) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 3", 2);

if (ProDtlsyminstdataAttachtypeSet(sdata, PROSYMDEFATTACHTYPE_FREE) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 4", 2);
if (ProDtlattachAlloc(PRO_DTLATTACHTYPE_FREE, NULL, point, NULL, &attach) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 5", 2);
if (ProDtlsyminstdataAttachmentSet(sdata, attach) != PRO_TK_NO_ERROR) writeRunnerLog(L"SourceCode - add Symbol failure 6", 2);

ProDtlattachFree(attach);

/*--------------------------------------------------------------------*\ 
Create the symbol and free the description 
\*--------------------------------------------------------------------*/     
err = ProDtlsyminstCreate((ProDrawing) mdl, sdata, &syminst);

ProDtlsyminstdataFree(sdata);

if (err == PRO_TK_NO_ERROR) {
	int winid;
	/*--------------------------------------------------------------------*\ 
	Display the symbol 
	\*--------------------------------------------------------------------*/

	ProDtlsyminstShow(&syminst);
	writeRunnerLog_d(L"Symbol instance is created and displayed", 0, 1);
	/*--------------------------------------------------------------------*\ 
	Redraw the Drawing tree
	\*--------------------------------------------------------------------*/
	ProMdlWindowGet(mdl, &winid);
	ProDrawingtreeRefresh((ProDrawing)mdl, winid);
} else {
	 writeRunnerLog(L"Symbol can't be displayed", 2);
}
ProWindowRepaint(PRO_VALUE_UNUSED);

 

If the symboldefinition is already inside the Drawing it would be updated by retrieve symbol definition. If you don't want this behaivior or want to place self drawn you can use ProDrawingDtlsymdefsCollect and search for the definition you want to use.

 

Br,

Eike

Announcements


Top Tags