sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Problem with UVHelper

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 293 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      spring.freediver
      last edited by spring.freediver

      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:in get_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.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        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.

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          Ah! I see it now.

          Use tw = Sketchup.create_texture_writer instead of tw = 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

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement