I have a workspace with 142 IMInspect Projects in it. 120 of Part #1, 8 of Part #2 and 14 of Part #3. I want to open each project and export the scan data as a PSL to the current workspace. I have the macro to export and name the scan data in an external location.
The macro I have for the WM works great but I want it to do the first 120 then stop, then I want to launch a different external macro for the next 8 and yet another for the final 14. I can't figure out the correct way to make it run then stop after a certain number of iterations.
I hope someone can help.
Here is the macro I am launching from the WorkspaceManager:
version "4.0"
MACRO END_ON_ERROR
DECLARE Mod_ID
Declare nb_items
DECLARE macro_path "C:\PolyWorks\Macro\Export.macro"
DECLARE i
set i 1
TREEVIEW IMINSPECT_PROJECT GET_NB (nb_items)
while $i <= $nb_items
TREEVIEW IMINSPECT_PROJECT SELECT NONE
TREEVIEW IMINSPECT_PROJECT SELECT RANGE ($i, $i, "On")
MODULE IMINSPECT START USING_OBJECTS ( , , Mod_ID, "On", )
MACRO EXEC REMOTE_SCRIPT ( "$macro_path", $Mod_ID, )
MODULE CLOSE ( "$Mod_ID", "On", "On")
++ i
endwhile
Here would be my first try:
Quoteversion "4.0"
MACRO END_ON_ERROR
DECLARE Mod_ID
Declare nb_items
DECLARE macro_path_A "C:\PolyWorks\Macro\ExportA.macro"
DECLARE macro_path_B "C:\PolyWorks\Macro\ExportB.macro"
DECLARE macro_path_C "C:\PolyWorks\Macro\ExportC.macro"
DECLARE nb_A
DECLARE nb_B
DECLARE nb_C
DECLARE i
DECLARE n 1
set i 1
TREEVIEW IMINSPECT_PROJECT GET_NB (nb_items)
INPUT INTEGER (nb_A, "Number of Part A", "Enter then number of parts of A", 1)
INPUT INTEGER (nb_B, "Number of Part B", "Enter then number of parts of B", 1)
INPUT INTEGER (nb_C, "Number of Part C", "Enter then number of parts of C", 1)
while $i <= $nb_A
TREEVIEW IMINSPECT_PROJECT SELECT NONE
TREEVIEW IMINSPECT_PROJECT SELECT RANGE ($n, $n, "On")
MODULE IMINSPECT START USING_OBJECTS ( , , Mod_ID, "On", )
MACRO EXEC REMOTE_SCRIPT ( "$macro_path_A", $Mod_ID, )
MODULE CLOSE ( "$Mod_ID", "On", "On")
++ i
++ n
endwhile
set i 1
while $i <= $nb_B
TREEVIEW IMINSPECT_PROJECT SELECT NONE
TREEVIEW IMINSPECT_PROJECT SELECT RANGE ($n, $n, "On")
MODULE IMINSPECT START USING_OBJECTS ( , , Mod_ID, "On", )
MACRO EXEC REMOTE_SCRIPT ( "$macro_path_B", $Mod_ID, )
MODULE CLOSE ( "$Mod_ID", "On", "On")
++ i
++ n
endwhile
set i 1
while $i <= $nb_C
TREEVIEW IMINSPECT_PROJECT SELECT NONE
TREEVIEW IMINSPECT_PROJECT SELECT RANGE ($n, $n, "On")
MODULE IMINSPECT START USING_OBJECTS ( , , Mod_ID, "On", )
MACRO EXEC REMOTE_SCRIPT ( "$macro_path_C", $Mod_ID, )
MODULE CLOSE ( "$Mod_ID", "On", "On")
++ i
++ n
endwhile
Let me know how it works...
It worked great! It is running as I'm typing this.
I was planning on 3 different macros so this all-in-one soluton saved me 2 clicks :D
I went ahead and did away with the integer user input. Just because, for now, this is a one time use macro and I know how many of each part there are.
Thanks again
Admin, you rock! Awesome macro.