class Gdsii::Path
Represents a GDSII Path element. Most methods are from Element or from the various included Access module methods.
Public Class Methods
Generic method to create a path given a layer, datatype, pathtype, width, and series of alternating x/y coordinates. The default pathtype is 0.
path = Gdsii::Path.new(1, 0, 0, 100, [0,0, 1000,0, 1000,1000])
# File lib/gdsii/path.rb, line 49 def initialize(layer=nil, datatype=nil, pathtype=nil, width=nil, xy=nil) super() @records[GRT_PATH] = Record.new(GRT_PATH) self.layer = layer unless layer.nil? self.datatype = datatype unless datatype.nil? self.pathtype = (pathtype.nil?) ? 0 : pathtype self.width = width unless width.nil? self.xy = xy unless xy.nil? # Set a code block to validate a path record @validate = proc { # Check for begin/end extensions for pathtype == 4 if self.pathtype == 4 unless self.bgnextn and self.endextn raise "Begin/end extensions (#bgnextn= and #endextn=) required for path type 4" end end } yield self if block_given? end
Creates a path of type 0
# File lib/gdsii/path.rb, line 74 def Path.new0(layer=nil, datatype=nil, width=nil, xy=nil) Path.new(layer, datatype, 0, width, xy) {|p| yield p if block_given?} end
Creates a path of type 1
# File lib/gdsii/path.rb, line 81 def Path.new1(layer=nil, datatype=nil, width=nil, xy=nil) Path.new(layer, datatype, 1, width, xy) {|p| yield p if block_given?} end
Creates a path of type 2
# File lib/gdsii/path.rb, line 88 def Path.new2(layer=nil, datatype=nil, width=nil, xy=nil) Path.new(layer, datatype, 2, width, xy) {|p| yield p if block_given?} end
Creates a path of type 4; accepts begin/end extension values
path = Path.new4(1, 0, 100, 30, 30, [0,0, 1000,0, 1000,1000])
# File lib/gdsii/path.rb, line 97 def Path.new4(layer=nil, datatype=nil, width=nil, bgnextn=nil, endextn=nil, xy=nil) Path.new(layer, datatype, 4, width, xy) do |path| path.bgnextn = bgnextn path.endextn = endextn yield self if block_given? end end
Public Instance Methods
Get the beginning extension for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 122 def bgnextn(); @records.get_data(GRT_BGNEXTN); end
Set the beginning extension for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 113 def bgnextn=(val) ensure_pathtype_4 @records.set(GRT_BGNEXTN, val) end
Get the beginning extension record for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 128 def bgnextn_record(); @records.get(GRT_BGNEXTN); end
Get the ending extension for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 146 def endextn(); @records.get_data(GRT_ENDEXTN); end
Set the ending extension for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 137 def endextn=(val) ensure_pathtype_4 @records.set(GRT_ENDEXTN, val) end
Get the ending extension record for path type 4 (as Fixnum). Value is in database units.
# File lib/gdsii/path.rb, line 152 def endextn_record(); @records.get(GRT_ENDEXTN); end