Method: RADMesh::STL#initialize

Defined in:
lib/radmesh/stl.rb

#initialize(path = nil) ⇒ STL

Returns a new instance of STL.

Parameters:

  • path (String) (defaults to: nil)

    path to the STL file to load (optional)

Raises:

  • (IOError)

    when ADMesh cannot load the file

  • (NoMemoryError)

    when ADMesh cannot allocate empty STL struct

[View source]

32
33
34
35
36
37
38
39
40
# File 'lib/radmesh/stl.rb', line 32

def initialize(path = nil)
  @stl_ptr = FFI::MemoryPointer.new CADMesh::STLFile, 1
  @stl_value = CADMesh::STLFile.new @stl_ptr
  init if path.nil?
  open path unless path.nil?
  ObjectSpace.define_finalizer self, self.class.finalize(@stl_ptr)
  @exact = false
  @shared = false
end