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

Creo toolkit java -create a selection table for sketch entities

DarrellSong
Participant

Creo toolkit java -create a selection table for sketch entities

I'm trying to create a command to select all entities in sketch mode using toolkit java. 

This is similar as selecting all entities then double-clicking the selected items bin(double clicked "14 selected") under the status bar.

selection bar.PNG

 

 

selection bin.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

methed1: tried to run the macro cammand from API. it did bring up the selected bin dialog. The problem is that it won't stay. It closes immediately. So is there command to let the dialog box to wait for user input?

 

public void OnCommand() throws jxthrowable{

try{
    currentSession = (WSession) pfcSession.GetCurrentSession();
    currentSession.RunMacro("~ Open `main_dlg_cur` `Sst_bar.filter_list`;");
    currentSession.RunMacro("~ Select `main_dlg_cur` `Sst_bar.filter_list` 1 `3`;");
    currentSession.RunMacro("~ Command `ProCmdEditAll`;");
    currentSession.RunMacro("~ LButtonDblClk `main_dlg_cur` `Sst_bar.n_sels_show_bin` 0 ``;");
}catch(jxthrowable w){
    w.printStackTrace();
}
}

 

method 2: tired to create a dialog resouse using UI editor. And add all the selections into the table.

The problem is that I can't retireve the correct entitiy name from selection buffer. Try to use GetSelItem() or GetSelModel() then GetName() , return is empty. Anyone can help?

selection table.PNG

 

 

 

 

 

 

 

 

 

try {
    selTable = uifcTable.TableFind(Selconstr.OTK_dialog, Selconstr.OTK_Table);
    for (int i=0; i< curselitems.getarraysize(); i++)
    {
        try {
            selname= curselitems.get(i).toString();
           TableRow row = uifcTable.TableRowDefine(selname);
           RowPositionData rowPos = uifcCore.RowPositionData_Create();
           rowPos.SetIndex(i);
           selTable.InsertRow(row, rowPos);

           TableCell selCell =uifcTable.TableCellFind(selTable.GetDialog(), selTable.GetComponent(), selname,"Item");
           selCell.SetText(selname);
           TableCell noCell =uifcTable.TableCellFind(selTable.GetDialog(), selTable.GetComponent(), selname,"No.");
           noCell.SetText(String.valueOf(i+1));
}catch (jxthrowable e) {
e.printStackTrace();
}
}
}catch (jxthrowable e) {
e.printStackTrace();
}

Announcements