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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to attach drawing note leader with CSYS visible in drawing view?

jpatel
1-Newbie

How to attach drawing note leader with CSYS visible in drawing view?

Here is the solution....ENJOY

ProError NoteCreate(string strCSYSName,vector<string> vecnotetext,double xoffset,double yoffset,double* NotePosY)
{
ProError status  = PRO_TK_GENERAL_ERROR;

ProDtlnotedata  objNoteData;
status = ProDtlnotedataAlloc (_maindrwmdl, &objNoteData);

ProName pcsysname;
ProStringToWstring(pcsysname,(char*)strCSYSName.c_str());
ProSelection objSelectionObjs;
ProModelitem pmcsys;
status = ProModelitemByNameInit(_mainasmmdl,PRO_CSYS,pcsysname,&pmcsys);

ProIdTable idtbl;
for(int i=0;i<25;i++)
{
  idtbl[i] = -1;
}
ProAsmcomppath asmpath;
ProAsmcomppathInit((ProSolid)_mainasmmdl,idtbl,0,&asmpath);

status = ProSelectionAlloc(&asmpath,&pmcsys,&objSelectionObjs);

status = ProSelectionViewSet(_view,&objSelectionObjs);

ProGeomitemdata *gdata;
status = ProGeomitemdataGet(&pmcsys,&gdata);
status = ProSelectionPoint3dSet(gdata->data.p_csys_data->origin,&objSelectionObjs);

ProVector objLeaderLocationFrmAsm;
status = GetCoordSelection(objSelectionObjs,objLeaderLocationFrmAsm,xoffset,yoffset);

if(strCSYSName!="B_PLATFORM_1")
{
  if(objLeaderLocationFrmAsm[1]-*NotePosY<27)
  {
   objLeaderLocationFrmAsm[1] = objLeaderLocationFrmAsm[1]+(27-(objLeaderLocationFrmAsm[1]-*NotePosY));
  }
}

if(objLeaderLocationFrmAsm[1]>800.0 && *NotePosY<775.0)
{
  objLeaderLocationFrmAsm[1] = 800;
}

*NotePosY = objLeaderLocationFrmAsm[1];

ProDtlattach objDtlAttch;

status = ProDtlattachAlloc(PRO_DTLATTACHTYPE_FREE,_view,objLeaderLocationFrmAsm,NULL,&objDtlAttch);

status =ProDtlnotedataAttachmentSet(objNoteData,objDtlAttch);

ProDtlnoteline* objArrDtlNoteLines;
status = ProTestNoteTextGet (&objArrDtlNoteLines,vecnotetext);

status = ProDtlnoteldataLinesSet (objNoteData, objArrDtlNoteLines);

status = ProArrayFree ((ProArray*)&objArrDtlNoteLines);

ProDtlattach objLeader;
status = ProDtlattachAlloc(PRO_DTLATTACHTYPE_PARAMETRIC, NULL, NULL, objSelectionObjs,&objLeader);

status = ProDtlnotedataLeaderAdd(objNoteData, objLeader);

ProDtlnote objNote;
status = ProDtlnotedataDisplayedSet(objNoteData,PRO_B_TRUE);

status = ProDtlnoteCreate (_maindrwmdl, NULL, objNoteData, &objNote);

status = ProDtlattachFree(objDtlAttch);

status = ProDtlnotedataFree(objNoteData);

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.
0 REPLIES 0
Top Tags