Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a drop-down list

From: Google SketchUp Pro: Tools and Techniques

Video: Creating a drop-down list

In addition to being able to type in numbers for values, we also want to be able to select them from a list so we can add things like presets, sizes and colors. Things like furniture, like this couch, can usually come in different sizes, such as small, medium and large. Now we can actually give the user the option of selecting a different sized couch, just by giving them a pull-down menu in their Component Options window. So, I'm working with a file here called Sofa_02, which is a file that we used in the last lesson.

Creating a drop-down list

In addition to being able to type in numbers for values, we also want to be able to select them from a list so we can add things like presets, sizes and colors. Things like furniture, like this couch, can usually come in different sizes, such as small, medium and large. Now we can actually give the user the option of selecting a different sized couch, just by giving them a pull-down menu in their Component Options window. So, I'm working with a file here called Sofa_02, which is a file that we used in the last lesson.

So I'm going to go ahead into Dynamic Components and select Component Attributes. Now you'll see we have all of the same attributes we set in the last lesson. We have Position as well as the custom attributes such as Price. Now, typically, we don't want to give the user the option of changing the position of the couch through a menu. They can just use the Move tool. So I'm going to delete that. So I'm going to go ahead and select that, hit Delete and say OK and do that for both of these. So now that I've cleared that out, if we look at our Dynamic Components' Component Options window, you'll see that basically all we have is a price of the couch.

Now let's go ahead and add in a size. Now we can create different sized couches by basically stretching it along this green axis, which is our Y axis. So what we want to do is add in an attribute here called length Y or LenY. You could see that's green, which matches the axis that we want to stretch it on. All we really have to do is just type in a number such as 80 and you can see the couch stretches. Or if we type in a larger number, you can see it stretches bigger.

So we can use this as the basis for creating sizes for the different couches. Now we do this by going into our Details window. So let's go ahead into Details and we have to have a display rule. But what we want is we want users to be able to select that option from a list. So let's go ahead and select that and then just add an option. So we can type in our first size, which is 80. If we hit Enter, notice how it enters it for the Value field. Now this List Option is actually the name we give the user. The value is the actual number that's plugged in, the actual amount.

So let's go ahead and type in one for another one. Let's say we want a 96-inch wide couch and we want another big couch. Let's say 108 inches. So once we hit Apply, notice what we have. Let's go ahead into our Component Options window and you can see we have a second value here called Length of Y. Well, that's not all of that descriptive but let's see how this works. We can say 80 and hit Apply. You see we have a 80-inch couch, a 108-inch couch or a 96-inch couch.

Well, we really want to make this a little bit more user-friendly. Length of Y isn't all that descriptive and the size of the couch in inches isn't as descriptive as we can be. So I'm going to close this. Let's go back to our Component Attributes window and let's go into Details again. So for the List Options, all we have to do is change the name here, Small, Medium and Large. Then for the Display label, instead of Length Y, let's go ahead and type Size.

So once we hit Apply, we can go back into our Component Options window. You'll see now we have a sofa that is small, medium and large. Now, one of the things I'm also noticing here is that well, when we have different sized couches, the price itself is actually going to change. So what we can do is calculate a new price based upon the size of the couch.

We can do it a number of different ways. Let me show you one really simple way. And that's to basically take the price of the couch, which equals $459 and that's for the small couch. So we divide it by 80 and that gives us a price per inch. Then we just multiply that by the total number of inches, which would be Length of Y. We hit that and then basically, depending upon the size of the couch, it will calculate a price. So let's go back into Component Options.

Let's see how that works. So when I do small couch, it's still $459. But if we do medium or large couch, it will go ahead and scale it accordingly. Now this formula is actually pretty crude. It prices the couch by the inch. Now, typically, couches aren't priced that way. They really have set prices based upon the small, medium and large sizes. So we can actually do a little bit more sophisticated math using functions.

Let me show you how that works. So what I'm going to do is I'm just going to go ahead and go back to the base price of the couch. It's going to be =459+ and then we have to see what size the couch is. Well, we can use what's called an if-then statement. If we go into Functions here, you can see we actually have spreadsheet functions, very similar to functions you find in Excel or any other type of spreadsheet. If you scroll down, you'll see we actually have all sorts of different functions from square roots to SketchUp functions, which allows you to determine things about geometry of an object, but the ones we're looking for are logical functions.

