Download (as "CirclesArray-SQ.txt") CirclesArray-SQ
#!/usr/bin/perl -w
use GDS2;
use strict;
use Getopt::Std;
require './text2gds.pm';
require './arc.pm'; # 円弧座標(の組)を計算して返す
# ---------------------------------
# arc::arc(中心 x, 中心 y, 開始角, 終了角, 半径, 頂点の数,
# 'not-used', 時計回り(-1) or 反時計回り(1) )
# ---------------------------------
our @ARGS;
our %opts;
my($VERSION);
$VERSION = "2018-11-03 10:51" ; # written by emacs time-stamp
my $size = 2100; # set default span
my $pitch = 30; # set default pitch
sub usage() {
print <<HELP;
synopsys
perl $0 [-h] [-p pitch] [-s span]
-h show this help
-p pitch (pitch of each array in micron), default $pitch
-s span (size of whole array, x and y in micron), default $size
HELP
}
## --------------------------------------------
## M A I N R O U T I N E
## --------------------------------------------
my ($gds2File);
my ($X) = 0; # constant (MACRO)
my ($Y) = 1; # ditto
getopts('s:p:h', \%opts);
if ($opts{'s'}) { $size = $opts{'s'};}
if ($opts{'p'}) { $pitch = $opts{'p'};}
if ($opts{'h'}) { usage(); exit}
my $count = int($size/$pitch);
my $span = $count * $pitch / 2;
my $filename = $0;
$filename =~ s/\.txt$//; # --- Strip '.txt' part
$filename = sprintf("%s-p%2d-%05.3f.gds", $filename, $pitch, $span/1000 * 2);
# print __LINE__. ' '. $count . "\n";
print 'output name: '. $filename, "\n";
unlink $filename;
$gds2File = new GDS2(-fileName=> '>'. $filename );
$gds2File -> printInitLib(-name=>'LibraryName');
my $x = 0;
my $y = 0;
my $start = 0; # in degree
my $end = 360; # in degree
my $radius = 19 / 2; # in micron
my $polygon = 24;
my $not_used = '' ;
my $direction = -1; # CCW(1), CW(0) この向きは今回は重要
# 半径 9.5 um の円の代りに 24 角形
# arc という subroutine を使って各頂点の座標をもらって多角形にする
my @COORDS_PAIR =
arc::arc( $x, $y, $start, $end, $radius, $polygon, $not_used, $direction);
$gds2File -> printBgnstr( -name=> 'simple-circle');
# COORDS_PAIR の前後に枠の座標を付加えて中抜きにする
$gds2File -> printBoundary (
-xy =>
[
-$pitch/2, -$pitch/2,
$pitch/2, -$pitch/2,
$pitch/2, 0,
@COORDS_PAIR,
$pitch/2, 0,
$pitch/2, $pitch/2,
-$pitch/2, $pitch/2,
]);
text2gds::text_flat(-1.0, - $radius * 1.2, 20, 0.02, $VERSION, $gds2File);
$gds2File -> printEndstr;
$gds2File -> printBgnstr( -name=> 'TOP');
$gds2File -> printAref(
-name => 'simple-circle' ,
-columns => $count,
-rows => $count,
-xy => [- $span, -$span,
$span, -$span,
- $span, $span, ]
);
$gds2File -> printEndstr;
$gds2File -> printEndlib();
__END__
CF-SX2@makoto 21:50:24/181117(..Perl_GDSII_Tutorial/code)% perl CirclesArray-SQ.txt -s 2100 -p 30
output name: CirclesArray-SQ-p30-2.100.gds
CF-SX2@makoto 21:50:53/181117(..Perl_GDSII_Tutorial/code)% perl CirclesArray-SQ.txt -s 2100 -p 21
output name: CirclesArray-SQ-p21-2.100.gds
|