Problem with UVHelper
-
When I try to experiment with UVHelper using this code"
` require 'sketchup.rb'def uvhelp
face=Sketchup.active_model.selection[0] tw = Sketchup::TextureWriter.new uvHelp = face.get_UVHelper true, true, tw pts = [] i = 0 face.outer_loop.vertices.each do |vert| pts[i] = vert.position pts[i+1] = uvHelp.get_front_UVQ(vert.position) i = i+2 end prompt = ["P1","UV1", "P2","UV2", "P3","UV3", "P4","UV4"] defaults = [pts[0], pts[1], pts[2], pts[3], pts[4], pts[5], pts[6], pts[7]] results = inputbox prompt, defaults, name
end
if( not file_loaded?("UVHelper.rb") )
UI.menu("Plugins").add_item($exStrings.GetString("UVHelper")) { uvhelp }
end
file_loaded("UVHelper.rb")`I get this error message:
Error: #<TypeError: wrong argument type (expected Sketchup::TextureWriter)>
C:/Program Files/Google/Google SketchUp 6/Plugins/UVHelper.rb:8:inget_UVHelper' C:/Program Files/Google/Google SketchUp 6/Plugins/UVHelper.rb:8:in
uvhelp'
C:/Program Files/Google/Google SketchUp 6/Plugins/UVHelper.rb:26
C:/Program Files/Google/Google SketchUp 6/Plugins/UVHelper.rb:26:in `call'It doesn't even like the call to face.get_UVHelper, which is straight from the examples.
-
That's odd. Typeing into the Ruby console I get the same error.
But I have used the same code in one of my own plugin and that works. I can't see what the difference might be. -
Ah! I see it now.
Use
tw = Sketchup.create_texture_writer
instead oftw = Sketchup::TextureWriter.new
.I'll add it to the list of errors in the manual: http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17047
Advertisement