Hi everyone,
I’m coding a new task add-in
I want to run task add-in on multiple files or multiple selections at right-click menu-item or during state transition.
But Add-in works only first selection file.
how can i get list of all selections.
Hi everyone,
I’m coding a new task add-in
I want to run task add-in on multiple files or multiple selections at right-click menu-item or during state transition.
But Add-in works only first selection file.
how can i get list of all selections.
I have a switch case in the OnCmd()
// Entry point for the add-in, any of the .AddHook(EdmCmdType) type events will
// come through this handler.
// public void OnCmd(ref EdmCmd poCmd, ref System.Array ppoData)
public void OnCmd(ref EdmCmd poCmd, ref EdmCmdData[] ppoData)
.....
case EdmCmdType.EdmCmd_TaskRun:
OnTaskRun(ref poCmd, ref ppoData);
break;
.....
And then in the OnTaskRun method I iterate through the array of ppoData objects
foreach (EdmCmdData cmdData in ppoData)
{
int objID = cmdData.mlObjectID1;
int ParentFolderID = cmdData.mlObjectID2;
string StrSourcePath = cmdData.mbsStrData1;
string configName = cmdData.mbsStrData2;
int edmObjTyp = cmdData.mlLongData1;
if (edmObjTyp != (int)EdmObjectType.EdmObject_File)
{
throw new Exception("EdmObjectType not File");
}
//Do whatever you need to du utilizing the data in the cmdData object.
....
That seems to be working fine for me.
Edit: helpful help page:
https://help.solidworks.com/2019/english/api/epdmapi/epdm.interop.epdm~epdm.interop.epdm.edmcmddata.html
Thank you @AmenJlili , I was trying to find the other stuff that is needed to make that work but it’s been so long ago that I forgot and couldn’t find it.
I have a super framework for PDM task. Will be sharing it soon.
@bnemec Thank you very much.
You are welcome. Thanks for marking your thread solved.