2.3 More Rappture Objects
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Formal Metadata
Title |
| |
Title of Series | ||
Part Number | 2.3 | |
Number of Parts | 12 | |
Author | ||
License | CC Attribution - NonCommercial - ShareAlike 3.0 Unported: You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this | |
Identifiers | 10.5446/18191 (DOI) | |
Publisher | ||
Release Date | ||
Language |
Content Metadata
Subject Area | ||
Genre | ||
Abstract |
|
Rappture Bootcamp7 / 12
2
7
8
9
10
00:00
Urinary bladderArc (geometry)Executive information systemLength of stayoutputMoment (mathematics)CuboidInsertion lossMetropolitan area networkPhase transitionValue-added networkMathematical singularityGamma functionPersonal area networkPell's equationPort scannerExpressionMaxima and minimaNormed vector spaceHausdorff spaceSet (mathematics)Computer-generated imageryAbsolute valueWorld Wide Web ConsortiumAsynchronous Transfer ModeSkeleton (computer programming)Router (computing)ModemTable (information)Element (mathematics)Spring (hydrology)Data modelArtificial neural networkHand fanStorage area networkArmInformationSoftware development kitCurve fittingSimulationNumberMathematicsComputer programmingArithmetic meanCodeString (computer science)Condition numberWave packetStatement (computer science)Set (mathematics)Game controllerBoolean algebraFormal languagePoint (geometry)CurveDirectory serviceReal numberInheritance (object-oriented programming)Structural loadComa BerenicesComputer fileDifferent (Kate Ryan album)ResultantSoftware testingInterface (computing)Drop (liquid)Function (mathematics)Term (mathematics)Order (biology)MereologyParameter (computer programming)Drag (physics)CASE <Informatik>Graph (mathematics)Multiplication signDirected graphInformation privacySheaf (mathematics)Default (computer science)Ocean currentACIDDevice driverOperator (mathematics)BitSpiralInformationAreaScripting languageWeb browserRight angleWeb pagePlanningLink (knot theory)Electronic mailing listBuildingWebsiteArrow of timeGUI widgetThresholding (image processing)Menu (computing)LiquidExecution unitType theoryAxiom of choiceExpressionQuicksortWeb 2.01 (number)Cartesian coordinate systemGroup actionElement (mathematics)outputConnectivity (graph theory)Goodness of fitMedical imagingUniform resource locatorTheoryTowerMeasurementEndliche ModelltheorieObject (grammar)Nichtlineares GleichungssystemDisk read-and-write headSeries (mathematics)WindowOnline helpHeegaard splittingGraph (mathematics)IntegerHecke operatorSelectivity (electronic)Level (video gaming)HierarchySkeleton (computer programming)Figurate numberAtomic numberDescriptive statisticsSymbol tableWeightRegular graphTouchscreenGaussian eliminationPhase transitionProcess (computing)PressureFlash memoryGeometryControl flowHypermediaComputer configurationBlock (periodic table)ElectronvoltCharge carrierMaß <Mathematik>HyperlinkStaff (military)Streaming mediaOctaveDatabase normalizationGoogolObject-oriented programmingContent (media)FrequencyEaster egg <Programm>CausalityLibrary (computing)Boltzmann equationKeyboard shortcutP (complexity)Java appletComputer animation
Transcript: English(auto-generated)
00:08
So in the next section, we're going to take a little deeper look at Rapture and we'll see a lot of other kinds of objects that are possible when you're building interfaces.
00:21
So for one thing, as you start building up tools, you may run into a situation where you have a lot of controls and you want to maybe put things together that are related. There's a thing in Rapture called a group that you can use to group things together. And in the builder, you just drag a group over. It looks like that little icon up in the right-hand corner there.
00:41
Just drag that over and drop it into your interface and then you can put other things inside of it. A group sort of acts like a hierarchy level in your program and you can put other things inside of it. In this case, I have a group named Tau and it's labeled Minority Carrier Lifetimes and inside of it, I have two numbers. And it actually gets drawn on the screen with like a border around the controls.
01:08
In the builder, again, it would look like this. It's got the name Tau, it's got a label Minority Carrier Lifetimes and the description describes what that is. I don't know, you guys probably already know all about Minority Carrier Lifetimes, right?
01:22
Right? No? If you don't, the description says that that's the average time that it takes for a minority carrier to recombine and semiconductor blah, blah, blah. Anyway, your advisor will tell you like what the science is behind it and you can put in good descriptions. But once you do that, you've got a title for the group and when you mouse over the
01:40
title, it'll pop up the tooltip. So if somebody doesn't know what that means, they can use the tooltip to figure it out, right? Again, the documentation is embedded right there with the tool. All right, now there's one other interesting thing that you can do in Rapture. If you create a group and then you put groups inside of it, you create a group of groups.
02:01
When you do that, Rapture is thinking, oh boy, it's getting complicated. There's a lot of stuff here and what it does is it renders it to you with tabs. So because there starts to become so many nested groups, it figures, all right, well, this is better if I just show it to you as tabs. So you'll get two tabs. If you create a group, in this case, I called it tabs, you don't have to, but there's
02:22
a group here called tabs and inside of it, there's a group called models and a group called ambient. And geez, inside the group models, there's a group tau and all that. Anyway, when you have groups of groups, they become tabs on the interface. So you can see the group models and the group ambient, those are like two separate tabs.
02:41
You can see one or the other at the time, but not the both. Now, inside the group models, I have a regular control, a Boolean value for recombination and then I have a group with two numbers. And as soon as I start to mix things up, I have one control and groups with other stuff, then Rapture doesn't do tabs anymore.
03:01
As soon as I start mixing controls, it splits them all out. So you can see the Boolean value for recombination model and then right below it, you can see the group with the two numbers in it. So the tabs only works when you have groups of groups. If you have just groups of groups, then you get tabs. Otherwise, you'll see the groups with headings.
03:22
And that tends to work pretty well most of the time when you're building stuff. So that's a good assumption. There's one other thing that's like a group, but even bigger. Sometimes the tools that you build have so many controls. Not only do you have groups of groups, but you need to have groups of groups of groups
03:42
and kind of split things up. And it's easier for the user if you kind of walk them through the important stuff. So we have something called a phase in Rapture that is kind of like the wizard thing that you see on Windows sometimes. You know, you see a panel and then it says next and you fill out those things and it says next and it kind of walks you through a series of panels.
04:02
So the way you do that in Rapture is by defining a phase. In this case, I've got a phase with a string in it and then I've got another phase with another string in it. So it'll show you the first phase, just that one string, and then there's a button that'll take you to the second page and then it'll show you the second page with its one string and then it'll take you on to the next.
04:22
And at the end, the last button always says simulate because by the time you've gone through all the phases, all that's left is to actually run the program. So if your tool is so complicated, if it's got like a hundred controls in it, then you want to probably take those hundred controls and first of all break them into groups. But you might also even want to break them into phases.
04:42
You might have two or three phases. One phase is all the geometry that deals with your device. The next phase is all the temperature and pressure and ambient conditions, you know. The next phase is all the voltage that you apply to it or whatever. Things that are logically related and on each phase, there should probably be at least a dozen if not 20 parameters, right?
05:01
So you want to use phases only when your tool is so complicated, it's got that many parameters to manage. If you can fit everything on one screen, that's actually the best, I mean for the user. Now one screen with maybe a dozen controls, that'd be perfect. But if you get beyond a dozen controls, you use groups and if you get beyond that, you can use phases for really complicated tools.
05:23
So anyway, so that's there. You can remember if you get a really complicated tool, that's one way of managing it. Of course, you know, whenever you do that with groups and phases, the groups tend to hide things from people. If you've got tabs like this, I can look at models but not ambient, you know, one or the other.
05:40
So whenever you put things inside the tabs like that, the parameters are a little bit hidden. And when you put them into phases, especially if there's not much there, you're just torturing the user. So again, I'm saying use these things sparingly, but they really help when you have a large program. All right. Now suppose inside my group with the drift diffusion options, I have this recombination model.
06:07
Suppose I have two other numbers, but when the recombination model is off, I don't want the user to enter those numbers. They don't make sense. But when the recombination model is turned on, well then I have to have those numbers because I need them.
06:20
So when I have a recombination model active, I need those two numbers for minority carrier lifetime. And if I don't, then forget it. There's a way in Rapture of enabling and disabling stuff like that based on the value of a control. And let me show you how to do that. So inside the builder, I have this Boolean value for recombination.
06:44
And in the builder, if I highlight that Boolean control and then I go down to where the name is, I can click on it and say copy. If I click on that, instead of renaming it, up to now we've been renaming the thing, right? But if I click on that name and copy, that's like a copy paste thing.
07:02
It lets me grab that thing, grab the name of it. Remember, this is the same name that I would have used in my Rapture program. I'm going to grab that name and I'm going to use it elsewhere in the builder right now. So I'm going to click there and copy the name. And then I'm going to paste it in to an enable condition over here.
07:21
So I'm going to go to the thing that I want to have turned on and off. In this case, the number tau n and there's also a number tau p. Each one of those, I want to have this enable condition. What this says is when this control is turned on, this number is active. When this control is turned off, this number should be off. So that's the simplest thing that I can do.
07:41
When the Boolean value is on, this number is enabled. When the Boolean value is off, the number is disabled. And I do that for this number and I do it for the other number too, tau n and tau p. I have two numbers. Each one of them has to be enabled properly, right?
08:03
All right, just to build on that a little bit. Suppose I have a tight binding energy, 2.99 eV. And when I'm 2.99 or below, I don't need the next number. But if I'm at 3.0 or above, then I do need the number.
08:21
Slightly different, right? It's not quite a Boolean thing that turns it on and off. It's more of a numeric value. When I'm at a small value, I don't get the number. But when I have a higher value, reach a certain threshold, then I have something called a high energy lifetime or something I have to include. So, how do I do that? Again, there's an enable condition.
08:41
But this time, the enable condition is not just a Boolean value. It's not just true, false. It's a little more complicated. I write it this way. Basically, I go to the thing that I'm looking at the tight binding energy. And so I grab the name of that tight binding energy, input.negf.tbe. That's the name of the tight binding energy.
09:02
If I add colon EV on to the end of it, it'll take the value of that thing and convert it to electron volts and drop the units. So that lets me take a string like 200 milli electron volts and convert it to a number like 0.2 in electron volts. So this will give me a number value and
09:22
then I just look at greater than or equal to three. So if I've got that number greater than or equal to three, then it's enabled. Otherwise, it's disabled. See, these enable conditions that I showed you a second ago, they can be just a simple Boolean thing or they could be an expression. Like this is an expression, get me a number and when it's greater than or
09:40
equal to three, then this thing's enabled. And when it's not, it's not. So you can write any arbitrary expression there using the value of one rapture component to control another one. You always take the one that has the controlling value and you put it on the enable condition of the other one that you want to control.
10:03
All right, let me show you another example of that. Again, suppose that I have something called a choice thing with a drop down list. And when I choose drift diffusion, I want to have those parameters. And when I choose Boltzmann transport equation, I want to have these
10:21
parameters, and when I choose neg f, I want these parameters. I actually have three different sets of parameters, depending on the model that you choose. And I want to make sure that when you choose one set of parameters, but if you choose a different model, you actually get a different set of parameters. The way I do that in the program is I make three groups for the parameters.
10:43
And when this model is enabled, when the model drift diffusion is on, I enable its group and I disable the other two groups. If you enable a group, it'll show its controls. If you disable a group, the controls will completely disappear. They actually don't just gray out, they disappear off the screen.
11:00
So this idea of enable and disable is a way of showing controls and hiding controls too. You can enable a whole group and the whole group pops up, and you can disable the group and the whole group will disappear. So the way I do that is for the first group, I look at the value of the choice. Input dot choice parentheses model.
11:21
That's the model thing that you're seeing at the top of each one of the three of these. So this is the rapture name for it. And if I look at that model and I say input dot choice model equals DD, then go ahead and enable that panel. The next one says, look at the choice and if it's BTE, then enable that panel.
11:40
And the next one says if the model is neg F, then enable that panel. And sort of there's some mathematical corollary, I'm sure, that says, you know, when the model is DD, the top one will be true, but the other two will be false, right? So it'll be enabled and disabled and disabled. But on the other hand, if I had the choice model was neg F,
12:01
then it would be disabled, disabled and enabled, right? Because it would be false, false, true. So that way there's only one that's active at a time. Whatever model I choose using the dropdown, drift diffusion, BTE or neg F, whichever one I choose, it'll pop up that panel of controls and the others will disappear.
12:21
So the enable thing is really good. It helps you, on the one hand, do simple things like enable and disable certain controls. And I can do that with a simple Boolean value. I can do that with a numeric value. Or you can actually show or hide whole groups of controls by enabling and disabling groups.
12:41
So it's a very powerful thing. All right. On a different note, literally different note, there's one more thing you can put into your tool for documentation. There's a Rapture object that's called a note. It's not really an input, it's not really an output,
13:02
but it's an element that's there to help you with documentation. What I found was people would start building Rapture interfaces and they'd put in strings and images that weren't inputs, but they just described stuff. So people would put in a string with a bunch of documentation and then your program would actually receive that as an input, but it would ignore it, right? So I thought, well, heck, with that, we can do better than that.
13:22
You can actually have a note object that actually has HTML text that describes what's going on in your interface. So for example, you can see in the builder here, I've got a note and then a number and an integer. And over on the right hand side, you can see some HTML documentation and then a number and an integer, right?
13:43
So the note is a little HTML area where you can show images and links and text and everything you need to describe your tool. That area right there is the note. And when you're setting it inside the builder,
14:02
there's a little button where you can choose an HTML file. So just pretend it's the 1990s and you can create a little HTML file by hand, any sort of ordinary HTML file with an HTML tag and a body, sort of like the way people used to do it back in the 1990s. But you can also include images
14:21
and it actually does understand style sheets. It doesn't understand Flash. It doesn't understand Java. All the fancy stuff on the web, it doesn't do. It doesn't do JavaScript either. So you gotta keep your HTML pages kind of plain. But if you have HTML pages, you can plug them in right there.
14:41
And you can test them with your browser to make sure they look right. So this is what typically you do. Inside, if this is where my tool is, I've got my tool.xml and I've got my script for my tool, it's a good idea to make a directory called docs, D-O-C-S. Rapture will look for a directory called docs in the same area where your tool.xml is.
15:03
And it will assume that all your note information is in the docs directory. So in this docs directory, I can have an HTML file and I can also have images and all that stuff. And then your HTML file can reference the bysize.gif image and it's all together. So when you're building a tool, make a docs directory,
15:23
same place you have your tool.xml and put all your HTML and your images there. And then just choose it in the loader, the HTML file and you're off and running. There's your docs. That might be useful. It's like a really useful thing for a lab assignment. Just say it.
15:41
Everybody's like, wait a minute, what? Backup, what? The note. I give you the note. This is what it would look like, by the way, if you're not used to writing HTML, if you need a little HTML primer. Back in the 90s, this is how people made web pages. So it starts out with an HTML tag and then a body tag and then some stuff
16:02
and then slash body and slash HTML. And inside, the P's are paragraph tags, UL is an unordered list, A is a link in the web. You notice you can actually embed links in this and you can embed links to other websites in your tool. So for example, in this documentation,
16:21
I say, hey, here's a bunch of cool sites that you should check out. This is the theory for this tool or something. We can actually reference like nanohub.org resources or we can reference google.com or whatever web URL you want to stick in here, you can do that. And when the user clicks on the link, it'll actually pop a web page for them.
16:41
So feel free to use web links outside even nanohub. You can also see the image right at the top. I've got the IMG tag, the IMG tag with src equals by size.gif. That's how you include an image in your HTML.
17:00
And that was that image I showed you just a second ago sitting in my docs directory. So that's how you write HTML. That's a good example. And that's my by size.html file that looks like the thing at the top. And the links are active. So when a user's clicking the link, it'll pop up the tool page just like that,
17:21
which is really great. All right. Now, the last thing I wanted to, we started already kind of getting to the documentation on the website and the more you do with Rapture, the more you'll find you need that documentation. There are things that you can do in Rapture that aren't in the builder yet.
17:42
We've been working on the builder. There's a lot of stuff in Rapture. It's not feature complete yet. It's close, but not quite there. So for example, in the builder, if I look at a number object, you can see lots of things. You can see the enable condition, the default value, the units of measurement and all that.
18:00
But if you look in the documentation for number, there's even more that you can do that's not in the builder. For example, numbers have something that you can put in called a preset. If you write this in XML, if you use the builder, generate a tool.xml file and then edit it by hand,
18:21
you can actually add something like this to the XML. You can add a preset value 300K, preset value 77K. And what that does is gives you a little dropdown menu. The number not only is an entry widget, but it'll have a little arrow next to it with a dropdown and they'll drop down these two choices. That's a really useful thing because sometimes people don't know
18:41
what good temperatures are. And it turns out that experimentalists like to work at 4.2 Kelvin, that's like liquid helium temperature. At 77 Kelvin, that's liquid nitrogen temperature. And also at 300 Kelvin, because that's room temperature. And if you weren't an experimentalist, you might not know that. But it's really good as a tool builder to build those things into your tool
19:00
and that way it makes it easy for people. They just think, yeah, I wanna work at liquid nitrogen. What's that temperature? I forget. Oh yeah, it's 77 right there. So if you build something in the builder, you'll get close with the tool.xml. You can then go into your tool.xml and edit it and you can add stuff in. Just like we were doing with the driver file
19:21
when we added in the current values, you can edit the tool.xml and add presets, for example. And that'll add new behaviors. And there's other Easter eggs like that that you'll find, lots of other things in Rapture. If you read the documentation, there's extra stuff that you can do in the XML. Okay, so the builder builds your tool.xml
19:44
and then you can go in and add stuff like that and save it. Now, the only bad thing is that if you reload this file into the builder, the builder will scrape out all the stuff it doesn't understand and throw it away. So once you've started editing your tool.xml by hand,
20:02
you're sorta on your own. Sorry about that. I don't know what else to do about it. The builder sort of throws away stuff that it doesn't like and when it goes to write it back out, all that stuff that you added by hand will be gone. So once, you can use the builder to get so far, if you start adding stuff by hand, then you might as well just keep adding stuff by hand
20:22
in the tool.xml. So just be forewarned, I guess. This is what it looks like, by the way. If I add those two presets, when I get this temperature control, I'll have a little dropdown and the dropdown will have my preset values on it,
20:42
which is kinda nice. On the other hand, you might say, ah, it's not worth it for me cause I don't care that much about that feature compared to losing the builder when I start using it. So there are a few other things that you'll find if you poke around in Rapture.
21:01
There's also an input called the periodic element and I think it's in the builder now. So we can drag it over, right? That's good, cause it didn't used to be. So now you can drag over this periodic element in the builder and again, this is what it looks like in the XML. It shows you a periodic table
21:20
and it's really good for chemistry applications. If you're asking somebody select an element like oxygen or helium or something like that, you can give them a periodic table and they can click and choose the elements out of the periodic table. You may, in some cases, with chemistry applications like this, you don't wanna let people select anything. You only wanna select three, five compounds
21:42
or something like that. Certain columns of the periodic table. And so there's all these different kinds over on the right hand side, noble gas and transition metals and all of that. So you can activate certain sections of the periodic table or you can deactivate certain sections of the periodic table. You can say the user can select anything
22:02
except a transition metal when they're choosing. So that periodic element control is just a nice way of choosing elements and you can look into the documentation a little bit more or look at what the inactive and the active does and the default. Turns out in the return, has a thing called return value too where you can say what you wanna get.
22:21
Do you wanna get the symbol? Do you wanna get the number, the name, the atomic weight, everything? So you can sort of, when the user chooses an element like helium, you can decide what your program is gonna get. Is it gonna get the name helium? Is it gonna get the atomic number or the weight? So you can choose any of that with the periodic table too.
22:42
All right. It's kind of a potpourri grab bag of all weird features. And now I've got a lab assignment for you which is also a potpourri grab bag of weird features. I wanted you to try a few of those things out in your Spirograph program. You remember the Spirograph program from yesterday?
23:00
Maybe you still have it sitting around. If not, let me know. We could probably get you a solution. But what I wanted you to do is add a few things into your Spirograph program. If you remember from yesterday, the Spirograph program that we had only had three values. You choose three numbers and you get a Spirograph, right? We're gonna add a few things on.
23:20
First of all, put a note right up at the top and put whatever you want in the note. What I did was I put a note with some HTML and then that add, excuse me, an image. The image has an equation. So for when I wanted the equation, I used an image for that. I put in some links. You remember there's that link to the article about Spirograph, so I put that in. So give it a try. Try to put a note in your Spirograph.
23:41
Build the HTML page, maybe some images in there, that kind of thing. That's step one. When you're done with that, try putting in groups. Make yourself a group model parameters and a group comments. And a group, use like a group of groups thing.
24:01
So you'll get tabs. There'll be a tab for model parameters and a tab for comments. You can try that much out. The comments tab should look like this. It should have a Boolean value with the string. So all your comment controls are inside the comments tab and all your model parameters in the models tab. So do that and get that much working. And then the very last thing,
24:21
if you're looking for something to do, play with the enable and disable. Make it so that when you turn on comments, this is enabled. And when you turn off comments, the string is disabled. At least on the GUI. I don't know. Your program probably will ignore the comments. It doesn't have to do anything with them. If you're really ambitious, I guess you could take the input comments and produce an output string that has the comments,
24:44
too, if you want to. Yeah, I guess I said that. So when comments are enabled, produce an output string with comments. If you're looking for something to do, you can do that. So take it one step at a time. Start with the note, get that much working in your interface, add the groups, and get that much working in your interface.
25:02
And then finally, play with the enable and disable within the comments tab. See if you can enable and disable the string. Okay, here's my solution for the lab assignment. We wanted to stick a note in the top. We wanted to create a couple of groups,
25:21
and we wanted to mess with enable and disable. So let me show you what I came up with.
25:44
Oops, wrong one. Ah, this looks better. All right. So I've got this, I took the tool.xml and the Spyro program
26:01
from the previous lab assignment, and I made a new directory called docs, make dir docs, and then I put some stuff in it. All right, so I've got two things in there. I've got an overview.html, and a Spyro-eqns.png.
26:20
And if you're, this is just some simple HTML text that's got an HTML and a slash HTML and a body and a slash body and some stuff in between. You can look up web tutorials about HTML, and it'll show you simple stuff like this. Nothing super fancy. I know one or two people tried grabbing a webpage
26:40
like from amazon.com or whatever, stuffing it in here. Doesn't work so great because modern webpages have so much stuff. First of all, they need this and that, JavaScript from this and that, and they need all these different style sheets and things like that. So there are too many dependencies that you run into with modern.
27:00
You gotta keep the HTML here really simple. Think 1990s HTML. But as you're developing that, you can use a web browser to kind of test it. If you have like Firefox or something, and you give it the file, you can bring up Firefox or some web browser and you can test and see what that looks like.
27:20
And then you can edit your HTML and then reload it here and edit it and reload it. So web browser is an easy way of kind of checking to see what it's ultimately gonna look like in your tool. All right, so I've got my docs there. So then in my builder, let me open up my solution.
27:43
In the builder, I added a note. And the note is right here, or you can find it under the documentation tab. Just kind of drag and drop that over. And this note, you just set, you just choose the HTML file. Here I have it set to that overview.html.
28:01
I can just go in here and choose overview. And that sets the contents of that note. So that's all there is to it in terms of adding the note. And then when I go to preview it, there's my note. And if I change the HTML, it'll show me different text and so forth.
28:21
So the other thing I wanted to do was add the groups. So in order to add the groups, I go over here and there's a group thing right here. And I just dragged and dropped that over. And you notice, you can kind of rearrange things. If I wanna grab a number and move it around up here,
28:41
or move the number back into there, move it up to the top, oops. You can rearrange and kind of drag things around. So if you have an older tool that you built with the builder with some old controls, you can move it all around. One thing though to be careful about, as I'm moving this number around, if I move the number way up to the top
29:00
and I look at its name, the name is really simple. The name here is input.number parenthesis one. But if I take that number and I drop it down inside of a group, the name changes. Now the name is input.groupTabs.groupModel.number one. And that's important for two reasons. One reason is back in your program,
29:21
in your skeleton program, we use these names to get the values. And so you have to fix up your program to look for that number, not the old number, the new number, right? Different path. So when you move things around inside your program, be careful, those paths change. And you have to change your main program to use those names. Of course, if you regenerate the skeleton,
29:42
like I usually do, if I go and save as, and I save this out to a different tool.xml, and I choose another skeleton program, maybe like main two or something, if I do that and do save, then it'll regenerate a new skeleton with all the new names.
30:01
And then maybe I can take my old code and kind of plunk it in the new skeleton and everything's all fixed up. So just be careful of that. When you're moving things around, the names change. The other thing I did, inside the group comments, I added the boolean value and also the string. And then for the string, I wanted to set the enable condition.
30:21
And the easy way of doing that is to say, all right, I want this boolean value to do the enabling. And so I grab its name and copy, and then I go over to the string and I set the enable statement to that. Paste. Paste.
30:41
So that sets in enable condition. When the boolean control is on, then the string will be on. When the boolean control is off, then the string will be off. If I want to do the opposite, just like in C language, I can say exclamation point. The exclamation point at the beginning is like the logical not operator. So that would flip the control.
31:01
I can also do things like, say, equal equal, and then give it a string like, oops, like yes. You can do that too. I always forget though whether it's yes or no or on or off, I don't know. It shouldn't matter, but it does, because when it evaluates it, if I'm trying to compare it to the string yes,
31:21
it's got to actually be yes, Y-E-S. So if you're trying to do something like that, you may have to fuss with it a bit to get it right. But you should be able to do different things like that. The easiest thing for a boolean is just to copy the name in. All right. That's about it.
31:43
In terms of saving, which I'm not gonna save any of that, but that's about it. And then in my program, Spyro, again, if I edited my old program, I should be careful to change these names. Or maybe I generated a new skeleton and I stuck my code in, either way.
32:00
But the names are different than they used to be, because now it's not just input.numberN1, it's input.groupTabs.groupModel and all that. So I had to be careful to change the name there. I had to be careful to change the name there and the name there. Everything else is pretty much the same. I do my T and my Z, just like I did before.
32:23
And I save the values back, just like I did before. There's one other thing I added for the comments. I checked that boolean value to see if it's turned on. And if comments are enabled, then I went ahead and I put this stuff out. This is interesting. The way I did it right here,
32:41
I'm actually putting two strings. I'm saving out the about.label and I'm saving out the current value for that string. I'm doing both of those things. That actually creates the control out of whole clock. Let me show you. My tool.xml, if you look in the output section,
33:01
I have a curve in the output section and that's it. There's nothing else there. There's no string. And when I'm executing my code and that add statement is turned on, this add statement actually creates a string, as if I had created it in the builder. It does that by doing two things.
33:21
Number one, it creates a label for the string. Rapture has to know what to call it. So that's what the output.string parenthesis info.about.label, that gives it a label. And then the output.string info current gives it some text, okay? So that I actually created.
33:41
Let me show you what it looks like then. To run this, I'm gonna take, I'm gonna copy my tool.xml to a driver.xml. I'm gonna edit the driver. I'm gonna go in all the places where there's a default value. I'm gonna make it a current value. You guys are used to this by now.
34:02
I do this when I wanna have a test case that I can run by hand. Okay, so I've got those three values. I'm also going to set values for the boolean value. I'll set it to yes.
34:21
And I'll give it a string too. I'll set the string current value to testing, okay? So that's my driver file. I can run Octave. I can set infile to the driver file.
34:41
And I can run that main program. Oops, what did I call it? I called it Spyro. Oops, what did I call it? Spyro.m. Oops, I-R-O. There, okay.
35:01
So I ran it by hand now. And I can look in the run.xml. And you can see a couple of things. First of all, there's all the numbers. That's great. Wow, there's a lot of numbers. I forgot, I guess there's 1,000 numbers, right?
35:20
Maybe I should start at the top. Okay, so here's the curve in the output section. Here's the curve. And it now has a bunch of values, right? And if we go down, down, down, we can get to the end. Here's the end of the curve. And here's this string info.
35:43
That didn't exist in my original tool.xml. I created it on the fly inside my program. My add statement did two things. It created a string named info and it said it's about label and it created the current value testing. So that chunk right there of XML,
36:01
that appeared because of these two statements. When you do RP lib put string, when you put a string in the output section, it'll look for, in the output section, it'll look for a string named info in this case. If it finds it, it'll change it.
36:21
If it doesn't find it, it actually creates it. So you can dynamically create new outputs in your program. And that's what I'm doing here. This will dynamically create a string with the ID info and it will set the about label to comments, just like the builder would have if I would have created that string in the builder.
36:41
And then also it sets its current value to the text that I wanted for the comments. So I was expecting a curve to come out of this program. When the comments are enabled, I actually get a curve and a string. And you can see that if I do my rapture-load on that run file, you can see the results, right?
37:02
This is my interface. You can see the curve, but you can also see the string. So I actually have two outputs there that I can flip back and forth between. All right. And going back to my interface now, seems like all the parts are there.
37:20
If I just run rapture, I can change the model parameters and tie new cases. And I can put comments on or off. My enable is working properly because you can see the comments turning on and off
37:45
and simulate. And now I get a Spirograph and some comments. Questions on that?
38:01
That business at the end that I showed you about creating new things in your program, we'll hit that a few more times. You'll see that coming up more. So if it didn't quite sink in yet, it will.
Recommendations
Series of 12 media