# Using math and functions

## Video: Using math and functions

Now, let's go ahead and customize our couch a little bit further. We are going to add some sizing and pricing info to the couch so that way it's a little bit more interactive. So, let's go into our Component Options window and see what we have. Now we already have the name of it as well as our position in X, Y and Z. Well, let's go ahead and change that a little bit. So, I am going to go ahead and right- click over this and go into Dynamic Components>Component Attributes. And if we go in here we can see these are the attributes that we've added in and in terms of Position, well, we don't really need that.

## Using math and functions

Now, let's go ahead and customize our couch a little bit further. We are going to add some sizing and pricing info to the couch so that way it's a little bit more interactive. So, let's go into our Component Options window and see what we have. Now we already have the name of it as well as our position in X, Y and Z. Well, let's go ahead and change that a little bit. So, I am going to go ahead and right- click over this and go into Dynamic Components>Component Attributes. And if we go in here we can see these are the attributes that we've added in and in terms of Position, well, we don't really need that.

We don't really want people changing the position through the Options window; they can just move it using the Move tool. So, that's not something that we really want to use. But we can add in a couple of other attributes, and one is let's go ahead and have different size couches. So, let's take a look at a Size. So, in terms of Size, this is scaling, so we can have scale in X, which is red, Y green and Z, which is blue.

Now, if we are going to scale this couch, we are going to scale it along the green axis. So, let's ad in LenY as an attribute and let's take a look at how this works. So, I am going to move this over, so we can see it a little bit better here. And so when I select the couch, if we go to Length Y (LenY), we can type in a number. So, let's say we type in 80 and when we do, the couch scales, and when I typed in a 100, it will get longer. Okay, so I am going to go ahead and put this to 80. And this is a way to size out the length of our couch.

What we need to do is be able to give people the option of different size couches. So, we don't really want to allow them just to type in any length they want, we want to give them preset sizes. So, we can do that with that dropdown list that we were playing with before. So, let's go into Details and let's make the Display rule, Users can select from a list. So, in this I am going to go ahead and add a few options. So, let's add an option for 80 inches.

Let's do one that's a little bit longer, 96 inches and let's do one more, let's even a little bit longer, 108 inches. So, once I've done that and hit Apply, you will notice if I right-click over this and go into the Component Options window, now I have three lengths for this sofa. I can do 80, 96, I have to hit Apply here or a 108. Okay. So, let's go back to 80 here. But this really isn't a very descriptive length and numbers are something that customers really aren't going to understand.

So, let's go ahead and change this a little bit. We are going to go back into our Details window and for the Display label, let's just give it Size. And then for each of these options, we can just type in the words Small, Medium and Large, and hit Apply and let's go into our Dynamic Component options. So, now we have Small, instead of numbers we have size; Small, Medium and Large.

So, let's go back to Small and let's add in something else. Well, if we have couches that are of different sizes, the next thing that falls along is they're going to be different prices. So, let's go ahead and add in a pricing attribute. So, I am going to go ahead and Add attribute and if we go through this, I really don't have one for prize, so we can actually create one ourselves, enter a custom name. So, I am going to go ahead and click on this, and then we can just type in the word Price and that's going to be our price of our couch.

Now, for this well, we can just type in a number. Let's type in \$459 and if we go over here, we can say, well let's say Users can see this attribute, hit Apply and go into our Dynamic Components>Component Options window and you will see that we have a Price here, and Obviously, we don't want to let our customers determine the price of the couch, we want to set that. But if we go into our Large couch we -- well, there is more couch and it's going to cost more. So, we need to calculate a price.

So, let's go do that. I am going to go back to my Small couch here and we can calculate that by using a formula. So, probably the easiest formula to do is just price the couch by the inch. So 459/80 inches, which is the smallest couch, and then we can multiply that by the length. All I have to do is click on Length Y (LenY), so basically 459/80 that will give you the price per inch, and then we multiply by the actual number of inches.

