Module: DXF

Defined in:
lib/dxf.rb,
lib/dxf/entity.rb,
lib/dxf/parser.rb,
lib/dxf/unparser.rb

Defined Under Namespace

Classes: Circle, Entity, Line, Parser, Unparser

Class Method Summary collapse

Class Method Details

.read(filename) ⇒ DXF

Read a DXF file

Parameters:

  • filename (String)

    The path to the file to read

Returns:

  • (DXF)

    the resulting DXF object



22
23
24
# File 'lib/dxf.rb', line 22

def self.read(filename)
  File.open(filename, 'r') {|f| DXF::Parser.new.parse(f) }
end

.write(filename, sketch, units = :mm) ⇒ Object

Export a Sketch to a DXF file

Parameters:

  • filename (String)

    The path to write to

  • sketch (Sketch)

    The Sketch to export

  • units (Symbol) (defaults to: :mm)

    Convert all values to the specified units (:inches or :mm)



15
16
17
# File 'lib/dxf.rb', line 15

def self.write(filename, sketch, units=:mm)
  File.open(filename, 'w') {|f| Unparser.new(units).unparse(f, sketch)}
end