Download (as "simple.txt") simple
#!/usr/bin/perl -w
# GDSII generation
# Most simple example, have only one box-500 structure.
# It has one boundary.
use GDS2; # --- enable GDSII (GDS2) library
# strict checks variable declaration and subroutine argument consistency
use strict;
my $VERSION = "2018-09-03 06:30" ; # written by emacs time-stamp (UTC)
## --------------------------------------------
## M A I N R O U T I N E
## --------------------------------------------
my ($gds2File); # --- file handle
# 出力名を 「自分の名前.gds」 に設定します。ただし、もし、 .txt が付いていたら、それは先に削除します。
my $filename = $0; # --- set filename with the same as this script
$filename =~ s/\.txt$//; # --- Strip '.txt' part
# $ は行末を意味します
$filename .= '.gds'; # --- Add '.gds' to (output) filename
# dot(.) connects string
$gds2File = new GDS2(-fileName=> '>'. $filename); # --- open new GDS2 (object) to write
$gds2File -> printInitLib(-name=>'LibraryName'); # --- always necessary for start
# 名前は何でも良いです
$gds2File -> printBgnstr( -name=> 'box-500'); # --- Start new structure
$gds2File -> printBoundary( # --- Boundary with four coordinate
-xy=> [-250, -250,
250, -250,
250, 250,
-250, 250],
-layer=> 0, # --- layer (省略可。その時は 0)
);
$gds2File -> printEndstr(); # --- End of this new structure
$gds2File -> printEndlib(); # --- close library
__END__
|