• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Transform texture using ruby

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 489 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.
  • A Offline
    alejandroerickson
    last edited by 1 Mar 2012, 10:07

    I'm new here and I can't decide whether this is a dev question or a newbie question - we'll see.

    I want to model a 1st order icosahedral geodesic sphere (I'm using Gavin Kistner's Geodesic_SketchUp.rb) with one of two images on each face. There are two types of triangular faces, one, e, being equilateral, and, i, is isosceles. Each e gets the first image (with the appropriate rotational symmetry), and i gets the other image. The images appear to span more than one face in the finished product, but that is something I can deal with separately.

    I am able (with the little ruby I have learned today) to apply material textures in Geodesic_SketchUp.rb, but I cannot position them properly. I have attached an icosahedron I did by hand, using the "pins" (only one type of face here), and the sketchup file.

    manually done.skp

    How do I automate the positioning of the texture? Does that work for the isosceles triangles too?

    edit: Should I look into the Image object and use the transparency to make the rectangle look triangular?


    manual texture.png

    1 Reply Last reply Reply Quote 0
    • T Offline
      TaffGoch
      last edited by 2 Mar 2012, 22:38

      Since you are dealing with polyhedra that employ identical faces, you can reduce the workload by using components.

      For the icosahedron, make each face a component, then rotate copies around the polyhedral axes.

      For the 2v icosahedron, you have an equilateral triangle and an isosceles triangle making up each icosahedron face, as you note. Make each icosahedron face "cluster" a component. Within that component, make the equilateral triangle a component, and rotate/copy it into the isosceles triangle position. Scale that copy along its "height" axis, to make it isosceles. Rotate the isosceles copy equally (120°) around the center of the equilateral component; twice.

      manually done; 2v.png
      Of course, none of this is automatic, nor ruby-scripted. The methodology merely takes advantage of the similarities inherent to the polyhedra. When complete, you can change the texture for 1 component, and all of the copies will replicate your changes -- thereby, reducing your workload.

      If what I wrote doesn't make sense (yet,) examine the attached model, to see if it helps. You should be able to replicate the steps, AS LONG AS you know how to (1) rotate around any axis (by mouse-cursor dragging) and (2) can change the axes of a component so that the trianglular face is the primary face of the component. (This allows easy scaling of the equilateral into an iscosceles triangle.)

      -Taff


      manually done; 2v.skp

      "Information is not knowledge." -- Albert Einstein

      1 Reply Last reply Reply Quote 0
      • A Offline
        alejandroerickson
        last edited by 3 Mar 2012, 22:12

        Thank you Taff. I am an admirerer of your work!

        I have so far modified Gavin's ruby script for this (mentioned above) and got it working, after figuring out how to fit the images onto the faces. I'll post my solution once I clean the code a little.

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

        Advertisement