Best Practices Course – Week 21 Part 2 – © copyright 2013 by Eric Bobrow
BEST PRACTICES COURSE – WEEK 21 – Creating and Customizing Library Parts
PART 2 – Making 2D Symbols Parametric
Hello, this is Eric Bobrow. This is the second section of my three part ArchiCAD video training on creating custom library objects. In the first section, we created a custom 2D symbol with a line, an arc, and a text; and also a 3D object using a slab and a wall. Then we customized them to have hotspots that matched the geometry better for precise placement and made the text for the symbol editable or parametric so that it can be changed each time you inserted it. In this section, we will make the 2D symbol smarter so that we can change the text size as well and possibly have a variation with two lines of text. Let’s get started. [0:00:43]
Now what about the size of the text? It would be nice if we could actually switch the size of the text. Perhaps if we were doing this at a different scale, let’s say we went down to a smaller scale like this, now this text is maybe going to be a little bit too large. So how can we control the size of the text? Well if I select this and open up the script again – I just did that Command+Option+O shortcut, you’ll see that above where I put in the text contents there something that says there’s a paragraph of text and it’s using a particular style which has a designation here. [0:01:27]
Now we don’t have to worry about this much, I just want to show you that above the paragraph there’s this thing that says “Define Style 2”. You don’t really have to understand this much, just know that the style 2 command includes definitions of the name of the style – actually so this is the AC style 1 – and the font, and then a size. Now this is a rather odd looking size, it says 8 feet 1.222 inches. Now what’s happening is ArchiCAD is putting in a number in feet and inches because I’m in the U.S., but it’s actually designating it in terms of how many meters that is. So if you think about a meter being a little over 3 feet, this is about 2.5 meters. [0:02:13]
And I could replace this in fact with the number 2.5 and it’s going to be pretty much the same value. And I will demonstrate that by saving this and then going back to the floor plan. We don’t really see any change, but if I go back here and change it from 2.5 let’s say to 3 and save, then we are going to see this get a little bigger. So notice how this text got bigger. So let me go back here again and say that this number here determines the size of the text in millimeters. So originally it was specified in terms of feet, and when you divide that number of feet by 1 meter you get a raw, real number. And this is actually going to be the size in millimeters on the plan. [0:03:05]
Now I can make this a parameter so that we can switch it around, so let me go to the parameters and we’re going to add a new parameter that’s called “text size”. And this one, instead of being actually text, I’m going to make it what’s called a “real number”. Look for this particular symbol, third one in, it says “real number” at the top. And then I will just say “text size”, and let’s just put it back to 2.5 which was the text size that I had originally, and just save this. So I hit save, and you can see when I open this up here, this custom symbol – here is the 2.5. Let’s just make this 2, and we’re going to see how it adjusts. [0:03:57]
Let’s open this up here. I made the text size number here, but I didn’t go back into the script to change this. So I need to put in text size in place of the number. So this is now a parameter, as is this, that are variables that can change. So these are the two things that we are going to go into, we’re not going to go any deeper into this complex coding, just this thing where we are placing in variable contents and possibly a size. Now having saved this, we are going to see that now this text can be changed. I’ll just open it up and we can change the size right here on the fly. If I make it too big, you are going to see what happens. If I make it much smaller, you can see how it adjusts. [0:04:44]
Now it can be easily set to whatever number I feel is best. Now this is in millimeters, which is fine if you’re used to the metric system, but in the U.S. we do specify our text in points which is an old fashioned setting used in typography. But it’s widely used in terms of computer tools. So let’s make an adjustment so that if you’re in the U.S. you can put in a familiar number of points. [0:05:15]
To explain that, let me just copy some text in here and this will give you a formula that you can recall. So I will go to the Text tool and paste in this formula here. Let’s just make this much smaller. We will drag this over here and maybe make it a little smaller for this. There are 72 points in an inch, so that’s just an odd number based on old typography standards. And as you should know there are 25.4 mm in an inch. So the text that I used originally, this text block, was set to be 7 point text. It worked nicely when we were at quarter inch scale. Let’s just switch this back to quarter inch scale. Or 1 to 48, you can see that’s a nice size there. [0:06:24]
Let me make this text block here a little bit bigger, because I’ve made it rather small. Let’s make it so that we can read it here. Maybe we’ll make it the same 7 points that the other text is. So the 7 point text is 7 out of 72 points in an inch, so that’s about 1/10 of an inch. If we multiply that by millimeters, we are going to get 2.47 mm. So remember when I put in 2.5, it was virtually the same, because it was essentially within a couple percent of the same size. [0:07:03]
If we want to be able to input the text in the object in points, then we can do a little mathematics in the object. So I’m going to just make another quick change here, and you’ll see that where it says “text size”, I’m going to say take the text size, divide it by 72, and then multiply it by 25.4. So this will take this number that I’ve put in, just a raw number, and it will convert it to millimeters. So I can put in points now and it will work. So let’s just save this and we’ll see how the object adjusts. Now the object has gotten way too small or the text in it. When I open it up and change the text from 2 to let’s say 7, you can see how now the text is exactly the same. [0:07:55]
In fact, if I make this to say the same capital letters, you will see that it looks just the same as above. So I’ve just made this text smart enough that we can put it in in a familiar unit size for the U.S. You don’t need that last little bit of editing that I did, this thing for putting in this division and multiplication if you’re working in metric and you prefer to just stay in millimeters. But these are the two bits of editing, the only two bits of editing that I’ve done in the script. And you basically have to look for the style to find where to put this text size, and it was just right after the font. In other words Arial. And the original fixed text, which was in quotes, “ABC123”, that I replaced this with just a variable that I had setup in the parameters. [0:08:48]
In the parameters I’ve created these two new variables and specified their types. This is a real number, and this is a text field, and this is giving me the controls that I need. Let’s take a look, what if we wanted to have multiple lines of text in the same object? How can we go a little bit further than that? So let me take these elements here and I will drag a copy of them down and go to the text here. And we’ll put in a second line. So now, because I had it anchored at the center, remember I had set the anchoring at the center, it kept the centering within the symbol, so it works pretty well as long as the text doesn’t get to be too many characters. [0:09:44]
But now let’s take a look at when we save this as a new object. So go to the File menu, Libraries and Objects, Save Selection As, Object. And we’ll just call this “new symbol 3”. And say OK. And now if we place that, we go back to the Object tool and place that, we’re going to see that we have the same issue or the same thing with the extra hotspots. Let’s go in and clean that up. I’m going to use the keyboard shortcut to open the object. We’re going to go to the compatibility options, turn off the hotspot on bounding box, and then we will go to the 2D script and let’s take a quick look. [0:10:27]
You’ll notice that here is the first line, ABC123, and here is the second line, line two. And they are each one in a paragraph command. You’ll see paragraph and some stuff and then end paragraph, and some stuff, and end paragraph. Now what this means is that I can create parameters. Let’s say I’ll just create several here and we’ll make one of them “firstlineoftext” here, and we’ll call this second line – remember there can’t be any spaces in there, it has to run together – and then “secondlineoftext”. And then this one is going to be the text size. And this we have to choose “real number” and we’ll say this is going to be “text size”. [0:11:31]
And it looks like I forgot to set the type of this first line to where I set it incorrectly so it needs to be text. If I wanted these to be in a different order, I can literally go grab them on the left side here, this little up and down arrow, and get them in the order that I like. So first line, second line, text size. And by the way this thing that says “use store environment” here, if I really don’t want to see that, it was showing up before, I can use the little X here to do that. So if I click a second time on that, then you can see there’s a little X. That doesn’t delete this information is just says hide it. [0:12:12]
So let me now save this new symbol. Actually we are going to need to just get the text here that’s ABC123. We’re going to call this “first line”. And this one is “second line”. And this size, which is this sort of odd number here, if you’re in the metric system, it would probably say two or three or some number. But here it says 8’1″. Let’s just say that we’re going to do this as text size divided by 72 multiplied by 25.4 mm. And we just save this. And now when I go back to the floor plan the object got a little confused. Let me just delete and place it again because I did reconfigure it. Let’s open up this new symbol 3 – I guess we didn’t put in any default for the contents of the text. [0:13:12]
So in fact let’s go back and set the defaults for this. So if I open up that settings again and go to the parameters, the first line of the text I will just say “first”, “second”, and the text size, so let’s do 2.5, it seems to be a pretty nice starting point. Actually this is going to be in points because of the extra calculation I did. So I will just say 7 pt. and save this. And now if I delete this object and place it in again you can see there’s the first and second line and we have the options for changing the text. So ABC, you’ll see how this updates here. And the text size, if I make the smaller, you can see how that reworks it. [0:14:02]
This concludes the second section of my three part ArchiCAD video training on creating custom library objects. In this section we learned how to make 2D symbol smarter with the text size being parametric and changeable each time you insert the element as well as a variation of the 2D symbol with more than one line of text. In the next section we will look at creating objects where you combine 2D and 3D together and create a compound element making is smarter as well so that it can pick up the text for the floor plan directly from the object ID in the info box; and using object subtype controls to add listing parameters so that the new objects you create will fit into your schedules such as appliance or equipment schedule, just like standard ArchiCAD library parts. Please add your comments and questions to the page down below. If you like this video I’d love to hear from you. Please click the like button or make a nice comment. This has been Eric Bobrow; I look forward to getting your feedback. Thanks for watching.
[END OF AUDIO 0:15:15]
This was very helpful Eric!
I just went through both parts of this tutorial and created my own room label symbol w/ parametric room names and numbers with adjustable text sizes. This is kind of what I was after when we discussed this last week. The one detail I am still fussing over, and this also true if I use the zone tool: I typically put the room number in a rectangular box below the room name, and when I do that here the box does not adjust to the length of the number text and instead remains generically much longer. Is there any way to control this in the parameter dialog? I can send a screen shot if that helps.