OpenAccess Script is a direct scripting interface to the OpenAccess library. It can be use identical to LayoutScript: just press the execute button to start it. For more details on OpenAccess Script please see http://oascript.org. OpenAccess script is limited to holders of a commercial license of the LayoutEditor and not available in the free version without a license key.
#load OpenAccess Script module
require "oa"
# avoid the oa prefix
include Oa
libname = "demolib"
libpath = "/home/thies/demolib"
cellname = "rubytest"
# Open default lib.defs file
OaLibDefList.openLibs()
#check if library is already open
lib = OaLib.find(libname)
if lib == nil
if !(File.directory?(libpath))
require 'fileutils'
FileUtils.mkdir_p(libpath)
end
lib = OaLib.open(libname,libpath)
if lib==nil
puts "Cannot find library #{libname}, create it"
lib=OaLib.create(libname,libpath)
if lib==nil
die("Library #{libname} cannot be created")
end
end
end
mlay = OaViewType.get("maskLayout")
design = OaDesign.open(libname, cellname, "layout", mlay, "w")
block = OaBlock.create(design)
# add a rectangle to the design on layer 9, property 0
box=OaBox.new(0,0,500,800)
OaRect.create(block,9,0,box)
# add a polygon to the design on layer 11, property 0
p=OaPointArray.new()
p.append([145,67]);
p.append([985,244]);
p.append([335,955]);
OaPolygon.create(block,11,0,p)
design.save()
puts "Ruby example completed"
Further examples are in any LayoutEditor package under macros/examples.