Perl で gdsii
実行環境
  Active Perl
     更新するには
ppm
  ppm
  DownLoad
  実行
Help
   perldoc GDS2
Examples
  basic-lines
  simple
  simple-sref
  aref
  circle
  circle-inverted
  sample-arc
  donut
  Inverted-Donuts
  Donuts_Combination
  Hello-World
  CP-array
  text2gds.pm
  rotate.pm
  rotate-rectangle
  arc.pm
  line-and-space-180
  triangle-array-nega
  sq_sleeve.pm
  TriangleGridStep
  triangle-array-nega-CP
  CirclesArray-SQ
  LargeCircles
  MA6-Alignment-mark.pm
  Alignment-Place
  Triangle-Grid
  Triangle-Grid-Wide
  ellipsis-polygons
  inscribe_polygon
  inscribe_polygon.pm
  inscribe_polygon-ellipsis.pm
  sleeving-by-square-sample
  sleeving-by-square.pm

Perl Perl/GDSII page
Download (as "Triangle-Grid.txt")

Triangle-Grid

#!/usr/bin/perl -w
# ---------------------------------------------------------------
#     120nm の円を 160nm pitch で 500um x 500um の大きさに配置する
#     120nm の円は、 CP (HoleSIPH120nm) を想定しています
# ---------------------------------------------------------------
use GDS2;
use strict;
use Math::Trig;		#  三角関数を使う

my $R3 = 1.7320508;
#  simulating circle (8 角形)
sub polygon_8($$$$) {			# use strict した時には、引数の数を合せておく
    #   四つの引数をローカル変数に代入
    my ($r)        = shift;		# 直径
    my ($str)      = shift;		# structure の名前
    my ($layer)    = shift;
    my ($gds2File) = shift;
    
    my ($theta) =    22.5 * 3.141593/180;	# get radian for 15 degree

#       + 
#       |     +  ($b, $a)   67.5 度
#       |       
#       |       
#       |
#       |
#       |              +  ($a, $b)   22.5 度
#       |               
#       +---------------
    
    my ($a)  =     $r / 2 * cos($theta/2);	# 15 度 -> x
    my ($b)  = 2 * $r / 2 * sin($theta/2);	# 15 度 -> y

    $gds2File -> printBgnstr(-name => $str);
    $gds2File -> printBoundary( 
        -layer => $layer, 
        -dataType => 0, 				# 指定しなくても 0 になるが
        -xy  => [   $a,  $b, 		   $b,   $a,	# 2 x 8 組の座標を設定
                   -$b,  $a, 		  -$a,   $b,
                   -$a, -$b, 		  -$b,  -$a,
                    $b, -$a, 		   $a,  -$b,
        ]);
    $gds2File -> printEndstr;    
}

## --------------------------------------------
##          M A I N  R O U T I N E 
## --------------------------------------------

my $filename = $0;                                      # ---  set filename with the same as this script
   $filename =~ s/\.txt$//;                             # ---  Strip '.txt' part
							#      単に dot(.) と書くと、「何でも文字一つ」にー致するので、
							#      「本当に . の文字」の意味で \. としています
                                                        #      $ は行末を意味します
			                                # ---  Add '.gds' to (output) filename

my $span    = 500;
my $pitch   = 0.16;
my $gds_name = sprintf("%s-%d-%5.3f.gds", $filename, $span, $pitch);

my $gds2File = new GDS2(-fileName=> '>'. $gds_name);
$gds2File -> printInitLib(-name=>'LibraryName');

# Prepare primitive structure
# --------------------------------------------------
#         直径   名前             Layer
my $CPname = 'HoleSIPH120nm';
polygon_8(0.12, $CPname, 0, $gds2File);

my $columns = $span / $pitch; 		# pitch = 0.16 um
my $rows    = $span / ($pitch * $R3);	# row

$gds2File -> printBgnstr(-name => 'grid');
    $gds2File -> printAref(
	-name=>  $CPname,
	-columns=> $columns,
	-rows=>    $rows,
        -xy=>[0,   0, 
              $span, 0, 
              0,   $span ]);
$gds2File -> printEndstr;

# 上のような Array の置き方だと、中心が (0, 0) ではないので、
# ちょうど全体の半分を左下にずらす

$gds2File -> printBgnstr(-name => 'TOP');
$gds2File -> printSref(
    -name =>  'grid',
    -xy   =>   [-$span/2, -$span/2]);


$gds2File -> printSref(
    -name =>  'grid',
    -xy   =>   [-$span/2  + $pitch/2, -$span/2 + $pitch * $R3/2]);

$gds2File -> printEndstr;

$gds2File -> printEndlib();
__END__

Last Update: Mon, 21 Feb 2022 10:13:01 GMT 1.66 2008/03/08