(author: Chris P, Lcvette) (version: 0.1) (date: 02/8/25) (This sub will write user parameters to the var file and ui widgets) (Determine ATC Rack Position, Pocket Order, and Clearance Direction) (Requires Pockets to be aligned parallel with X or Y Axis Travels) o sub # = #1 (0) # = #2 (0) # = #3 (0) # = #4 (0) # = #5 (0) # = #6 (0) # = #7 (0) # = #8 (0) # = #9 (0) # = #10 (0) # = #11 (0) # = #12 (0) # = #13 (0) # = #14 (0) #3974 = # #3975 = # #3976 = # #3977 = # #3978 = # #3980 = # #3981 = # #3982 = # #3983 = # #3984 = # #3985 = # #3986 = # #3987 = # #3988 = # (Initialize ALL variables first) #3979 = 0 # = 0 # = 0 # = 0 # = 0 (Pull ini pocket count and write to ui) o100 if [EXISTS[#<_ini[atc]pockets>]] # = #<_ini[atc]pockets> #3973 = # (DEBUG, EVAL[vcp.getWidget{"rack_pocket_count"}.setValue{#3973}]) o100 endif (Check for duplicate pocket positions) o110 if [# EQ #] o111 if [# EQ #] (PRINT, "Error: Duplicate pocket positions detected!") #3979 = 0 (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o return o111 endif o110 endif (Check if row is parallel to the Y-axis) o120 if [# EQ #] (PRINT, "Row is parallel to Y-axis") (Determine pocket order) o121 if [# GT #] # = 1 (-Y to +Y) o121 else # = 2 (+Y to -Y) o121 endif (Determine clearance direction - MUST be in X) o122 if [# GT #] # = 1 (+X) o122 elseif [# LT #] # = 2 (-X) o122 else (PRINT, "Error: Clearance direction must be perpendicular to pocket row!") #3979 = 0 (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o return o122 endif (Assign rack_id - break down calculation steps) # = [# - 1] # = [# * 2] # = [# + #] # = # #3979 = # (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o return o120 endif (Check if row is parallel to the X-axis) o130 if [# EQ #] (PRINT, "Row is parallel to X-axis") (Determine pocket order) o131 if [# GT #] # = 1 (-X to +X) o131 else # = 2 (+X to -X) o131 endif (Determine clearance direction - MUST be in Y) o132 if [# GT #] # = 1 (+Y) o132 elseif [# LT #] # = 2 (-Y) o132 else (PRINT, "Error: Clearance direction must be perpendicular to pocket row!") #3979 = 0 (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o return o132 endif (Assign rack_id - break down calculation steps) # = [# - 1] # = [# * 2] # = [# + #] # = [# + 4] # = # #3979 = # (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o return o130 endif (MSG, "Error: No Conditions Met, Rack ID Not Set") #3979 = 0 (DEBUG, EVAL[vcp.getWidget{"atc_rack_id"}.setValue{#3979}]) o endsub M2