Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
All,
I have written a VB API to place a manufacturing UDF into a manufacturing assembly. With this particular UDF, once all the placement options are set, it prompts for a regen type. I am fine with the regen it defaults to, but it seems silly for the user to have to click "Done" during the program execution. It seems as though this prompt for regen is embedded within the create UDF group method, so additional code to click done for the user has no place to go. Does anyone know how to resolve this?
Thanks,
Corey
I have created a separate thread that will wait a set amount of time and then run a macro to click done. This does not work, however. I believe the problem is that the main form that is placing the udmf keeps the connection busy while waiting for the regen type to be selected, preventing the second thread from accessing the session to click done. I could always set up an actual mapkey to do this, then have the form send the key, but this would require everyone who uses the program to have the same mapkey. Anyone have any other suggestions?
Thanks,
Corey
In Reply to Bjarne Frandsen:
If the programs continue after user click Done I have no solution.
If the user has to click Done when the program has terminated you can use the RunMacro method to execute a mapkey that clicks Done when the program terminates.
/Bjarne
The issue with using RunMacro() brings the same issue as using any other method. The Placement of the manufacturing UDF starts and finishes in the same line of code. After that line of code starts and before it finishes, the user must click done to select the regen type. Without the regen type being an argument to the UDF instructions. This being the case, there is nowhere in the code to put the macro as it will not occur until after the UDF has been placed (after the user clicks done), hence why I was trying to create a separate thread to do this. We have VB applications that use separate programs to simultaneously interact with Pro/E, and we are not sure why this is not working. As a temporary work around, I have the second thread move the mouse cursor to the Pro/E window and clicking the middle mouse button to hit "Done".
In Reply to Bjarne Frandsen:
Multithreading is not supported in J-Link.
By using the RunMacro() method, you supply the mapkey as text inside your program, so the user do not need to have it defined in their config.pro. If the macro has multiple lines, then each line should be added in reverse order as the RunMacro() reads lines from a stack.
/Bjarne
Hi all,
Gentlemen,
Thereused to bean age old technique described in detail in PTC Knowledge Base under 'reentering macro' but I cannot find it anymore.
The jest of it is to reenter your code after the macro execution by making a macro tocall your menu pickafter the macro was done doing whatever you wanted it to do inthe first place.In order to do that your application had to create two menuitems, the first menu itemto call your code,and the second menu itemto becontrolled by access function andto benot available untilyour applicationstarted to run from the first menu item.In the macro, at the end of the run,you would have to include acallfor the second menu item.
The variation of this techiquecould beto create only one menu item and to call itat theendof themacro run, while your application would create some reentry flageither aspersistent memory variable ortemporary file which would indicate which portion(before/after macro) of your code needed to be executed.
Feliks.
In Reply to Corey Van Sickle:
The issue with using RunMacro() brings the same issue as using any other method. The Placement of the manufacturing UDF starts and finishes in the same line of code. After that line of code starts and before it finishes, the user must click done to select the regen type. Without the regen type being an argument to the UDF instructions. This being the case, there is nowhere in the code to put the macro as it will not occur until after the UDF has been placed (after the user clicks done), hence why I was trying to create a separate thread to do this. We have VB applications that use separate programs to simultaneously interact with Pro/E, and we are not sure why this is not working. As a temporary work around, I have the second thread move the mouse cursor to the Pro/E window and clicking the middle mouse button to hit "Done".
In Reply to Bjarne Frandsen:Multithreading is not supported in J-Link.
By using the RunMacro() method, you supply the mapkey as text inside your program, so the user do not need to have it defined in their config.pro. If the macro has multiple lines, then each line should be added in reverse order as the RunMacro() reads lines from a stack.
/Bjarne