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 "simple-sref.txt")

simple-sref

#!/usr/bin/perl -w
# GDSII generation 
#   ------------------------------------------------------------------------------
#   SREF stands for Structure Reference. Structure also called 'cell', small unit
#   of drawing.
#   ------------------------------------------------------------------------------
#   The most simple SREF example, have box-500 structure and it is placed
#   at the center of TOP structure

use GDS2;                                               # --- enable GDSII (GDS2) library
# strict checks variable declaration and subroutine argument consistency
use strict;
  
my $VERSION = "2018-09-03 23:42" ;                      # written by emacs time-stamp
## --------------------------------------------
##          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
   $filename .= '.gds';					# ---  Add '.gds' to (output) filename
							#     dot(.) connects strings
							# $a .= 'xx'; is equivalent to $a = $a . 'xx';

my $gds2File = new GDS2(-fileName=> '>'. $filename);	# ---  open new GDS2 (object) to write

$gds2File -> printInitLib(-name=>'LibraryName');	# --- always necessary for start

## ---------------------------------------------
##	 S T R U C T U R E   box-500
## ---------------------------------------------
$gds2File -> printBgnstr( -name=> 'box-500');		# --- Start new structure
$gds2File -> printBoundary(				# --- Boundary with four coordinate
    -xy=>  [-250, -250,					#     unit is in micron, micro meter
	     250, -250,
	     250,  250,
	    -250,  250],
    -layer=> 0,						# --- layer  (0 is really default)
    );
$gds2File -> printEndstr();				# --- End of this new structure
## ---------------------------------------------
##	 S T R U C T U R E   TOP
## ---------------------------------------------
$gds2File -> printBgnstr( -name=> 'TOP');		# --- Start another structure
  $gds2File -> printSref(				# --- Place structure reference
      -name => 'box-500',				# --- of name 'box-500
      -xy => [0,0]);					# --- at coordinate (0,0)
$gds2File -> printEndstr;				# --- End 'TOP' structure

$gds2File -> printEndlib();				# --- close library
__END__

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