Module: Gdsii::Access::PathType

Included in:
Path, Text
Defined in:
lib/gdsii/mixins.rb

Overview

Access PathType attribute

Instance Method Summary collapse

Instance Method Details

#pathtypeObject

Get the path type number (returns Fixnum).



103
# File 'lib/gdsii/mixins.rb', line 103

def pathtype() @records.get_data(GRT_PATHTYPE); end

#pathtype=(val) ⇒ Object

Set the type number (as Fixnum). Valid range is 0-2,4 (not 3):

  • 0: Square ended paths (default)

  • 1: Round ended

  • 2: Square ended, extended 1/2 width

  • 4: Variable length extensions (see #bgnextn and #endextn)



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/gdsii/mixins.rb', line 113

def pathtype=(val)
  record = @records.set(GRT_PATHTYPE, val)
  data_val = record.data_value
  if [0, 1, 2, 4].member?(data_val)
    if data_val != 4
      # Rip out begin/end extensions for pathtypes other than 4
      @records.delete_key(GRT_BGNEXTN)
      @records.delete_key(GRT_ENDEXTN)
    end
  else
    # If path type is not 0, 1, 2, or 4, then fail
    raise TypeError, "Path type #{data_val} is invalid; must be 0, 1, 2, or 4."
  end
end

#pathtype_recordObject

Get the path type record (returns Record).



98
# File 'lib/gdsii/mixins.rb', line 98

def pathtype_record() @records.get(GRT_PATHTYPE); end