Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Now we pretty much have our fence ready to go. In fact, if I wanted to, I could just use this as is. But let's go ahead and make this a little bit more customizable. So what I am going to do is add in some additional attributes that will show up in our Component Options window and as you can see, when I pull up this window, there are no options to choose from. So let's go ahead and add in some. We are going to go back to Component Attributes, and start adding in some components that will show up for the user to work with.
Now the first one I want to work is the actual height of the fence. Now as you can see here, we have the lengths all specified. Now if I want to, I could actually restrict some of those. So for example, here in terms of scale, if I wanted to, I could actually scale this and you can see how the scaling is actually affecting this and I really don't want to do that. So I am actually going to go ahead and constrain the length of Y to =6.25 inches. So now when I scale this, it's always going to be the same depth.
Now in terms of height, I actually do want to be able to scale this so I have different height fences. Now I want to make this available to the user so the user can type in a very specific fence height. So let's go ahead over here to Details. We are going to highlight LenZ and here I am going to click on Details. And what this does is it tells us what we can do with this particular attribute. So what we want to do is I want to allow the user to edit it as a textbox and then we can give it a label.
So we can call it, for example, Fence Height and just hit Enter and now when we apply that, you can see that when we go into our Component Options window, we now have a variable called Fence Height. So I can just type in, say if I want it to be 48 inches, it will be exactly 48 inches. Now in addition to this, we also want to be able to control say for example, the spacing of the pickets. So let's go into Picket here, and we have our variable here for Spacing and we want to be able to expose that to the user.
User cannot see this attribute, hit Apply. Now what I want to do is actually have something here that is exposed to the user. This means I have to have it up here in the main component, in Fencing. So what I am going to do is go ahead and add an attribute here and I am going to enter a custom name and I am just going to type in PicketSpacing and then I can type in a number. So for example, here I've got 10.
And let's go ahead and say Users can edit as a textbox. So now when I have it up here and I select it, I go into my Component Options window, you can see now I have a PicketSpacing, but the problem is that when I change it, nothing happens. That's because it's not connected down here. This number 10 is not connected to the actual picket and its spacing. So what I have to do here is instead of typing the number in, I have to enter in the attributes. So all I have to do is hit = and then click on PicketSpacing.
So now the spacing here is actually the FencingPicketSpacing. Hit Enter and that should work. Now it's actually going to revert back to 10, but it's getting its 10 from here. So this should all now work. So now I have PicketSpacing, and I can say now instead of 10, it's 8 and so on and so forth. We will bring it back to 10 or whatever. We can do the same for some of the other options here. So we could actually do the same for, for example, the Post Spacing.
So here, instead of typing in a number, we can actually add in the attribute from here. So let's go ahead and add an attribute in here, custom name, and we'll call it PostSpacing, hit Enter, put in the number. I think I had 72 in there, and now for this PostSpacing, I am actually going to say = and then go up here. You can barely see it but here I am going to click on PostSpacing and then just hit Enter.
So now that I have this here, all I have to do is now expose this. So PostSpacing, go ahead and click here, Users can edit as a textbox, hit Apply and now when we go into our Component Options here, I have my PicketSpacing and my PostSpacing. So for example, if I were to scale this out a little bit more, I could put in my PostSpacing as say 48 and you can see now it actually affects the behavior of this component.
Great! So now we've got a couple more that we could actually add in. One of the ones I would like to add in would be the width of the pickets. So in order to do that, we actually have to figure out which variable controls the width. So right here, we have the Length of X, which is the width of that picket. So all I l have to do here is type in a different number. So for example, if I typed in 9, so =9, they would be 9 inches wide. If I typed in =3, they would be 3 inches wide.
Now I can again control this by an attribute that I can place up here. So let's go ahead and add in an attribute, custom name, and we will call it PicketWidth. Once I have that, then all I have to do is just a) type in the number, say 5.5 inches or so and then, come down here to Picket, find this Length of X and instead of =3, it's going to equal this attribute.
So now all I have to do is type in that and I can do whatever. Now in order to see this, I still need to expose it to the user. So I am going to go here to Details and let's expose it by saying User can edit as a textbox and say Apply. So you can see here now, I can just type in the width of my pickets, but actually pickets only come in set sizes. They only come in four, six and eight inches, which is actually 3.5, 5.5 and 7.5 because in lumber, they usually chop off about half of an inch.
So let's go ahead make this instead of a textbox, let's go ahead and select it from the list. So I am going to add an option here. We are going to say 4 inches, 6 inches, and 8 inches. Now notice that it already puts that value in and we can always change that but a four inch board in lumber-speak is actually 3.5 inch board, 6 inches is actually 5.5 and 8 inches is actually 7.5, and now that we have that, we actually have a list that determines the actual width of that particular picket.
So let's go ahead into Component Options here. You can see here we have PicketWidth and all I have to do is just select one, hit Apply, 8 inches and so on. So as you can see by adding in these Component Options, we can give the user complete control over the way that our fence behaves.
Get unlimited access to all courses for just $25/month.Become a member
109 Video lessons · 9793 Viewers
102 Video lessons · 7370 Viewers
56 Video lessons · 14384 Viewers
83 Video lessons · 11950 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.