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 "basic-lines.txt")

basic-lines

#!/usr/bin/perl -w
# GDSII generation 

use GDS2;						# --- enable GDSII (GDS2) library
# strict checks variable declaration and subroutine argument consistency
use strict;
# ------------------------------------------------
#   このファイルは実行可能ですが、意味のある図形は入っていません。枠だけです。
#   基本的な構造を説明するために用意しました
# ------------------------------------------------
my ($gds2File);                                         # ---  file handle

#		出力名を 「自分の名前.gds」 に設定します。ただし、もし、 .txt が付いていたら、それは先に削除します。
my $filename = $0;				# ---  set filename with the same as this script
   $filename =~ s/\.txt$//;			# ---  Strip '.txt' part
						#      =~ は結果を左辺に戻します
						#      s/文字列1/文字列2/ は 文字列1 を 文字列2
						#      に置換します
						#      . は任意の一文字に一致しますが、
						#      ここでは本当の . の文字なので \を付けます
						#      $ は行末を意味します

   $filename .= '.gds';		                # ---  Add '.gds' to (output) filename
# ------------------------------------------------
##                    基本構造
#  Structure (の定義) を並べる。Structure を並べる順序は任意。
#  ただし、Structure の中に Structure の記述は不可 (つまり入れ子の定義は不可)
#    Bgnstr ... Endstr
#    Bgnstr ... Endstr 
#  のように書く 
#  他で定義したものを Sref や Aref で参照するのは可能(良くある、それが普通)
# ------------------------------------------------

#    ファイルの書出し開始
$gds2File = new GDS2(-fileName=> '>'. $filename);	# ---  open new GDS2 (object) to write
#    ライブラリの開始、名前は何でも良い
$gds2File -> printInitLib(-name=>'LibraryName');	# --- always necessary for start
							#     名前は何でも良いです
#    
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'first');		# --- Structure first の開始

#        ここに structure (first) の中身

$gds2File -> printEndstr();				# --- Structure の終了
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'second');		# --- Structure second の開始

#        ここに structure (second) の中身

$gds2File -> printEndstr();				# --- Structure の終了
# -------------------------------------------------

#       ....
#       ....
#       ....
# -------------------------------------------------
$gds2File -> printBgnstr( -name=> 'top');		# --- Structure top の開始

#        ここに structure (top) の中身

$gds2File -> printEndstr();				# --- Structure の終了
# -------------------------------------------------

$gds2File -> printEndlib();				# --- close library
__END__
Last Update: Mon, 21 Feb 2022 10:13:01 GMT 1.66 2008/03/08