It looks like you're new here. If you want to get involved, click one of these buttons!
Hi,
 I wrote a program to find distance between pads for probing purpose. After finding the distance, I am saving it in a csv file. 
My ultimate aim is to print an image of a single die with pad info. I would like to know how to take the image using script and write pad info from csv file to the image. Any help is appreciated
Inputs given are position of the pad and also whether it is simple pad or complex pad. 
One is simple pad and 2 is complex pad
 module DimPads
include RBA
$VERBOSE = nil
myListx = []
myListy = []
c=[]
c1=[]
pad_pos= RBA::InputDialog.get_item("Pads position", "Position", ["North", "South", "East", "West"], 1)
val= RBA::InputDialog.get_int_ex("Input pad details", "Select 1 for simple pads 2 for complex:", 2 , 1, 2, 1)
value=val.value
pos=pad_pos.value
outfile = "C:/fullpath/PadsDim.csv"
file = File.open(outfile, "a")
#file.puts("pos,pad dimension") # Header row
ly = CellView::active.layout
lv = Application::instance.main_window.current_view|| raise("No layout loaded")
lv.each_object_selected {
  |obj|
  shape = obj.shape
  if shape.is_polygon?||shape.is_box?
    # NOTE "transformed" - this transforms the polygon into the current cell
    shape.polygon.transformed(obj.trans).each_point_hull { 
      |pt|     
      (x, y) = pt.x*ly.dbu, pt.y*ly.dbu
      myListx << x
      myListy << y
    }
  end
}
if (value==1 && pos=="West")
      puts "#{myListx}", "#{myListy}"     
      c=myListy.uniq     
      puts "uniq", "#{c}"
      c1=c.sort
      puts "uniq sorted", "#{c1}"
      DistCentr1=(c1[0]- c1[1])/2
      DistCentr2=(c1[2]- c1[3])/2
      if(c1[4]!=nil)
      DistCentr3=(c1[4]- c1[5])/2   
      end   
      y1=c1[0]-(DistCentr1)
      y2=c1[2]-(DistCentr2)
      if(c1[4]!=nil)
      y3=c1[4]-(DistCentr3)
      end
      len1=(y1-y2)
      if(c1[4]!=nil)
      len2=((y2-y3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[4]!=nil)
      puts "#{len2.abs}" 
      end
      file.puts "#{pos}, #{len1.abs}"
      end 
if (value==1 && pos=="East")
      puts "#{myListx}", "#{myListy}"     
      c=myListy.uniq     
      c1=c.sort
      DistCentr1=(c1[0]- c1[1])/2
      DistCentr2=(c1[2]- c1[3])/2
      if(c1[4]!=nil)
      DistCentr3=(c1[4]- c1[5])/2 
      end    
      y1=c1[0]-(DistCentr1)
      y2=c1[2]-(DistCentr2)
      if(c1[4]!=nil)
      y3=c1[4]-(DistCentr3)
      end
      len1=(y1-y2)    
      if(c1[4]!=nil)
      len2=((y2-y3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[4]!=nil)
      puts "#{len2.abs}"
      end
      file.puts "#{pos}, #{len1.abs}"               
      end 
if (value==1 && pos=="North")
      puts "#{myListx}", "#{myListy}"     
      c=myListx.uniq     
      c1=c.sort      
      DistCentr1=(c1[0]-c1[1])/2
      DistCentr2=(c1[2]-c1[3])/2
      if(c1[4]!=nil)
      DistCentr3=(c1[4]-c1[5])/2
      end
      x1=c1[0]-(DistCentr1)
      x2=c1[2]-(DistCentr2)
      if(c1[4]!=nil)
      x3=c1[4]-(DistCentr3)
      end
      len1=(x1-x2)
      if(c1[4]!=nil)
      len2=((x2-x3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[4]!=nil)
      puts "#{len2.abs}" 
      end  
      file.puts "#{pos}, #{len1.abs}"            
      end  
if (value==1 && pos=="South")
     puts "#{myListx}", "#{myListy}"     
      c=myListx.uniq     
      c1=c.sort
      DistCentr1=(c1[0]-c1[1])/2
      DistCentr2=(c1[2]-c1[3])/2
      if(c1[4]!=nil)
      DistCentr3=(c1[4]-c1[5])/2
      end
      x1=c1[0]-(DistCentr1)
      x2=c1[2]-(DistCentr2)
      if(c1[4]!=nil)
      x3=c1[4]-(DistCentr3)
      end
      len1=(x1-x2)
      if(c1[4]!=nil)
      len2=((x2-x3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[4]!=nil)
      puts "#{len2.abs}" 
      end
      file.puts "#{pos}, #{len1.abs}"              
      end     
if (value==2 && pos=="West")
      puts "#{myListx}", "#{myListy}"     
      c=myListy.uniq     
      puts "uniq", "#{c}"
      c1=c.sort
      puts "uniq sorted", "#{c1}"
      centr1=(c1[0]- c1[1])/2
      centr2=(c1[2]- c1[5])/2
      if(c1[6]!=nil)
      centr3=(c1[6]- c1[7])/2
      end
      y1=c1[0]-(centr1)
      y2=c1[2]-(centr2)
      if(c1[6]!=nil)
      y3=c1[6]-(centr3)
      end
      len1=(y1-y2)
      if(c1[6]!=nil)
      len2=((y2-y3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[6]!=nil)
      puts "#{len2.abs}" 
      end 
      file.puts "#{pos}, #{len1.abs}"             
      end         
if (value==2 && pos=="East")
    puts "#{myListx}", "#{myListy}"     
      c=myListy.uniq     
      puts "uniq", "#{c}"
      c1=c.sort
      puts "uniq sorted", "#{c1}"
      centr1=(c1[0]-c1[1])/2
      centr2=(c1[2]-c1[5])/2
      if(c1[6]!=nil)
      centr3=(c1[6]-c1[7])/2
      end
      y1=c1[0]-(centr1)
      y2=c1[2]-(centr2)
      if(c1[6]!=nil)
      y3=c1[6]-(centr3)
      end
      len1=(y1-y2)
      if(c1[6]!=nil)
      len2=((y2-y3))
      end
      puts "Pad len","#{len1.abs}" 
      if(c1[4]!=nil)
      puts "#{len1.abs}" 
      end
      file.puts "#{pos}, #{len2.abs}"              
      end
if (value==2 && pos=="North")
      puts "#{myListx}", "#{myListy}"     
      c=myListx.uniq     
      puts "uniq", "#{c}"
      c1=c.sort
      puts "uniq sorted", "#{c1}"
      centr1=(c1[0]-c1[1])/2
      centr2=(c1[2]-c1[5])/2
      if(c1[6]!=nil)
      centr3=(c1[6]-c1[7])/2
      end
      x1=c1[0]-(centr1)
      x2=c1[2]-(centr2)
      if(c1[6]!=nil)
      x3=c1[6]-(centr3)
      end
      len1=(x1-x2)
      len2=((x2-x3))
      puts "Pad len","#{len1.abs}" 
      if(c1[6]!=nil)
      puts "#{len1.abs}"
      end              
      end         
if (value==2 && pos=="South")
      puts "#{myListx}", "#{myListy}"     
      c=myListx.uniq     
      c1=c.sort
      puts "uniq sorted", "#{c1}"
      centr1=(c1[0]-c1[1])/2
      centr2=(c1[2]-c1[5])/2
      if(c1[6]!=nil)
      centr3=(c1[6]-c1[7])/2
      end
      x1=c1[0]-(centr1)
      x2=c1[2]-(centr2)
      if(c1[6]!=nil)
      x3=c1[6]-(centr3)
      end
      len1=(x1-x2)
      if(c1[6]!=nil)
      len2=((x2-x3))
      end      
      puts "Pad len","#{len1.abs}" 
      if(c1[6]!=nil)
      puts "#{len1.abs}"
      end              
      end         
  file.close 
  end
                
Comments
Hi, Raji!
I think you need to create text labels in layout (see
Layout,Shape(how to add) andLayerProperties(how to make layer visible)) and than useLayoutView.save_imageorLayoutView.save_image_with_options.@raji There is little to add to Eugene's summary. Your assignment is pretty unspecific. What does "print" mean? If a PNG screenshot is sufficient, then the job is to populate a LayoutView with the proper objects and then generate an image using "save_image" or "save_image_with_options". You may also consider using annotations (rulers) as additional, non-layout objects.
You may want to study the code I am using to generate the DRC sample images. It's a similar task and the script can be found here: https://github.com/KLayout/klayout/blob/master/scripts/create_drc_samples.rb
Matthias