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 "CP-array.txt")

CP-array

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

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

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

    $gds2File -> printBgnstr(-name => $str);
    $gds2File -> printBoundary( 
        -layer => $layer, 
        -dataType => 0, 				# 指定しなくても 0 になるので省略しても同じ
        -xy  => [   $a,  $b,   $c,   $c,   $b,   $a,	# 2 x 12 組の座標を設定
                   -$b,  $a,  -$c,   $c,  -$a,   $b,
                   -$a, -$b,  -$c,  -$c,  -$b,  -$a,
                    $b, -$a,   $c,  -$c,   $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(.) と書くと、「何でも文字一つ」にー致するので、
							#      「本当に . の文字」の意味で \. としています
                                                        #      $ は行末を意味します
   $filename .= '.gds';                                 # ---  Add '.gds' to (output) filename

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

# Prepare primitive structure
# --------------------------------------------------
#         直径   名前             Layer
polygon_12(0.1, 'HoleSIPH100nm', 0, $gds2File);

my $span  = 70;
my $column = $span / 0.5; 	# pitch = 0.5 um

$gds2File -> printBgnstr(-name => 'grid');
    $gds2File -> printAref(
	-name=>  'HoleSIPH100nm',
	-columns=> $column,
	-rows=>    $column,
        -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 -> printEndstr;


$gds2File -> printEndlib();
__END__

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