To save or load patterns in any format, make sure you are using FileIO
.
Saving patterns
This package can load/save patterns in the GDSII format for use with e-beam lithography systems. In the future it may be useful to implement machine-specific pattern formats to force fracturing or dosing in an explicit manner.
DeviceLayout.save
— Functionsave(file::File{format"DXF"}, c::Cell, python::String)
Export a Cell
to a DXF file. Uses the ezdxf
program in Python, and requires the python executable path that has that package installed (could simply be python
, or /Users/user/.julia/conda/3/bin/python
). Generates a Python script and runs it, to avoid PyCall dependency.
save(::Union{AbstractString,IO}, cell0::Cell{T}, cell::Cell...)
save(f::File{format"GDS"}, cell0::Cell, cell::Cell...;
name="GDSIILIB", userunit=1μm, modify=now(), acc=now(),
verbose=false)
This bottom method is implicitly called when you use the convenient syntax of the top method: save("/path/to/my.gds", cells_i_want_to_save...)
Keyword arguments include:
name
: used for the internal library name of the GDSII file and probably inconsequential for modern workflows.userunit
: sets what 1.0 corresponds to when viewing this file in graphical GDS editors with inferior unit support.modify
: date of last modification.acc
: date of last accession. It would be unusual to have this differ fromnow()
.verbose
: monitor the output oftraverse!
andorder!
to see if something funny is happening while saving.
save(file::File, sm::SolidModel)
save(filename::String, sm::SolidModel)
Save a SolidModel
instance to a file
or filename
.
Supported filetypes for OpenCASCADE geometries are .brep
and .stp
. Meshes can be exported as .msh2
(compatible with Palace) or .msh
(most recent Gmsh format) files.
Using the Cairo graphics library, it is possible to save cells into SVG, PDF, and EPS vector graphics formats, or into the PNG raster graphic format. This enables patterns to be displayed in web browsers, publications, presentations, and so on. You can save a cell to a graphics file by, e.g. save("/path/to/file.svg", mycell)
. Note that cell references and arrays are not saved, so you should flatten cells if desired before saving them.
Possible keyword arguments include:
width
: Specifies the width parameter. A unitless number will give the width in pixels, 72dpi. You can also give a length in any unit using aUnitful.Quantity
, e.g.u"4inch"
if you had previously doneusing Unitful
.height
: Specifies the height parameter. A unitless number will give the width in pixels, 72dpi. You can also give a length in any unit using aUnitful.Quantity
. The aspect ratio of the output is always preserved so specify eitherwidth
orheight
.layercolors
: Should be a dictionary withInt
keys for layers and RGBA tuples as values. For example, (1.0, 0.0, 0.0, 0.5) is red with 50% opacity.bboxes
: Specifies whether to draw bounding boxes around the bounds of cell arrays or cell references (true/false).
Loading patterns
DeviceLayout.load
— Functionload(f::File{format"GDS"}; verbose::Bool=false, nounits::Bool=false)
A dictionary of top-level cells (Cell
objects) found in the GDSII file is returned. The dictionary keys are the cell names. The other cells in the GDSII file are retained by CellReference
or CellArray
objects held by the top-level cells. Currently, cell references and arrays are not implemented.
The FileIO package recognizes files based on "magic bytes" at the start of the file. To permit any version of GDSII file to be read, we consider the magic bytes to be the GDS HEADER tag (0x0002
), preceded by the number of bytes in total (0x0006
) for the entire HEADER record. The last well-documented version of GDSII is v6.0.0, encoded as 0x0258 == 600
. LayoutEditor appears to save a version 7 as 0x0007
, which as far as I can tell is unofficial, and probably just permits more layers than 64, or extra characters in cell names, etc.
If the database scale is 1μm
, 1nm
, or 1pm
, then the corresponding unit is used for the resulting imported cells. Otherwise, an "anonymous unit" is used that will display as u"2.4μm"
if the database scale is 2.4μm, say.
Warnings are thrown if the GDSII file does not begin with a BGNLIB record following the HEADER record, but loading will proceed.
Property values and attributes (PROPVALUE and PROPATTR records) will be ignored.
Encountering an ENDLIB record will discard the remainder of the GDSII file without warning. If no ENDLIB record is present, a warning will be thrown.
The content of some records are currently discarded (mainly the more obscure GDSII record types, but also BGNLIB and LIBNAME).
If nounits
is true, Cell{Float64}
objects will be returned, where 1.0 corresponds to one micron.