Hello,
I am getting PRO_TK_CANT_ACCESS error for ProSelbufferSelectionAdd function.
I am trying to open a dxf file, collect Dtlentities and select few using ProSelbufferSelectionAdd.
Following is the code, I am trying to use (I have modified it to select first Dtlentity).
ProError status = PRO_TK_NO_ERROR;
ProMdl model;
ProPath dxf_path;
ProName dxf_name;
ProSelection sel;
ProDtlentity *ent_arr = NULL;
int iSize;
// Prompt user to open a dxf file
status = ProFileOpen(NULL, L"*.dxf", NULL, NULL, NULL, NULL, dxf_path);
status = ProFilenameParse(dxf_path, NULL, dxf_name, NULL, NULL);
// Create a new 2d Pro/ENGINEER model using dxf file
status = Pro2dImportCreate(PRO_DXF_FILE, dxf_path, dxf_name, PRO_MDL_DRAWING,
PRO_B_FALSE, PRO_B_FALSE, PRO_B_TRUE, &model);
// Collect drawing entities
status = ProDrawingDtlentitiesCollect((ProDrawing)model, NULL, PRO_VALUE_UNUSED, &ent_arr);
// Check size of drawing entity array
status = ProArraySizeGet((ProArray)ent_arr, &iSize);
if(status == PRO_TK_NO_ERROR && iSize > 0)
{
// Try to select first drawing entity
status = ProSelectionAlloc(NULL, &ent_arr[0], &sel);
status = ProSelbufferSelectionAdd(sel); // PRO_TK_CANT_ACCESS is returned here
status = ProArrayFree ((ProArray*)&ent_arr);
}
Any suggestions/ comments are appreciated.
Thanks,
Regards,
Amar Junankar
Imagecom, Inc.
www.aspire3d.com
Hello all,
Amar,
I would try to use ProObjectwindowCreate, ProWindowCurrentSet and ProWindowActivate after Pro2dImportCreate.
HIH.
Feliks.
In Reply to Amar Junankar:
Hello,
I am getting PRO_TK_CANT_ACCESS error for ProSelbufferSelectionAdd function.
I am trying to open a dxf file, collect Dtlentities and select few using ProSelbufferSelectionAdd.
Following is the code, I am trying to use (I have modified it to select first Dtlentity).
ProError status = PRO_TK_NO_ERROR;
ProMdl model;
ProPath dxf_path;
ProName dxf_name;
ProSelection sel;
ProDtlentity *ent_arr = NULL;
int iSize;
// Prompt user to open a dxf file
status = ProFileOpen(NULL, L"*.dxf", NULL, NULL, NULL, NULL, dxf_path);
status = ProFilenameParse(dxf_path, NULL, dxf_name, NULL, NULL);
// Create a new 2d Pro/ENGINEER model using dxf file
status = Pro2dImportCreate(PRO_DXF_FILE, dxf_path, dxf_name, PRO_MDL_DRAWING,
PRO_B_FALSE, PRO_B_FALSE, PRO_B_TRUE, &model);
// Collect drawing entities
status = ProDrawingDtlentitiesCollect((ProDrawing)model, NULL, PRO_VALUE_UNUSED, &ent_arr);
// Check size of drawing entity array
status = ProArraySizeGet((ProArray)ent_arr, &iSize);
if(status == PRO_TK_NO_ERROR && iSize > 0)
{
// Try to select first drawing entity
status = ProSelectionAlloc(NULL, &ent_arr[0], &sel);
status = ProSelbufferSelectionAdd(sel); // PRO_TK_CANT_ACCESS is returned here
status = ProArrayFree ((ProArray*)&ent_arr);
}
Help documentation mentions "PRO_TK_CANT_ACCESS - There is no Object/Action selection tool active."
Other thing I have observed is that after executing code mentioned above, if control is returned to Pro/E and again ProSelbufferSelectionAdd is used, then it executes without any error and entity can be seen selected in drawing.Any suggestions/ comments are appreciated.
Thanks,Regards,
Amar Junankar
Imagecom, Inc.
www.aspire3d.com
Hello Feliks,
Thanks for your suggestion.
I tried using ProObjectwindowCreate, ProWindowCurrentSet and ProWindowActivate after Pro2dImportCreate (also tried creating window first, then retrieve model and display it).
However, ProSelbufferSelectionAdd still throws PRO_TK_CANT_ACCESS error.
I am thinking somehow ProE Object/Action selection tool doesn't become active for new model till control is passed to ProE. Once control is passed to ProE, then ProSelbufferSelectionAdd works fine.
Thank you again for your reply.
Regards,
Amar Junankar
Imagecom, Inc.