Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
So now let's take one more look at how to use the Interact tool and that's in how to change colors. I've a very simple chair here and let's take a look at how this is built; I'm going to go into my Outliner here. I've a chair and the chair is comprised of a Base and Cushions. It's very similar to the couch that we had before and so if I want to change the color of this chair I really just want to change the color of these cushions. So let's go into our Component Attributes window here and I'm going to go ahead and select my Chair and I'm going to into Cushions here and I'm going to go ahead and Add an attribute for material.
Now if I want I can just type in the name of the material in the scene or the name of a hexadecimal value for color or just a standard SketchUp color. So if I wanted to I can make the chair red, I could make the chair green, or I can make the chair purple; really any one of those can work. So let's go ahead just use these values to change the value of the chair, so I'm going to go ahead and move this over so we can see what we're doing.
So in this case, I want to add another attribute here and I want to add an onClick attribute, but when I click I don't want to move or rotate anything, I want to change color. So we need to add in a function, so I'm going to go to Functions and let's go ahead and see what we've got. So we're going to scroll down to our onClick functions, let's go through then we have alert which gives us message. Now we don't want to animate, we don't go to a scene or redraw.
The one at the very bottom is the one that we want to use and that's called Set. So we can set any attribute to any state, so I'm going to ahead and select this and make sure I'm highlighting my box here and let's just go ahead and hit Insert. So what are we setting? Well let's go ahead and set our attribute. Now we want to make sure that we put the attribute name in quotes, but we're setting material, make sure I close my quotes. And what are we going to set it to? Well, we're going to set it to any one of the colors that we want.
So in this case, we can set it to Red and again, I'm putting this in quotes, Green, Purple or any other color that we want. In fact, this list can be as long as you want. And you can put in hexadecimal colors, you can put in the names of actual materials in the scene, really any valid material name can go in here. So once we hit Return we should have it in place. So let's go ahead and hit tools> Interact and then click on it.
So as I click on it I'm getting a little bit of an error here, and that's because I have Green -- I'd have a quote that's off here. So in this case I'm going to go ahead and hit Green, make sure, so it was actually trying to do a color called green purple, so there we go. Okay, so my quotes were off, so you need to make sure your quotes are in a good place here. So as I click through it, it clicks through all of the colors. Now this SET Command can be used for just about anything, it doesn't have to be used for materials, it can be used for any attribute you'll have.
We can use it to hide in real stuff you can use for Copies, you can use it for any custom variable that you have as well. So as you can see we've got a lot of versatility here with the Interact tool, so go ahead and figure out some really cool ways to use it.
Get unlimited access to all courses for just $25/month.Become a member
100 Video lessons · 11466 Viewers
56 Video lessons · 10426 Viewers
83 Video lessons · 8301 Viewers
109 Video lessons · 3758 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.