Get screenshot of a design from command line

edited February 2016 in Ruby Scripting

I am trying to take a screen shot of a design. I want to be able to do this from the command line without a view open.

This code below works but requires a view to be open in the main window.

module MyMacro

  include RBA

  w = 5000
  h = 5000
  f = "C:\\TEMP\\test.png"

  view = Application::instance.main_window.current_view
  view || raise("No view open")
  view.save_image(f, w, h)

end

How do I open a .gds file into a LayoutView so I can use .save_image . This is the code I tried but would get the error 'Object cannot be created here in LayoutView::load_layout'.

module MyMacro

  include RBA

  w = 5000
  h = 5000
  f = "C:\\TEMP\\test.png"

  layoutView = RBA::LayoutView::new
  layoutView.load_layout("C:\\TEMP\\test.gds",TRUE)
  layoutView.save_imabe(f,w,h)

end

Thanks,
Keil

Comments

  • edited February 2016

    Hi Keil,

    RBA::LayoutView is not an object you can instantiate yourself. I can only live in the context of the application. You you have to use

    mw = RBA::Application::instance.main_window
    mw.load_layout("ttt.gds", 1)
    mw.current_view.save_image("ttt.png", 1000, 1000)
    

    You can configure the view by loading layer properties or similar. You can run the script with "-z", but not with "-zz" since the latter mode does not create a main window object.

    Matthias

    NOTE: code was edited (see below)

  • edited February 2016

    Hi matthias

    what your doing is awesome.

    I am having problems run the code you provided. Is open_layout a valid method because when I run your code I get and error message "undefined method `open_layout' for #". Also when I look at the documentation for main_window I dont see a method called 'open_layout'.

    Code I tried to run.

    module MyMacro
    
      include RBA
    
       mw = RBA::Application::instance.main_window
      mw.open_layout("C:\\TEMP\\test.gds")
      mw.current_view.save_image("C:\\TEMP\\test.png", 1000, 1000)
    
    end
    

    Thanks,
    Keil

  • edited February 2016

    Hi Keil,

    Sorry for the typo. It should be 'load_layout(..., 1)'. The 1 is for 'open in a new view'.

    I have edited the above code.

    Matthias

Sign In or Register to comment.