So, that by itself should give a decent price. Now, notice how this becomes bold because it is a calculated price. So, if I go back into Component Options, we can see how when I go from Small to Medium, the price changes. But these prices really are -- I don't know how realistic they are, I mean how many people actually price couches by inch. Now, normally you'd want to set the price in increments. So, let's go ahead and do something a little bit more sophisticated.

I am going to go ahead and display formulas here. So, we've got 459/80 times length, but we don't want that. Let's go ahead and say the base price is 459 and let's add in a formula. So, I've got 459+. Well, plus what? Well, I need to decide whether the couch is small, medium or large and then add in a set amount for each increment. So, we can do that by using a function. So, in this function we can actually go through and find all sorts of functions.

We have Math and SketchUp functions and all that, but the ones I want to look at is the If-Then statement. Now, these are very similar to those that you will find in spreadsheets and so if you've used that sort of math, you should be familiar with these. But if you're not, it's actually pretty simple. Once I select this, what happens is it comes up here, it doesn't insert here yet, it just shows me this as reference and if I want, I can hit this button that says Insert. And when I do, it inserts that If-Then statement, but with default values.

So, I need to add in my actual tests and values. So, the first one here is test and this is going to be my IF LenY = what? Well, 96 is a Medium couch, so if it's equal to 96 then we are going to price it as a Medium couch. And so for a Medium couch, let's go ahead and add in the amount that we are going to price the Medium couch over the Small couch. So, let's add \$50 to the price of the couch if it's a Medium and if not well, we are just going to add nothing.

So, once I do that, I have a formula. So, it's the base price of the couch, the Small couch plus if it's 96 inches then I'm adding \$50. Let's see how this works. Go into Component Options, Small couch, go to Medium, hit Apply and notice how the Price goes up. Now, let's go to the Large couch, hit Apply and notice how that goes back to 459, that's because we haven't included a conditional for that.

Now, we can do this by just inserting another If-Then statement, or we can select what we already have, hit Copy, Ctrl+C, Command+C on the Apple and then Paste, which is Ctrl+V or Apple Command+V. And then once we have this, we say if Length of Y (LenY) is to -- well, how big is the Large couch, the Large or couch is 108 inches and how much more will the Large couch cost. Well, let's just add another \$100 to the 459 to make that real simple.

You can add Obviously, put whatever numbers you want. So, let's take look at what we have here. Price of the Small couch, if it's medium add 50, if it's Large, which is 108, add a 100. Seems to work, let's go ahead and take a look at it. Component Options window and you can see already that we have a Large, Medium and Small and it's actually working. So, here are some ways to add in user definable values. So, what we are doing here is we are adding in attributes that everybody else can use and we are actually adding in a little bit of intelligence.

So, the user can see different sizes of the couch as well as the different prices.

Show transcript

#### This video is part of

88 video lessons · 27601 viewers

Author

Expand all | Collapse all
1. ### Introduction

7m 18s
1. Welcome
1m 8s
2. Installing SketchUp
1m 12s
3. Starting SketchUp for the first time
47s
4. Using the exercise files
49s
5. Tips for Mac users
3m 22s
2. ### 1. Getting to Know the Interface

43m 52s
1. Interface basics
4m 42s
2m 38s
3. Navigating
3m 48s
4. Changing perspective
2m 51s
5. Walking around
3m 12s
6. Creating camera views
5m 15s
7m 59s
5m 50s
9. Creating Scenes
5m 9s
10. Setting preferences
2m 28s
3. ### 2. Manipulating Objects

22m 19s
1. Selecting and moving objects
6m 25s
2. Scaling and rotating objects
5m 36s
3. Manipulating faces and edges
4m 8s
6m 10s
4. ### 3. Drawing

