sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    How to get x,y,z texture position of a face?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 419 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.
    • renderizaR Offline
      renderiza
      last edited by

      Hi,

      I want to extract the x,y,z texture position so that Animatex animates texture from the original texture position because right now is not doing that. What is doing is starting from the x,y,z value user inputs. For example if the user input 2 on the x axis the the texture start from 2 then 4,6,8,10,12 and so on. This can have a negative impact if the user want to animate projected faces.

      What I want is for scrip to get the original x position of the texture lets say it is x=3 and the if user type 2 for the x speed then texture will start form 3 then 5,7,9,11,13 and so on.

      I hope that was clear if not please let me know and I will do better job explaining it.


      So far my problem is that when I try to retrieve texture position using the code below I get multiple x,y,z values (4 to be exact) instead of one.

      
      model = Sketchup.active_model
      entities = model.active_entities
      sel = model.selection[0] ;
      face = sel
      
      uv_helper = face.get_UVHelper true, true #, my_texture_writer # I get error if I don't put #
      face.outer_loop.vertices.each do |vert|
        uvq = uv_helper.get_front_UVQ(vert.position)
        puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
        UI.messagebox uvq
      end
      
      

      Anyways, I hope that with the help of the community this can be solved since animating projected textures is being requested. πŸ‘

      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        You have limited API access to texture information.
        You can easily find the XYZ of a face... BUT then matching the face's texture to that is the trip.
        Look at my 'TextureTools' to see how I reposition textures [Nudge etc] etc...
        http://sketchucation.com/forums/viewtopic.php?p=329765#p329765
        The XYZ [UVQ] data is got in a particular way...
        You don't actually need to know where the face.material.texture is 'located' initially IF you apply 'relative' offsets to its UVs [using a transformation] it can 'slide' across the face by that amount ?

        TIG

        1 Reply Last reply Reply Quote 0
        • renderizaR Offline
          renderiza
          last edited by

          Thank you TIG as always and I will look into your recommendation ASAP! πŸ‘

          [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

          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