Class: EagleCAD::Geometry::Pad
- Inherits:
-
Struct
- Object
- Struct
- EagleCAD::Geometry::Pad
- Defined in:
- lib/eaglecad/geometry.rb
Instance Attribute Summary collapse
-
#diameter ⇒ Object
Returns the value of attribute diameter.
-
#drill ⇒ Object
Returns the value of attribute drill.
-
#name ⇒ Object
Returns the value of attribute name.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#shape ⇒ Object
Returns the value of attribute shape.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#diameter ⇒ Object
Returns the value of attribute diameter
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def diameter @diameter end |
#drill ⇒ Object
Returns the value of attribute drill
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def drill @drill end |
#name ⇒ Object
Returns the value of attribute name
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def name @name end |
#origin ⇒ Object
Returns the value of attribute origin
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def origin @origin end |
#rotation ⇒ Object
Returns the value of attribute rotation
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def rotation @rotation end |
#shape ⇒ Object
Returns the value of attribute shape
66 67 68 |
# File 'lib/eaglecad/geometry.rb', line 66 def shape @shape end |
Class Method Details
.from_xml(element) ⇒ Object
67 68 69 70 |
# File 'lib/eaglecad/geometry.rb', line 67 def self.from_xml(element) origin = Geometry.point_from(element, 'x', 'y') Geometry::Pad.new(element.attributes['diameter'], element.attributes['drill'], element.attributes['name'], origin, element.attributes['rot'], element.attributes['shape']) end |
Instance Method Details
#to_xml ⇒ REXML::Element
73 74 75 76 77 78 |
# File 'lib/eaglecad/geometry.rb', line 73 def to_xml REXML::Element.new('pad').tap do |element| element.add_attributes({'name' => name, 'x' => Geometry.format(origin.x), 'y' => Geometry.format(origin.y), 'diameter' => diameter, 'drill' => drill, 'shape' => shape}) element.add_attribute('rot', rotation) unless 'R0' == rotation end end |