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

    Re-applying materials after scaling?

    Scheduled Pinned Locked Moved Plugins
    3 Posts 3 Posters 565 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.
    • RichMorinR Offline
      RichMorin
      last edited by

      Let's say I have a component with a vertical wood grain material. If I make the component larger in the vertical dimension, the material stretches. This makes the wood grain distort (eg, look "blurry").

      Using the UI, I can repair this damage, by sampling the material on a face in an unstretched component, then doing a "Paste all" into a vertical grain face in the stretched component. However, I can't figure out what part of the API would allow me to do this.

      Using the UI, I set up "before" and "after" files. I then compared a number of values, including the material's color, display_name, and name. None of these appear to change.

      The object ID for the material's texture changes, but I see no change in the texture's height, width, image_height, image_width, average_color, or filename.

      What am I missing?

      -r

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

        http://code.google.com/apis/sketchup/docs/ourdoc/ uvhelper.html and http://code.google.com/apis/sketchup/docs/ourdoc/face.html# get_UVHelper look like they might help, BUT these really only apply to faces not instances... there is no equivalent instance.get_UVHelper method.

        You are applying the texture to faces in the component-instance itself NOT a face ?
        So such textures will inevitably scale [as also when they're applied directly to a face inside a definition].

        If it were a group then grouping that group itself [to keep geometry separated] then exploding the group inside it will revert the scaling of the texture as the container group is not itself scaled - you could remember the original group's name/desc/attributes beforehand and then apply them to the new group...

        The somewhat simpler fix with components is to have 'sets' of similar components, partially sized initially with size ranges - say c0-12, c12-24, c24-36, c36-48 etc... [where it's 0"-12" say]: then you'd swap the initial instance's definition for one that is nearest the scaled size, and then the textures will adjust slightly, but to a limited extent which will have little visible variation. So for example you initially place c0-12 and it's to be scaled to 30" long - a simple lookup method says " if dim>24 and dim<=36 then defn='c24-36'", so you set your instance.definition=definitions[defn] and then the subsequent scaling of that instance's textures is now acceptable because the definition was already made near to that size 🤓

        TIG

        1 Reply Last reply Reply Quote 0
        • Dave RD Offline
          Dave R
          last edited by

          .

          Etaoin Shrdlu

          %

          (THERE'S NO PLACE LIKE)

          G28 X0.0 Y0.0 Z0.0

          M30

          %

          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