So I want to have an if-then statement. So I'm just going to go ahead and click on this. What that does is actually just gives us a reference here. I want to make sure my cursor is here, 459+, and then I'm just going to hit Insert, plus the result of this if-then statement. Well, what are we testing? Well, we're going to test to see if the LenY=96, which is our medium sized couch. If it is, we're going to add 50 bucks to the price of the couch.

If it's not, we're going to add nothing to the price of the couch. So let's take a look at this again. So, 459, the base price of the couch, plus if the length is 96 inches, then we're adding 50 bucks. If not, we're adding nothing. So let's see how that works. We're going to go ahead into our Dynamic Components' Component Options. So now let's go to a small couch. Hit Apply. That's $459. Medium couch should be 459+50, which is 509, and that works.

Let's go to the large couch and you'll see well, it goes back to 459. Well, what we have to do here is add in one more if-then statement. What we're going to do is go ahead and add in a plus sign here, and we're going to do another if-then. So I'm just going to keep this one up, hit Insert. Let's go ahead and do this one more time. So if, okay, test. So if LenY=, and our largest size couch is 108, then we're going to add $100 to the price rather than 50.

If it's not equal to that, well, we're going to add nothing to the price. So now that we have all of those, we should have an accurate pricing model. So again, Dynamic Components > Component Options and let's see how this works. Well, obviously it's already calculated. We have a price of 559 for the large sofa, the small sofa is 459, the medium sofa is 509. So as you can see, we can get very sophisticated behaviors just through simple formulas.

So what we've done is we've added in a selection list that allows us to select a small, medium or large couch, and now, using if-then statements, we've actually calculated accurate prices for the couch, depending upon the size. So as you continue we can get very sophisticated in how our dynamic components behave and report data back to the user.

Show transcript

This video is part of

Image for Google SketchUp Pro: Tools and Techniques
Google SketchUp Pro: Tools and Techniques

38 video lessons · 9833 viewers

George Maestri
Author

 
Expand all | Collapse all
  1. 3m 33s
    1. Welcome
      1m 4s
    2. Using the exercise files
      24s
    3. Important Mac and PC differences
      2m 5s
  2. 9m 41s
    1. The Component Options window
      3m 32s
    2. Using the Interact tool
      1m 54s
    3. Using metadata in the Component Options window
      4m 15s
  3. 1h 6m
    1. Using the Component Attributes window
      4m 46s
    2. Exposing component attributes
      6m 0s
    3. Creating a drop-down list
      8m 42s
    4. Creating dynamic materials
      8m 29s
    5. Creating a dynamic picket fence
      2m 10s
    6. Creating a dynamic picket fence: Assembling the components
      4m 54s
    7. Creating a dynamic picket fence: Making pickets multiply
      6m 11s
    8. Creating a dynamic picket fence: Making fence posts multiply
      4m 0s
    9. Creating a dynamic picket fence: Customizing attributes
      8m 18s
    10. Adding interactivity: Motion
      5m 25s
    11. Adding interactivity: Rotation
      4m 10s
    12. Adding interactivity: Changing colors
      3m 45s
  4. 39m 37s
    1. The LayOut interface
      2m 56s
    2. Drawing lines and arcs
      4m 33s
    3. Drawing rectangles
      2m 22s
    4. Drawing circles and polygons
      2m 31s
    5. Modifying line styles and color
      3m 2s
    6. Working with text
      3m 0s
    7. Inserting SketchUp models
      4m 33s
    8. Manipulating SketchUp models
      3m 30s
    9. Working with dimensions
      2m 17s
    10. Arranging and grouping objects
      3m 5s
    11. Creating scrapbooks
      3m 11s
    12. Creating presentations
      2m 40s
    13. Exporting and printing
      1m 57s
  5. 6m 40s
    1. The Style Builder interface
      2m 5s
    2. Working with strokes
      4m 35s
  6. 19m 15s
    1. Importing objects from AutoCAD
      6m 37s
    2. Importing other 3D objects
      3m 14s
    3. Exporting objects
      4m 38s
    4. Exporting objects for rendering
      4m 46s
  7. 19s
    1. Goodbye
      19s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
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.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

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

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

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.

Join now "Already a member? Log in

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.


Mark all as unwatched Cancel

Congratulations

You have completed Google SketchUp Pro: Tools and Techniques.

Return to your organization's learning portal to continue training, or close this page.


OK
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.

Get started

Already a member?

Become a member to like this course.

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

Get started

Already a member?

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

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

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.

Continue to classic layout Stay on new layout
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.

Control your viewing experience

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?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

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

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.