From the course: AutoCAD 2022 Essential Training

Creating a simple block with attributes - AutoCAD Tutorial

From the course: AutoCAD 2022 Essential Training

Start my 1-month free trial

Creating a simple block with attributes

- [Instructor] We're starting a new chapter now and we're going to take a look at attributes and tables in AutoCAD. We have a new drawing for you. It's called attributes.dwg, and you can download it from the library to follow along with the videos as usual. You'll also recognize the drawing from previous videos and previous chapters too. Now what we're going to do in this particular drawing is switch off a few layers so that it's not so busy. Just before we create a small block with some attributes. So we're going to go to the home tab on the ribbon, layers panel here, and we're going to click on the fly out here and slide all the way up with the slider bar. And we want this layer here to be frozen. A- O1OD_DIM. So when you click on the sun symbol there you'll see that all your dimensions and dimension annotation disappears on the drawing. Just hit ESC to lose the dropdown menu. And it just allows us to work with the geometry rather than anything else at the moment. We can switch it back on later. No problem at all. Now what we're also going to do is go back to the layer, drop down. And as we're creating a block, we want to make sure that our objects that we use to create the block are on layer zero. So I'm going to click on the zero there and make the default layer zero, the current drafting layer. Now you'll remember in the previous chapter if we create a block on layer zero it automatically adopts the current drafting layer when you bring it into the drawing. We're going to zoom in on the hot desking area here. And you'll remember, we created an array of our little executive chairs. You can see the array there. So I'm going to click on that first, go to the home tab on the ribbon and click on explode on the modified panel. We don't need the array anymore. And what we're also going to do once we've exploded the array is we're going to remove all of these here. So we're removing the three chairs and the three lines that make up the hot desks. So we'll just delete those. You can use erase or just hit the Delete key on the keyboard. Zoom and pan over here, like so to about here. And then you can see the chair and you can see the line. Now we're going to explode the chair block. Now you think to yourself why are we exploding the chair block? Well, we're going to create a block with attributes that represents that entire hot desking workstation and I'll show you exactly how. So click on the chair, like, so, and again, hit explode here on the modified panel and that'll explode. And when you click on one of these now you'll see it's on layer zero anyway. That's great, no problem at all. We don't need to worry about that. And then also here we click on this line and we click on the dropdown here and we go up here to our zero layer and put it on the zero. Let's click on the zero. That'll put the line on the zero layer as well and just hit ESC now to de-select. Now we're going to basically create a rectangle here that represents a desk. And the quickest and easiest way to do this is to utilize our line we've got here. So we're going to go up to the Polyline command on the drawer panel, and I'm going to come from this object snap click and just work my way around creating a Polyline there like so, and to finish. You remember Polyline edits from previously in the course. So we type PE, Polyline edit and enter. We select our Polyline here, that we've just created there. We select Join and we joined the line segment to it there, press enter to finish once like that. That'll take us back to the Polyline edit menu and then enter to close the command. We now have a rectangle that represents a desk. We now have a group of arcs lines, circles, et cetera that represent a chair. Now, the benefit we have is we can now create a block but we're going to create a block with attributes. We're going to add an attribute to this desk. And it's just going to be the desk number. So we go to the insert tab on the ribbon and then we're going to go here to our block definition panel and define attributes. This will bring up our attribute definition, dialog box. Now, one of the things that we are going to do here is utilize that geometric center snap that we've used previously. And the reason that I've made this into a rectangular Polyline is so that we can do that. So our tag here will be desk number. And when you create attributes, no spaces it doesn't like spaces. So I've just put desk and over desk number. The prompt will be, literally as if you were typing the prompt. So I normally do that desk number and then a question mark and the default might be say D999. That's the default value that it will put into the attribute for us. Now, the justification here, I want to be middle center. I want it in the middle of the desk and the text style, my suggestion here maybe you've got multi leaders, labels, title, layout, et cetera. I would potentially use something like labels, model 250 millimeters here because you want it to be that size on your particular drawing. And the good thing about labels model 250 millimeters is it's not annotative. So it will always be 250 millimeters high in the model tab. Doesn't matter what annotation scale or viewport scale you're using. It'll always stay the same height, 250 in the model tab. That's great, and you can see the text light there is grayed out because it's taken on board that height of the textile. You don't want this to be annotative at all. The insertion point, we will specify that on screen and it'll lock the position as well. So when you bring the attribute in it's going to specify that on the screen we'll use the geometric center snap. Rotation zero, that's great. We want it horizontal. That's all good. So when I click on, okay now there's my desk number attribute. Now you'll see, it's got a left hand crosshair kind of justification going on there. Don't worry about that. We now need to specify where it's going to go on the desk. So this is now a shift and a right click to bring up our override snaps. And we want geometric center, like I mentioned. There's our geometric center. There's our desk number attribute in place. Now we need to select everything and make our workstation block. So like we've done previously, block definition panel on the insert tab, on the ribbon click on the flyer and create block. And this time it will be office, workstation will be the name type that in try not to spell it incorrectly always bad deceit blocks with badly spelt names. And we're going to go for a pick point here like so. So the point I'm going to pick is going to be the point snap there. Now, the reason I'm using the midpoint snap there is I can then snap to the middle of any space I want to drop it into. Now thinking about it midpoint might not be the best object snap to use. Why is that? Well, if you think about it you normally put a desk into a corner. So maybe if we went for say an end point snap there on the end point corner there of the desk that might be better. As you can see the X and Y values would not be easy to work out. What we're going to do is select the objects hit the select objects icon there and we're going to select the desk. Don't forget the attributes and everything that makes up your chair. So it's all one object when it becomes a block. So it's a block with a desk, a chair, and a desk number. What I can do then is presented to confirm my selection and there's my little preview going on there. Now we're going to convert this to block much much easier that way. And then the behavior, we don't want it to be an assertive but we do want to scale uniformly and we do want to allow exploding. I've mentioned it before, if you allow exploding in your blocks it means you can explode them update them and create a different block from your block. Again, millimeters, hyperlink we don't need but you can add a hyperlink like a URL or something to your blocks if you want to. We are not going to open this in the block editor so we can unset open in block editor. Now, as soon as I click on, okay, that becomes a block but it's also prompting us now what is our desk number attribute? Now you'll find that this comes up with any block with attributes when you insert the block into the drawing. So I'm going to click on OK. And there's my D999 attribute. So when I click on that, can you see it's all one object or one block, but you've now created a block with an attribute. With that selected, if I right click and go to properties, you'll see that there's the attribute there. Desk number D999. You've got all the other information about the block as we've had in previous videos where we've used blocks. The one thing I will do is with that still selected now, I'll go to the home tab on the ribbon. Zero is our current drafting layer. So it brought the block in on the zero layer ideally needs to be on the furniture layer. So we'll just pop it on the furniture layer. Hit ESC to de-select and there's our little hot desks all in place like so. The benefit you have now is you can select the block and there's the grip there. So I select that grip and I can right click move, right click, and copy to use that grip. And I can just drop a block into each hot desking area and enter to finish. You'll also notice there is a slight gap there because when we initially created our hot desking area there we just extended the line across to the wall. Now we've got four desks, four chairs all representing the same size desk and chair et cetera. Unfortunately, where I've obviously copied them. They've all got the same attributes. So the desk numbers would need to change. But we'll look at that in the next video. And remember when you're working with grip edits like we've just done, to put the desks across the hot desk in area you want to just hit ESC a couple of times to de-select the block you were working with.

Contents