An error occurred during export

When I export to a STL file I get this long list of errors. Please someone help me identify the solution.
undefined method `-’ for nil:NilClass

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:226:in `get_vertex_order’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:106:in `write_face_ascii’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:98:in `call’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:98:in `write_face’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:76:in `block in find_faces’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:73:in `each’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:73:in `find_faces’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:80:in `block in find_faces’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:73:in `each’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:73:in `find_faces’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:68:in `export’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:341:in `block in do_options’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/events.rb:82:in `call’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/events.rb:82:in `block in trigger_event’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/events.rb:78:in `each’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/events.rb:78:in `trigger_event’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:357:in `event_control_callback’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:311:in `callback_handler’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:269:in `block in add_callback’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:203:in `call’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:203:in `show_modal’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/SKUI/window.rb:203:in `show’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:362:in `do_options’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:375:in `main’

C:/Users/RJ/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/sketchup-stl/exporter.rb:395:in `block in module:Exporter

SketchUp:1:in`call’

Are you using This Exporter from the extension warehouse?

Pretty sure that he is. This part of the code looks odd, unless what it’s doing is legal in Ruby:

      def self.get_vertex_order(positions, face_normal)
        calculated_normal = (positions[1] - positions[0]).cross( (positions[2] - positions[0]) )
        order = [0, 1, 2]
        order.reverse! if calculated_normal.dot(face_normal) < 0
        order
      end

Surely that should be ‘return order’? The line that calls it is:

vertex_order = get_vertex_order(points, normal)

That part of the code seems to cope with faces that may not be the right way round. Setting the model to Monochrome and looking for reversed faces may help.

@ChrisFullmer If ‘return’ is needed I imagine it can be added to the .rb file.

Having said that, the line with the error is an earlier line.

Thank You gentlemen for knowing how to read this, I sure don’t. Just downloaded the exporter and will try again.

No. In Ruby the value of the last statement in a def is returned automatically. You need return only if coming back from an interior location in the method.

A better guess is that for some reason either positions[1] or positions[2] is nil, possibly even the whole positions array is nil, which would cause the same error. I don’t know why it would be nil, and alas, don’t have time or interest to debug that extension.