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 "rotate-rectangle.txt")

rotate-rectangle

#!/usr/bin/perl -w
# GDSII generation for rotated rectangle
use GDS2;
use strict;

require './rotate.pm';

our @ARGS;
our %opts;

my($VERSION);
$VERSION = "2019-07-15 08:52" ; # written by emacs time-stamp

#    perl  rotate-rectangle -h と入力した時の表示 (help)
# ------------------------------------------------

sub usage() {
    print <<HELP;
  $0:  
       Generate GDSII rotated rectangle
  Usage	   
      perl $0 [-h] 
  Where
    -h	show this help
HELP
}
## --------------------------------------------
##          M A I N  R O U T I N E 
## --------------------------------------------
my ($gds2File);                                         # ---  file handle
my $filename = $0;                                      # ---  set filename with the same as this script
   $filename =~ s/.txt$//;                              # ---  Strip '.txt' part
   $filename .= '.gds';                                 #      . connects string

$gds2File = new GDS2(-fileName=> '>'. $filename);       # ---  open new GDS2 (object) to write
my ($x1, $y1) = (-100, -50);				# --- 矩形の座標
my ($x2, $y2) = ( 150,  70);

my ($angle)   = 30;					# --- 回転角

my @LL = rotate::rotate($x1, $y1, $angle);		# --- 原点を中心に回転した座標を求める
my @UL = rotate::rotate($x1, $y2, $angle);		# --- 同上 .. (x, y) の組
my @UR = rotate::rotate($x2, $y2, $angle);
my @LR = rotate::rotate($x2, $y1, $angle);

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

$gds2File -> printBgnstr( -name => 'rotated');
$gds2File -> printBoundary (
    -xy => [@LL, @UL, @UR, @LR]				# --- 予め求めた座標を並べる
    );
$gds2File -> printEndstr();

$gds2File -> printEndlib();

__END__
; ここから下は、 Emacs 用の設定、範囲を指定してから M-x eval-region RET する
(require 'time-stamp)
(add-hook 'write-file-hooks 'time-stamp)
(setq time-stamp-active t)
;; (setq time-stamp-time-zone "UTC")
(setq time-stamp-time-zone nil)
(setq time-stamp-format "%04y-%02m-%02d %02H:%02M");
(setq time-stamp-start "$VERSION = \"") ;
(setq time-stamp-end "\"") ;
(setq time-stamp-line-limit 20) ; ; default is 8
Last Update: Mon, 21 Feb 2022 10:13:01 GMT 1.66 2008/03/08