home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / demo / wgelectr / cameval / cam31 / misc.z / OPT_APR.SCR < prev    next >
Text File  |  1995-07-20  |  3KB  |  179 lines

  1. ;
  2. ; Aperture table optimization and compression script
  3. ; Written by: Jeff Miller
  4. ; Date: 7/13/95
  5. ; Ver: 2.1
  6. ;
  7. view_statbar@
  8. view_toolbar@
  9. ;view_groffon@
  10. layer_alloff@ 0
  11. update_layerbar@
  12.  
  13. if padstacks! = 1 then goto 900
  14.  
  15. ok_cancel "Would you like to clear un-used Dcodes?", clr_ok
  16. if clr_ok = 1 then goto 5
  17. if clr_ok = 0 then goto 6
  18.  
  19. 5
  20. print_msg "Clearing un-used Dcodes   --   Please wait..."
  21. gosub 20
  22. 6
  23.  
  24. ok_cancel "Would you like to check for duplicate apertures?", dup_ok
  25. if dup_ok = 1 then goto 7
  26. if dup_ok = 0 then goto 8
  27.  
  28. 7
  29. print_msg "Optimizing duplicate apertures   --   Please wait..."
  30. gosub 100
  31.  
  32. 8
  33. ok_cancel "Would you like to compress the aperture table?", com_ok
  34. if com_ok = 1 then goto 9
  35. if com_ok = 0 then goto 10
  36.  
  37. 9
  38. print_msg "Compressing aperture table   --   Please wait..."
  39. gosub 300
  40. update_dcodebar@
  41.  
  42. 10
  43. view_statbar@
  44. view_toolbar@
  45. ;view_groffon@
  46. print "Optimization complete"
  47. end
  48.  
  49. ;
  50. ; Check for un-used Dcodes.
  51. ;
  52. 20
  53. for j = 10 to highestdcode!
  54.     setdcode@ j
  55.     if numflashes! = 0 then goto 21
  56.     goto 25
  57. 21      if numdraws! = 0 then gosub 700
  58. 25 next
  59. return
  60.  
  61. ;
  62. ;Setup Dcode to check against
  63. ;
  64. 100
  65. for a = 10 to highestdcode!
  66.     setdcode@ a
  67.     dcode_a = a
  68.     shape_a = dcodeshape!
  69.     sizex_a = dcodesizex!
  70.     sizey_a = dcodesizey!
  71.     name_a$ = dcodename!
  72.     if shape_a = 0 then goto 101
  73.     gosub 200
  74. 101 next
  75. return
  76.  
  77. ;
  78. ; Check for duplicates
  79. ;
  80. 200
  81. for b = dcode_a+1 to highestdcode!
  82.     setdcode@ b
  83.     dcode_b = b
  84.     shape_b = dcodeshape!
  85.     sizex_b = dcodesizex!
  86.     sizey_b = dcodesizey!
  87.     name_b$ = dcodename!
  88.     if shape_b = 0 then goto 203
  89.     if shape_b = 6 then goto 250
  90.     if shape_b = shape_a then goto 201 
  91.     goto 203
  92. 201     if sizex_b = sizex_a then goto 202 
  93.     goto 203
  94. 202     if sizey_b = sizey_a then gosub 500
  95.     goto 203
  96. 250     if name_a$ = name_b$ then gosub 500
  97. 203 next
  98. return
  99.  
  100. ;
  101. ; Check for holes in aperture table
  102. ;
  103. 300
  104. for c = 10 to highestdcode!
  105.     setdcode@ c
  106.     dcode_c = c
  107.     if dcodeshape! = 0 then gosub 400
  108. next
  109. return
  110.  
  111. ;
  112. ; Check for apertures that can be moved to fill holes
  113. ;
  114. 400
  115. done = 0
  116. for d = dcode_c+1 to highestdcode!
  117.     if done = 1 then goto 401
  118.     setdcode@ d
  119.     dcode_d = d
  120.     shape_d = dcodeshape!
  121.     sizex_d = dcodesizex!
  122.     sizey_d = dcodesizey!
  123.     name_d$ = dcodename!
  124.     if shape_d = 0 then goto 401 
  125.     gosub 600
  126.     done = 1
  127. 401 next
  128. return
  129.  
  130. ;
  131. ;Transcode subroutine for optimization
  132. ;
  133. 500
  134. filter$ = dcode_b
  135. change_dcode@
  136. setbydcode@ filter$
  137. edit_group@
  138. axy@ dbminx!,dbminy!
  139. axy@ dbmaxx!,dbmaxy!
  140. back@
  141. edit_chgdcode@ dcode_a
  142. back@
  143. edit_aperture@ dcode_b,0,0,0,dcode_b,""
  144. return
  145.  
  146. ;
  147. ;Transcode subroutine for compression
  148. ;
  149. 600
  150. edit_aperture@ dcode_c,shape_d,sizex_d,sizey_d,dcode_c,name_d$
  151. filter$ = dcode_d
  152. change_dcode@
  153. setbydcode@ filter$
  154. edit_group@
  155. axy@ dbminx!,dbminy!
  156. axy@ dbmaxx!,dbmaxy!
  157. back@
  158. edit_chgdcode@ dcode_c
  159. back@
  160. edit_aperture@ dcode_d,0,0,0,dcode_d,"" 
  161. return
  162.  
  163. ;
  164. ; Clear un-used Dcode
  165. ;
  166. 700
  167. edit_aperture@ activedcode!,0,0,0,activedcode!,""
  168. return
  169.  
  170. ;
  171. ; Padstacks detected
  172. ;
  173. 900
  174. print "ERROR - Padstacks detected, macro cannot complete."
  175. view_statbar@
  176. view_toolbar@
  177. view_groffon@
  178. end
  179.