TT::Settings with Length cause errors

Issue #18 new
Thomas Thomassen repo owner created an issue

Centercode

Cannot catch any errors in Sketchup::read_default, as the exceptions are raised on the C-side by the use of eval.

Weird Example:

Sketchup.write_default("TEST","test",1.0)
x = Sketchup.read_default("TEST","test",1.0)

no issues, upon read, a Float is returned. But try to send a Length ...

Sketchup.write_default("TEST","test",1.0.to_l)
x = Sketchup.read_default("TEST","test",1.0.to_l)

Error: #<SyntaxError: <main>: syntax error, unexpected tIDENTIFIER, expecting end-of-input
~ 25mm
      ^>

Also, TTLib2, "settings.rb", line 57

x = x.to_l if default.is_a?(Length)

Your passing Float literals from the QuadFace plugin. The is_a?(Length) would work prior to v14, but Length is no longer a subclass of Float.

Perhaps safer now as:

x = x.to_l if default.is_a?(Numeric) && x.respond_to?(:to_l)

Comments (3)

  1. Thomas Thomassen reporter

    Workaround:

    TT::Plugins::QuadFaceTools.settings[:uv_u_scale] = 1.0
    TT::Plugins::QuadFaceTools.settings[:uv_v_scale] = 1.0
    
  2. Log in to comment