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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

How to get part/assembly name from custom Symbol instant. I want part name when I delete symbol using ProDtlsyminstDelete(ProDtlsyminst *symInst). Is there any API or Work around to retrieve part name?

ndaslaniya
1-Newbie

How to get part/assembly name from custom Symbol instant. I want part name when I delete symbol using ProDtlsyminstDelete(ProDtlsyminst *symInst). Is there any API or Work around to retrieve part name?

How to get part/assembly name from custom Symbol instant. I want part name when I delete symbol using ProDtlsyminstDelete(ProDtlsyminst *symInst). Is there any API or Work around to retrieve part name?

ProError DeleteBalloon(string strTempItemNo)

{

ProError status = PRO_TK_NO_ERROR;

int nSheets;

status = ProDrawingSheetsCount((ProDrawing)gblObjCurMdl,&nSheets);

for(int i=0; i< nSheets; i++)

{

ProDtlsyminst *symInsts;

status = ProDrawingDtlsyminstsCollect((ProDrawing)gblObjCurMdl, i, &symInsts);

int totalSyms;

status = ProArraySizeGet(symInsts, &totalSyms);

for(int j=0; j< totalSyms; j++)

{

ProDtlsyminstdata dtlSymInstData;

status = ProDtlsyminstDataGet(&symInsts[j], PRODISPMODE_SYMBOLIC, &dtlSymInstData);

ProDtlvartext *p_vartexts;

ProLine w_prompt, w_value;

int size = 0, text_size = 0, k;

status = ProDtlsyminstdataVartextsCollect (dtlSymInstData, &p_vartexts);

if (status == PRO_TK_NO_ERROR)

{

status = ProArraySizeGet ((ProArray)p_vartexts, &text_size);

for (k = 0; k < text_size; k++)

{

status = ProDtlvartextDataGet (p_vartexts[k], w_prompt, w_value);

char chrTagName[1000];

ProWstringToString(chrTagName, w_prompt);

if (strcmpi(chrTagName, "index")==0)

{

//Index Drawing Balloon Data

char chrIndexNo[1000];

ProWstringToString(chrIndexNo, w_value);

if (strcmpi((char *)strTempItemNo.c_str(), chrIndexNo)==0)

{

status = ProDtlsyminstDelete(symInsts);

//Here I want part/Assembly name from "symInsts".

//Please provide any api or work around.

break;

}

}

}

}

}

}

ProMdl curMdl;

int curSheet = 0;

status = ProMdlCurrentGet(&curMdl);

status = ProDrawingCurrentSheetGet((ProDrawing)curMdl, &curSheet);

status = ProDwgSheetRegenerate((ProDrawing)curMdl, curSheet);

return status;

}


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
1 ACCEPTED SOLUTION

Accepted Solutions

Read the API Wizard for ProDtlattachGet.  You need to analyze the attachment type before unpacking the ProSelection object.  It may not be populated based upon the type.

View solution in original post

6 REPLIES 6

You can retrieve this information by getting the symbol instance attachments.  Use the following functions:

1. ProDtlsyminstDataGet

2. ProDtlsyminstdataAttachmentGet

3. ProDtlattachGet

Then you can retrieve the model item from the ProSelection object.

Hi Patrick Williams

Thanks for your response.

But I am getting -2 Error in ProSelectionModelitemGet.

Here I attached Sample code for the same.

ProDtlsyminstdata symInstData;

proErr = ProDtlsyminstDataGet(symInst, PRODISPMODE_SYMBOLIC, &symInstData);

ProDtlattach attachment;

      

proErr = ProDtlsyminstdataAttachmentGet (symInstData,&attachment);

 

ProDtlattachType type;

ProView view;

ProVector location;

ProSelection attach_point;

proErr = ProDtlattachGet (attachment, &type, &view, location, &attach_point);

ProModelitem p_mdl_item;

proErr = ProSelectionModelitemGet (attach_point, &p_mdl_item); //Here I am getting – 2 Error.

ProName objmdlName;

proErr = ProModelitemNameGet(&p_mdl_item,objmdlName);

Can you help for correct result.

Thanks in advanced.

Read the API Wizard for ProDtlattachGet.  You need to analyze the attachment type before unpacking the ProSelection object.  It may not be populated based upon the type.

Thanks for your support

Hi,

You could try ProDtlsyminstFeatureGet() to get related feature and then ProFeatureSolidGet()

Thanks for your support

Top Tags