48m 47s
1. Line tool fundamentals
5m 42s
2. Refining objects with the Line tool
3m 39s
3. Using the Rectangle tool
4m 44s
4. Pushing and pulling faces into 3D
5m 30s
5. Creating circles and polygons
6m 5s
6. Creating arcs
4m 0s
7. Using the Offset tool to create outlines
8m 33s
8. Using the Follow Me tool
3m 24s
9. Softening round edges
5m 16s
10. Creating 3D text
1m 54s
5. ### 4. Measuring and Labeling

16m 45s
1. Using the Tape Measure tool
4m 41s
2. Using the Protractor tool
7m 16s
3. Creating text labels
1m 7s
4. Using the Dimension tool
1m 18s
5. Creating sections
2m 23s
6. ### 5. Working with Components

20m 45s
1. The Component window
5m 32s
2. Creating components
3m 55s
3. Using the 3D Warehouse
3m 15s
2m 26s
5. Using the Interact tool
1m 54s
6. Using the Component Options window
3m 43s
7. ### 6. Organizing Scenes

25m 3s
1. Grouping objects
5m 42s
2. Working with layers
3m 27s
3. Creating layers
4m 20s
4. Using the Outliner
6m 42s
5. Hiding and unhiding objects
2m 48s
6. Locking and unlocking objects
2m 4s
8. ### 7. Creating Textures and Materials

41m 32s
1. Using the Materials Browser on a Mac
2m 49s
2. Applying materials
3m 2s
3. Editing materials
5m 4s
4. Creating materials
3m 19s
4m 38s
6. Applying bitmap images
2m 43s
7. Mapping curved objects
3m 39s
8. Projecting maps on curved objects
3m 27s
9. Importing floor plans
4m 27s
10. Modeling with floor plans
8m 24s
9. ### 8. Rendering and Animating

27m 11s
1. Applying styles
2m 26s
2. Editing styles
8m 30s
3. Outputting 2D bitmaps
3m 13s
4. Basic animation
5m 56s
7m 6s
10. ### 9. Creating Terrain Using Sandbox

20m 40s
1. Creating terrain from contours
6m 22s
2. Modeling objects with contours
1m 42s
3. Creating terrain from scratch
3m 40s
4. Sculpting with the Smoove tool
3m 2s
5. Stamping and draping objects on terrain
5m 54s
11. ### 10. Using Photo Match and Google Earth

15m 3s
3m 11s
2. Using Photo Match to align cameras
4m 30s
3. Modeling in Photo Match
7m 22s
12. ### 11. SketchUp Pro: Creating Dynamic Components

59m 46s
1. Using the Component Attributes window
6m 41s
2. Exposing component attributes
6m 0s
3. Using math and functions
8m 49s
4. Creating dynamic materials
7m 2s
5. Creating a dynamic staircase
8m 52s
6. Hiding objects dynamically
2m 58s
7. Configuring staircase rise and run
5m 21s
5m 24s
4m 55s
3m 44s
13. ### 12. SketchUp Pro: Working with the Solid Tools

15m 58s
1. Creating solids
2m 25s
2. Using Boolean operations (Union, Intersect, Subtract)
6m 46s
3. Working with Trim and Split
4m 45s
4. Creating outer shells
2m 2s
14. ### 13. SketchUp Pro: Importing and Exporting

21m 28s
6m 40s
2. Importing other 3D objects
3m 8s
3. Exporting objects
5m 39s
4. Exporting objects for rendering
6m 1s

14s
1. Goodbye
14s

### Start learning today

Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

### What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

### Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.

Exercise files

How to use exercise files.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.

Congratulations

You have completed Google SketchUp 8 Essential Training.

Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

How to use exercise files.

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

• Mark video as unwatched
• Mark ALL videos as unwatched
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

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.

Interactive transcripts

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.

## Are you sure you want to delete this note?

Thanks for signing up.

We’ll send you a confirmation email shortly.

• new course releases
• general communications
• special notices

Keep up with news, tips, and latest courses with emails from lynda.com.

• new course releases