pro simon_codedmc, listname, outputname, telescope, nwidth, nlength, $ nwidthref=nwidthref, nlengthref=nlengthref, dontcallreader=dontcallreader common param, x0, y0 ;This procedure generates a .dmc file used to cut masks for SIMON on the ;LAMA machine at CFHT ; ;You need to give the list of x,y (in pixel coordinates on your images) as ;input. ; ;First version: ; Loic Albert ; October 31st 2003 (Halloween!) ;First successfull version: ; December 11th 2003 (First CFHT mission) ;Current version: ; January 20th 2004 (Pass parameters as arguments, plus implement viewer) ; ;HOW TO CALL THIS PROCEDURE ; ;listname: full ascii name with path of the list of input positions (in detector pixels) ; 5 columns: id, x, y, mag, type ; id: not really taken into account anywhere ; x and y: position in pixels on the image (important!) ; mag: not really taken into account anywhere ; type: important! if you want this to be a reference star (one could say a guide star) ; then put 'GS' in this column. Otherwise, you should put any other ascii name such ; as 'normal' or 'star', for example. ;outputname: full ascii name with path of the output dmc file ;telescope: name of the telescope: 'OMM' or 'CFH' ;nwidth: slit width (given in the number of detector pixels, scale_OMM=0.44"/pixel, scale_CFH=0.196"/pixel) ;nlength: slit length (again, in pixels) ;nwidthref: (OPTIONAL ARGUMENT, default=15) slit width in pixels of the reference slits (the ; large slits used to position the mask on bright stars) ;nlengthref: (OPTIONAL ARGUMENT, default=15) slit length in pixels of the reference slits ;dontcallreader: (OPTIONAL ARGUMENT, default=0) if set, this will NOT call the dmc code reader that displays ; a screen of the interpreted dmc code and creates a postscript version. ;STEP -2 ;Read the file containing a list of x,y positions as seen on a ds9 image of SIMON readcol, listname, format='(F,F,F,F,A)',id,x,y,mag,type for i=0, n_elements(id)-1 do begin type[i] = strcompress(type[i],/remove_all) endfor indxy = where(strcmp(type,'GS') eq 0) indref = where(strcmp(type,'GS') ne 0, nindref) if nindref gt 0 then begin xref = x[indref] yref = y[indref] endif x = x[indxy] y = y[indxy] ;STEP -1 ;Define the file to be created, the slit width and length dmcfilename = outputname+'.txt' psfilename = outputname+'.ps' ;Actual pixel scale ;Mesurements on the cold distortion mask (Montreal, November 11th 2003) dx_pixel = 109.291 ;+/- 0.2 pixels ;separation between each pinhole ;A chaud: 109.628 dx_mask = 3.0 ;mm ;separation cut on the mask with LAMA pixelscale = 1000.0 * dx_mask / dx_pixel ;microns on the mask per pixel on the image ;pixelscale = 27.449778 microns/pixel if strcmp(telescope, 'OMM',/fold_case) then mirrordiam = 1.575 ;in meter OMM if strcmp(telescope, 'CFH',/fold_case) then mirrordiam = 3.592 ;in meter CFHT fratio = 8.00000 focalplanescale = 206264.8062 / (fratio * mirrordiam * 1000 * 1000) ;"/um here =0.007.218''/um arcsecscale = 1.0 / focalplanescale ;in microns, 1 arcsec ;nwidth = 4.0 ;number of detector pixels for the slit width, passed as argument width = round(nwidth*pixelscale) ;in microns ;nlength = 20.0 ;number of detector pixels for the slit length, passed as argument length = round(nlength*pixelscale) ;in microns ;Same thing for the slits for reference stars (large slits) if not keyword_set(nwidthref) then begin nwidthref = 15.0 print, 'Width of reference slits assigned default value ',nwidthref,' pixels.' endif if not keyword_set(nlengthref) then begin nlengthref = 15.0 print, 'Length of reference slits assigned default value ',nlengthref,' pixels.' endif widthref = round(nwidthref*pixelscale) ;reference slit width in microns lengthref = round(nlengthref*pixelscale) ;reference slit length in microns ;Print these inputs on screen to be user friendly print print, 'DMC filename: '+dmcfilename print, 'Pixel scale adopted: '+string(pixelscale)+' microns on the mask per image pixel' print, ' or: '+string(pixelscale * focalplanescale)+' arcsec/pixel' print, 'Focal plane scale used: '+string(focalplanescale)+' arcsec per micron' print, '1 arcsec on the mask: '+string(arcsecscale)+' microns' print, 'Slit width: '+string(nwidth)+' pixels' print, ' or: '+string(nwidth*pixelscale/arcsecscale)+' arcsec' print, 'Slit Length: '+string(nlength)+' pixels' print, ' or: '+string(nlength*pixelscale/arcsecscale)+' arcsec' print, 'Nbr. stars: '+string(n_elements(x)) if nindref gt 0 then begin print, 'Number of large slits for reference stars: '+string(n_elements(xref)) print, 'Slit width for reference stars: '+string(nwidthref)+' pixels' print, ' or: '+string(nwidthref*pixelscale/arcsecscale)+' arcsec' print, 'Slit length for reference stars: '+string(nlengthref)+' pixels' print, ' or: '+string(nlengthref*pixelscale/arcsecscale)+' arcsec' endif print ;STEP 0 ;If coordinates are given in arcsec instead of x,y pixels ;pixel_to_arcsec = focalplanescale(arcsec/micron) * pixelscale (micron/pixel) arcsec_to_pixel = 1.0/(focalplanescale * pixelscale) ;pixel/arcsec if keyword_set(arcsec) then begin x = x * arcsec_to_pixel y = y * arcsec_to_pixel if nindref gt 0 then begin xref = xref * arcsec_to_pixel yref = yref * arcsec_to_pixel endif endif ;STEP 1 ;Begin cutting the mask. Cut the holes for placing the mask in its cell openw, unite, dmcfilename, /get_lun printf, unite, format='(A)', 'MG "BEGINING CUTTING MASK"' ;printf, unite, format='(A)', 'MG "'+dmcfilename+'"' ;printf, unite, format='(A)', '' ;printf, unite, format='(A)', 'MG "slit width = '+strcompress(string(width),/remove_all)+' microns"' ;printf, unite, format='(A)', 'MG "slit width = '+strcompress(string(nwidth),/remove_all)+' detector pixels"' ;printf, unite, format='(A)', 'MG "slit width = '+strcompress(string(width/arcsecscale),/remove_all)+' arcseconds"' ;printf, unite, format='(A)', 'MG "slit length = '+strcompress(string(length),/remove_all)+' microns"' ;printf, unite, format='(A)', 'MG "slit length = '+strcompress(string(nlength),/remove_all)+' arcseconds"' cut_holes, unite ;STEP 2 ;Identify the mask by writing a code on it ;NOT YET IMPLEMENTED ;write_romannumber, unite, masknumber ;STEP 3 ;Cut the slits. ;x = [750,512,1] ;y = [512,750,1024] slitwidth = fltarr(n_elements(x))*0.0 + width slitlength = fltarr(n_elements(x))*0.0 + length ;Apply cold/warm scale due to temperature of aluminum (theoritical=0.392% measured=0.308%) cws = 1.0035 ;ColdWarmScale cut_slit, unite, x*cws, y*cws, slitwidth*cws, slitlength*cws, pixelscale ;STEP 4 ;Cut the few reference slits with a wide slit if nindref gt 0 then begin slitwidth = fltarr(n_elements(x))*0.0 + widthref slitlength = fltarr(n_elements(x))*0.0 + lengthref ;Apply cold/warm scale due to temperature of aluminum (theoritical=0.392% measured=0.308%) cws = 1.0035 ;ColdWarmScale cut_refslit, unite, xref*cws, yref*cws, slitwidth*cws, slitlength*cws, pixelscale endif ;STEP 5 ;Finish cutting the mask by cutting the outer diameter cut_outerdiameter, unite printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "MASK FINISHED"' ;printf, unite, format='(A)', 'MG "'+dmcfilename+'"' close, unite free_lun, unite ;STEP 6 ;Launch the dmc code reader that displays the interpreted code of the mask and ;creates a postscript version. if not keyword_set(dontcallreader) then begin for iteration=0, 1 do begin if iteration eq 0 then begin openr, unite, dmcfilename, /get_lun window, 2, xsize=400,ysize=400 plot, [-300000,300000],[-300000,300000], psym=3, $ xrange=[-240000,240000], yrange=[-240000,240000],xstyle=1,ystyle=1, $ xtitle='LAMA units (0.1 micron)', ytitle='LAMA units (0.1 micron)' line = 'asfdksagkfgadsk' x=0.0 y=0.0 laseron = 0 WHILE NOT EOF(unite) DO BEGIN READF, unite, line if not stregex(line,'CB1',/fold_case) then begin laseron = 0 endif if not stregex(line,'SB1',/fold_case) then begin laseron = 1 endif if not stregex(line,'PR',/fold_case) then begin toto = strsplit(line, ' ', /extract) tata = strsplit(toto[1], ',', /extract) dx = tata[0] dy = tata[1] if laseron eq 1 then begin plots, [x,x+dx],[y,y+dy] x = x + dx y = y + dy endif else begin x = x + dx y = y + dy endelse endif ENDWHILE close, unite FREE_LUN, unite endif if iteration eq 1 then begin openr, unite, dmcfilename, /get_lun mydevice = !D.NAME SET_PLOT, 'PS' DEVICE, filename=psfilename plot, [-300000,300000],[-300000,300000], psym=3, $ xrange=[-240000,240000], yrange=[-240000,240000],xstyle=1,ystyle=1, $ xtitle='LAMA units (0.1 micron)', ytitle='LAMA units (0.1 micron)' line = 'asfdksagkfgadsk' x=0.0 y=0.0 laseron = 0 WHILE NOT EOF(unite) DO BEGIN READF, unite, line if not stregex(line,'CB1',/fold_case) then begin laseron = 0 endif if not stregex(line,'SB1',/fold_case) then begin laseron = 1 endif if not stregex(line,'PR',/fold_case) then begin toto = strsplit(line, ' ', /extract) tata = strsplit(toto[1], ',', /extract) dx = tata[0] dy = tata[1] if laseron eq 1 then begin plots, [x,x+dx],[y,y+dy] x = x + dx y = y + dy endif else begin x = x + dx y = y + dy endelse endif ENDWHILE close, unite FREE_LUN, unite DEVICE, /CLOSE SET_PLOT, mydevice endif endfor endif end pro cut_slit, unite, pixelx, pixely, slitwidth, slitlength, pixelscale common param, x0, y0 ;unite is the file device number - no change ;pixelx, pixely is the position in detector pixels (pixel = 1 to 1024, not 0 to 1023) ; for the whole list of sources. ;width and length are given in microns ; ;pixelscale is the size of a pixel in microns ; ;ATTENTION, LAMA ACCEPTS POSITIONS IN UNITS OF 100 NANOMETERS, NOT MICRONS ;EXAMPLE: PR 140000,0 MEANS 14mm,0mm NOT 140um,0um!!! ; ;Orientation of the LAMA axes: X along the slit length, Y along the slit width ;STEP A ;Move the origin of the x,y list to the center of the image ;(this means that pixel 512.5, 512.5 now becomes 0,0) or more ;accurately: x0 = (max(pixelx) + min(pixelx))/2.0 y0 = (max(pixely) + min(pixely))/2.0 x0 = 512.5 x0 = 512.5 pixelx_cen = pixelx - x0 pixely_cen = pixely - y0 printf, unite, format='(A)', '' ;printf, unite, format='(A)', 'MG "Image Center Position (pixels)'+strcompress(string(x0)+','+string(y0))+'"' printf, unite, format='(A)', '' ;STEP B ;Apply the transformation to match the sky orientation ;Hence, from x,y on the raw image: ; -invert y sign to acount for the mask inversion in its cell ; -then invert the x and y signs to account for the LAMA machine inversion ;Example: If there is a source at 800,800 on the image, by putting the origin at ; 512.5,512.5, it becomes x0,y0=287.5,287.5. Applying the first mask inversion: ; x1,y1=287.5,-287.5. Applying the final LAMA inversion: x2,y2=-287.5,287.5 ;So, incorporating all: ;Transformation to LAMA units lamax = float(-pixelx_cen*pixelscale*10.0) lamay = float(pixely_cen*pixelscale*10.0) ;STEP C ;LOOP FOR EACH SLIT for slit=0, n_elements(lamax)-1 do begin x = lamax[slit] y = lamay[slit] length = slitlength[slit] width = slitwidth[slit] printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "SLIT '+strcompress(string(slit+1),/remove_all)+'"' printf, unite, format='(A)', 'MG "'+strcompress(string(pixelx[slit])+','+string(pixely[slit]))+'"' ;STEP D ; CGK-------------------BFJ ; | | ; | O AN ; | | ; DHL-------------------EIM ;Cut from A to N and move to O to finish ;Position O - center of the slit x_O = round(x) y_O = round(y) text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position A - then turn laser ON x_A = round(10 * length/2.0) y_A = 0 text = strcompress(string(x_A)+','+string(y_A),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED printf, unite, format='(A)', 'SB1' ;LASER ON ;Position B x_B = 0 y_B = round(10*width/2.0) text = strcompress(string(x_B)+','+string(y_B),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Do 2 passes to make sure the slit is cut (this will in effect total 3 passes ;if you account for the rest of the commands - those not in this loop) for pass=0,1 do begin ;Position CG x_C = -round(10*length) y_C = 0 text = strcompress(string(x_C)+','+string(y_C),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position DH x_D = 0 y_D = -round(10*width) text = strcompress(string(x_D)+','+string(y_D),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position EI x_E = round(10*length) y_E = 0 text = strcompress(string(x_E)+','+string(y_E),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position FJ x_F = 0 y_F = round(10*width) text = strcompress(string(x_F)+','+string(y_F),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED endfor ;Position K x_K = -round(10*length) y_K = 0 text = strcompress(string(x_K)+','+string(y_K),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position L x_L = 0 y_L = -round(10*width) text = strcompress(string(x_L)+','+string(y_L),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position M x_M = round(10*length) y_M = 0 text = strcompress(string(x_M)+','+string(y_M),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position N x_N = 0 y_N = round(10*width/2.0) text = strcompress(string(x_N)+','+string(y_N),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED printf, unite, format='(A)', 'CB1' ;STOP LASER ;Position O - Recenter to the center of the slit x_O = -round(10 * length/2.0) y_O = 0 text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position to center of mask (0,0) x_O = -round(x) y_O = -round(y) text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED endfor ;END OF THE LOOP FOR EACH SLIT end pro cut_refslit, unite, pixelx, pixely, slitwidth, slitlength, pixelscale common param, x0, y0 ;unite is the file device number - no change ;pixelx, pixely is the position in detector pixels (pixel = 1 to 1024, not 0 to 1023) ; for the whole list of sources. ;width and length are given in microns ; ;pixelscale is the size of a pixel in microns ; ;ATTENTION, LAMA ACCEPTS POSITIONS IN UNITS OF 100 NANOMETERS, NOT MICRONS ;EXAMPLE: PR 140000,0 MEANS 14mm,0mm NOT 140um,0um!!! ; ;Orientation of the LAMA axes: X along the slit length, Y along the slit width ;STEP A ;Move the origin of the x,y list to the center of the image ;(this means that pixel 512.5, 512.5 now becomes 0,0) or more ;accurately: pixelx_cen = pixelx - x0 pixely_cen = pixely - y0 printf, unite, format='(A)', '' ;printf, unite, format='(A)', 'MG "Image Center Position (pixels)'+strcompress(string(x0)+','+string(y0))+'"' printf, unite, format='(A)', '' ;STEP B ;Apply the transformation to match the sky orientation ;Hence, from x,y on the raw image: ; -invert y sign to acount for the mask inversion in its cell ; -then invert the x and y signs to account for the LAMA machine inversion ;Example: If there is a source at 800,800 on the image, by putting the origin at ; 512.5,512.5, it becomes x0,y0=287.5,287.5. Applying the first mask inversion: ; x1,y1=287.5,-287.5. Applying the final LAMA inversion: x2,y2=-287.5,287.5 ;So, incorporating all: ;Transformation to LAMA units lamax = float(-pixelx_cen*pixelscale*10.0) lamay = float(pixely_cen*pixelscale*10.0) ;STEP C ;LOOP FOR EACH SLIT for slit=0, n_elements(lamax)-1 do begin x = lamax[slit] y = lamay[slit] length = slitlength[slit] width = slitwidth[slit] printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "SLIT '+strcompress(string(slit+1),/remove_all)+'"' printf, unite, format='(A)', 'MG "xy'+strcompress(string(pixelx[slit])+','+string(pixely[slit]))+'"' ;STEP D ; CGK-------------------BFJ ; | | ; | O AN ; | | ; DHL-------------------EIM ;Cut from A to N and move to O to finish ;Position O - center of the slit x_O = round(x) y_O = round(y) text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position A - then turn laser ON x_A = round(10 * length/2.0) y_A = 0 text = strcompress(string(x_A)+','+string(y_A),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED printf, unite, format='(A)', 'SB1' ;LASER ON ;Position B x_B = 0 y_B = round(10*width/2.0) text = strcompress(string(x_B)+','+string(y_B),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Do 2 passes to make sure the slit is cut (this will in effect total 3 passes ;if you account for the rest of the commands - those not in this loop) for pass=0,1 do begin ;Position CG x_C = -round(10*length) y_C = 0 text = strcompress(string(x_C)+','+string(y_C),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position DH x_D = 0 y_D = -round(10*width) text = strcompress(string(x_D)+','+string(y_D),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position EI x_E = round(10*length) y_E = 0 text = strcompress(string(x_E)+','+string(y_E),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position FJ x_F = 0 y_F = round(10*width) text = strcompress(string(x_F)+','+string(y_F),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED endfor ;Position K x_K = -round(10*length) y_K = 0 text = strcompress(string(x_K)+','+string(y_K),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position L x_L = 0 y_L = -round(10*width) text = strcompress(string(x_L)+','+string(y_L),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position M x_M = round(10*length) y_M = 0 text = strcompress(string(x_M)+','+string(y_M),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position N x_N = 0 y_N = round(10*width/2.0) text = strcompress(string(x_N)+','+string(y_N),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED printf, unite, format='(A)', 'CB1' ;STOP LASER ;Position O - Recenter to the center of the slit x_O = -round(10 * length/2.0) y_O = 0 text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED ;Position to center of mask (0,0) x_O = -round(x) y_O = -round(y) text = strcompress(string(x_O)+','+string(y_O),/remove_all) printf, unite, format='(A)', 'PR '+text ;MOVE TO printf, unite, format='(A)', 'BGXY' ;START XY MOTION printf, unite, format='(A)', 'AMXY' ;AFTER XY MOVED endfor ;END OF THE LOOP FOR EACH SLIT end pro write_romannumber, masknumber ;Transform a number to its roman spelling (I,V,X) case masknumber of 1: roman = 'i' 2: roman = 'ii' 3: roman = 'iii' 4: roman = 'iv' 5: roman = 'v' 6: roman = 'vi' 7: roman = 'vii' 8: roman = 'viii' 9: roman = 'ix' 10: roman = 'x' 11: roman = 'xi' 12: roman = 'xii' 13: roman = 'xiii' 14: roman = 'xiv' 15: roman = 'xv' 16: roman = 'xvi' 17: roman = 'xvii' 18: roman = 'xviii' 19: roman = 'xix' 20: roman = 'xx' 21: roman = 'xxi' 22: roman = 'xxii' 23: roman = 'xxiii' 24: roman = 'xxiv' 25: roman = 'xxv' 26: roman = 'xxvi' 27: roman = 'xxvii' 28: roman = 'xxviii' 29: roman = 'xxix' 30: roman = 'xxx' 31: roman = 'xxxi' 32: roman = 'xxxii' 33: roman = 'xxxiii' 34: roman = 'xxxiv' 35: roman = 'xxxv' 36: roman = 'xxxvi' 37: roman = 'xxxvii' 38: roman = 'xxxviii' 39: roman = 'xxxix' 40: roman = 'xl' 41: roman = 'xli' 42: roman = 'xlii' 43: roman = 'xliii' 44: roman = 'xliv' 45: roman = 'xlv' 46: roman = 'xlvi' 47: roman = 'xlvii' 48: roman = 'xlviii' 49: roman = 'xlix' 50: roman = 'l' endcase end pro cut_I, unite, pos ;pos is the character position, i.e. if want to write 'XIV' then pos=2 printf, unite, format='(A)', strcompress('"CHARACTER'+string(pos)+'"',/remove_all) end pro cut_V, pos end pro cut_X, pos end pro cut_L, pos end pro cut_holes, unite printf, unite, format='(A)', 'CB 1' printf, unite, format='(A)', 'MG "***LASER OFF"' printf, unite, format='(A)', 'HOLD=1' printf, unite, format='(A)', 'MG "---ENABLE FOCUS"' printf, unite, format='(A)', 'SH' printf, unite, format='(A)', '' printf, unite, format='(A)', 'VA 40000, 40000' printf, unite, format='(A)', 'VS 15000, 15000' printf, unite, format='(A)', 'VD 40000, 40000' printf, unite, format='(A)', 'SP 40000, 40000' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 1 (0,23)"' printf, unite, format='(A)', 'PR 0,-230000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR 0,230000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 2 (-23,0)"' printf, unite, format='(A)', 'PR 230000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR -230000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 3(-19.9,-11.5)"' printf, unite, format='(A)', 'PR 199000,115000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR -199000,-115000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 4 (11.5,-19.9)"' printf, unite, format='(A)', 'PR -115000,199000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR 115000,-199000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 5 (19.9,-11.5)"' printf, unite, format='(A)', 'PR -199000,115000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR 199000,-115000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 6 (11.5,19.9)"' printf, unite, format='(A)', 'PR -115000,-199000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 20000,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -20000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR 115000,199000' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "START 2 SMALL HOLES"' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 7 (-19.91,11.52)"' printf, unite, format='(A)', 'PR 199100,-115200' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 10200,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 10200,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -10200,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR -199100,115200' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "CIRCLE 8 (23,0)"' printf, unite, format='(A)', 'PR -230000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'PR 10200,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 10200,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'PR -10200,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR 230000,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' end pro cut_outerdiameter, unite printf, unite, format='(A)', '' printf, unite, format='(A)', '' printf, unite, format='(A)', 'MG "OUTER DIAMETER"' printf, unite, format='(A)', '' printf, unite, format='(A)', 'PR 267500,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'SB1' printf, unite, format='(A)', 'VMXY' printf, unite, format='(A)', 'CR 267500,0,720' printf, unite, format='(A)', 'VE' printf, unite, format='(A)', 'BGS' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', 'CB1' printf, unite, format='(A)', 'PR -267500,0' printf, unite, format='(A)', 'BGXY' printf, unite, format='(A)', 'AMXY' printf, unite, format='(A)', '' printf, unite, format='(A)', 'CB 1' printf, unite, format='(A)', 'MG "***LASER OFF"' printf, unite, format='(A)', 'CB 1' printf, unite, format='(A)', 'HOLD=0' printf, unite, format='(A)', 'MO' printf, unite, format='(A)', '' end