scripting import LEF/DEF

edited January 2018 in General
Hi,
I would like to create a menu that loads a lef+def file on an existing opened design. Exactlty what I would do by File->import->LEF/DEF and selecting "Import as new layout is the same panel"


The command I use for launching klayout is :
klayout -e -u KLAYOUT/results/gds.lyp -rm ./fastkit_macro.lym

where gds.lyp gives the gds and associated layerProps

the macro I defined for loading the def is as follows but is does not work at all
(stream format is not correct)

module FastkitMacro2
include RBA
$fastkit_action = RBA::Action.new
$fastkit_action.title = "load_DIAG"
$fastkit_action.on_triggered {
RBA::LayoutView::current.load_layout("./DIAG/results/diag.def",2)
RBA::LayoutView::current.load_layer_props("./DIAG/results/diag.lyp")
}
app = RBA::Application.instance
mw = app.main_window
menu = mw.menu
menu.insert_item("end", "fastkit", $fastkit_action)
end

Is there a method that can load this format ?
Thanks
Paul

Comments

  • edited November -1

    Hi Paul,

    did you try with the latest version (0.25)? For this version, it should be possible to load DEF like any other format.

    DEF is richer, so if you want to provide particular configuration options, you'll need a separate configuration object:

    options = RBA::LoadLayoutOptions::new
    lefdef_options = RBA::LEFDEFReaderConfiguration::new
    # configure lefdef_options, i.e.
    # lefdef_options.dbu = 0.00025
    options.lefdef_config = lefdef_options
    view.load_layout(filename, options, true)
    

    For LEF/DEF reader options see http://www.klayout.de/doc-qt4/code/class_LEFDEFReaderConfiguration.html

    BTW:

    • You don't need to create RBA::Action in your code above - just configure the macro to show up in the menu. The macro essentially will become a two-liner.
    • The last parameter of view:load_layout is a bool (2 will be taken as 'true')

    Regards,

    Matthias

Sign In or Register to comment.