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

    3D_text color

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 261 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.
    • J Offline
      JustJan366
      last edited by

      Hi,

      I am a real newbie when I comes to Sketchup and Ruby πŸ˜„ I was introduced to Sketchup and Ruby last week.

      I have been trying some of the tutorials, etc..., but I am (obviously) not really familiar with all details of the object model of Sketchup.

      I have an issue with putting colored text on a face (of a cube or just a 2d square).

      I can see the text, but applying a color or material to it, is not so obvious, as far as I can see (newbie πŸ˜„

      The only think I could find is applying material to each individual face of a 3d_text string. See code snippet at the end of the message.

      I hope there is an easier and more importantly faster way to do this πŸ˜„

      All help is welcome

      Kind regards,

      Jan

      ` grp = ent.add_group
      grp.entities.add_3d_text("My Labels", TextAlignCenter , "Verdana", false, false, 4.inch, 1.mm, 0, true, 1.mm)

      txtFaces = grp.entities.find_all{|f| f.is_a?(Sketchup::Face) }
      for f in txtFaces
      f.material=[0,0,255]
      end #for`

      Running Sketchup 2014 make, windows 8.1

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Hi Jan,

        So SketchUp faces have a front and a back. Appling a material to the Face colors the face front only. use Face.back_material to set the back material.

        In addition, when you create a Face on the XY plane, the Face faces down. In other words, the front of the face is facing down. If you look at the text from below, then you should see the blue side.

        Also, you could have applied the material to the grp object.

        Hope that helps.

        Hi

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @jim said:

          Also, you could have applied the material to the grp object.

          Yes, SketchUp entities have a default material of nil which means "unassigned, inherit from parent if possible."

          So set the grp material and SketchUp will display all the primitives in the group (whose material is unassigned,) using the group material.

          Also a color and a material are two separate classes. (You can create a material using a color and/or a texture image.)

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • J Offline
            JustJan366
            last edited by

            Jim/Dan,

            Thanks for the reply.

            Adding material (and back_material) to grp works for me.

            Understanding why this happens is even better.

            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