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

Creo crash while activating push button

SOLVED
Highlighted
Level 8

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

 

 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Creo crash while activating push button

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);

}

5 REPLIES 5

Re: Creo crash while activating push button

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

Re: Creo crash while activating push button

@Ketan_Lalcheta if possible kindly share few examples.

 

Thanks in advance,

Manjunath S

Re: Creo crash while activating push button

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.

Re: Creo crash while activating push button

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);
}

Re: Creo crash while activating push button

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);

}