• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Problem with UVHelper

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 281 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 17 Mar 2009, 20:07

    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
    • T Offline
      thomthom
      last edited by 17 Mar 2009, 20:21

      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
      • T Offline
        thomthom
        last edited by 17 Mar 2009, 20:23

        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
        1 / 1
        • First post
          1/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement