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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Creo crash while activating push button

Manjunath
13-Aquamarine

Creo crash while activating push button

Hi,

I use the ProUIListActivateActionSet() function to execute an action.

Once the process is completed when I activate Cancel button, creo crashes.

Kindly throw some light on this

 

 

ACCEPTED SOLUTION

Accepted Solutions

try this once:

 

void test(char* dialog, char* component, ProAppData data)
{
ProError err;
ProMdl CurMdl;
ProMdlType CurMdlType;
ProSelection *SelDim;
ProDimension Dim, *MdlItm = &Dim;
ProLine DimText;
int SelCount, i;

wchar_t** suffix = NULL;
err = ProArrayAlloc(2, sizeof(wchar_t *), 1, (ProArray *)&suffix);
suffix[0] = L"@D";
suffix[1] = L"Test";

err = ProMdlCurrentGet(&CurMdl);
if (err == PRO_TK_NO_ERROR)
err = ProMdlTypeGet(CurMdl, &CurMdlType);
if ((err == PRO_TK_NO_ERROR) && (CurMdlType == PRO_MDL_DRAWING))
err = ProSelect("dimension", 1, NULL, NULL, NULL, NULL, &SelDim, &SelCount);
if ((err == PRO_TK_NO_ERROR) && (SelCount != 0))
{
err = ProSelectionModelitemGet(SelDim[0], MdlItm);
err = ProDimensionTextWstringsSet(MdlItm, suffix);
}

err = ProArrayFree((ProArray *)&suffix);

}

View solution in original post

5 REPLIES 5

AFIK, check with memory management. Nothing to do with API. Try to allocate memory and free the same after usage.

@Ketan_Lalcheta if possible kindly share few examples.

 

Thanks in advance,

Manjunath S

For example, 

 

char* list is required for an argument to suggested API. You should do it like this

 

char* list = new char[500]///this should also be used dynamically

post usage of this variable, deallocate the same with delete[] list.

 

It's difficult to track memory issue if it is really a issue. Share code if possible to have a look once I get time.

void test(char* dialog, char* component,ProAppData data)
{
ProError err;
ProMdl CurMdl;
ProMdlType CurMdlType;
ProSelection *SelDim;
ProDimension Dim, *MdlItm = &Dim;
ProLine DimText;
int SelCount,i;

err = ProArrayAlloc(2, sizeof(wchar_t *), 1, (ProArray *)&suffix);
suffix[2] = (wchar_t *)calloc(PRO_NAME_SIZE, sizeof(wchar_t));
suffix[0]=L"@D";
suffix[1]=L"Test";

err = ProMdlCurrentGet(&CurMdl);
if (err == PRO_TK_NO_ERROR)
err = ProMdlTypeGet(CurMdl,&CurMdlType);
if ((err == PRO_TK_NO_ERROR) && (CurMdlType == PRO_MDL_DRAWING))
err = ProSelect("dimension",1,NULL,NULL,NULL,NULL,&SelDim,&SelCount);
if ((err == PRO_TK_NO_ERROR) && (SelCount!=0))
{
err = ProSelectionModelitemGet(SelDim[0],MdlItm);
err = ProDimensionTextWstringsSet(MdlItm,suffix);
}
if (err == PRO_TK_NO_ERROR)
err = ProDwgSheetRegenerate((ProDrawing)CurMdl,1);
err = ProArrayFree((ProArray *)&suffix);

}

ProError test()
{
err = ProUIListActivateActionSet(DLG,"myNotes",(ProUIAction)test,NULL);
}

try this once:

 

void test(char* dialog, char* component, ProAppData data)
{
ProError err;
ProMdl CurMdl;
ProMdlType CurMdlType;
ProSelection *SelDim;
ProDimension Dim, *MdlItm = &Dim;
ProLine DimText;
int SelCount, i;

wchar_t** suffix = NULL;
err = ProArrayAlloc(2, sizeof(wchar_t *), 1, (ProArray *)&suffix);
suffix[0] = L"@D";
suffix[1] = L"Test";

err = ProMdlCurrentGet(&CurMdl);
if (err == PRO_TK_NO_ERROR)
err = ProMdlTypeGet(CurMdl, &CurMdlType);
if ((err == PRO_TK_NO_ERROR) && (CurMdlType == PRO_MDL_DRAWING))
err = ProSelect("dimension", 1, NULL, NULL, NULL, NULL, &SelDim, &SelCount);
if ((err == PRO_TK_NO_ERROR) && (SelCount != 0))
{
err = ProSelectionModelitemGet(SelDim[0], MdlItm);
err = ProDimensionTextWstringsSet(MdlItm, suffix);
}

err = ProArrayFree((ProArray *)&suffix);

}

Announcements


Top Tags