sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    SketchUp API docs

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 842 Views 3 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.
    • thomthomT Offline
      thomthom
      last edited by

      Hi
      I've just begun to look at the Ruby part of SketchUp.
      But I'm wondering, where do you go for your references?

      From this page: http://code.google.com/apis/sketchup/ it links to "reference documentation" (http://code.google.com/apis/sketchup/docs/developers_guide/index.html) and "wiki-style documentation" (http://groups.google.com/group/SketchUp-Plugins-Dev/web/google-sketchup-ruby-api)
      The wiki appear to contain more info.

      For instance, the Face object:
      The wiki page (http://groups.google.com/group/SketchUp-Plugins-Dev/web/Ruby-Face.html) list these methods

      all_connected,area, back_material, back_material= , classify_point, edges, followme, get_UVHelper, loops, mesh, normal, outer_loop, plane, position_material, pushpull, reverse!, vertices
      

      while the "reference documentation" only lists these:

      area, edges, followme, loops, mesh, normal, outer_loop, plane, pushpull, reverse!, vertices
      

      And none of them mention that you can use .material on the face. (just guessed it'd be there since I noticed there was an back_material.)

      And yet, on some topics I feels there's much missing. Such as position_material:

      @unknownuser said:

      position_material

      The position_material method is used to position a material on a face.
      Syntax

      face.position_material material, pt_array, on_front

      Arguments

      material - a Material object

      pt_array - an array of Point3d objects used to position the material

      o_front - true to position the texture on the front of the Face or false to position it on the back of the Face.
      Comments

      The pt_array must contain 2, 4, 6 or 8 points. The points are used in pairs to tell where a point in the texture image is positioned on the Face. The first point in each pair is a 3D point in the model. It should be a point on the Face. The second point in each pair of points is a 2D point that gives the (u,v) coordinates of a point in the image to match up with the 3D point.

      In this case, it doesn't explain what the difference between using 2,4,6 or 8 points is.

      So my question is: is there a different source of documentation? Is it just me that feel that the documentation is a bit sparse? From other types of scripting I'm used to more information than what I can find on the SU API.

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

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        I'm also following this with interest. I often pretend that I will Ruby someday, but now that DC's are out, I have taken to them rather quickly and I am quickly seeing things I would like to do that is well out of their current abilities. Enter Ruby....but I also get lost in the docs as they stand currently.

        Is there supposed to be better, newer, shinier docs coming out for SU7 soon?

        Chris

        (Hi Rick, Todd, and Tavi! I don't get into this forum to say hi to you guys very often...)

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

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

          bump?

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

          1 Reply Last reply Reply Quote 0
          • L Offline
            lenglel
            last edited by

            Yes, the documentation on this method is sparse, yet self-contradictory.
            From the explanation:
            "The second point in each pair of points is a >>> 2D <<< point that gives the (u,v) coordinates"
            From the example code:
            pt_array[1] = Geom:: >>> Point3d <<< .new(0,0,0)

            This is the point array I used in a call to position_material
            pt_array = []
            pt_array[0] = face.vertices[0]
            pt_array[1] = Geom::Point3d.new(0,0,0)
            pt_array[2] = face.vertices[1]
            pt_array[3] = Geom::Point3d.new(1,0,1)
            Apparently, the first two points set the location of the red pin, the next two
            set the green pin. I'm still working out the other two.

            This is the result I get from using the point array above...
            Textured from ruby plug-in

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

              The effect of how many sets you use are as following:

              1 set: The origin of the texture, width and height is taken from the material width and height

              2 sets: Origin and scale+alignment

              3 sets: Origin, scale+alignment, Skew

              4 sets: Origin, scale+alignment, Skew, Distortion

              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