class EagleCAD::Board::Signal

Attributes

air_wires_hidden[RW]
clearance_class[RW]
contact_references[R]
name[RW]
vias[R]

Public Class Methods

from_xml(element) click to toggle source
# File lib/eaglecad/board.rb, line 69
def self.from_xml(element)
    self.new(element.attributes['name']).tap do |signal|
        element.attributes.each do |name, value|
            case name
                when 'airwireshidden'
                    signal.air_wires_hidden = ('no' != value)
                when 'class'
                    signal.clearance_class = value.to_i
                when 'name'      # Ignore; already handled
                else
                    raise StandardError, "Unrecognized Signal element '#{element.name}'"
            end
        end

        element.elements.each do |element|
            case element.name
                when 'contactref'
                    signal.contact_references.push ContactReference.new element.attributes['element'], element.attributes['pad'], element.attributes['route'], element.attributes['routetag']
                when 'polygon', 'wire'
                    signal.push Geometry.from_xml(element)
                when 'via'
                    signal.vias.push Via.new Geometry.from_point(element), element.attributes['extent'], element.attributes['drill']
            end
        end
    end
end
new(name) click to toggle source
# File lib/eaglecad/board.rb, line 96
def initialize(name)
    @contact_references = []
    @name = name
    @vias = []
end