Description
Key Learnings
- Learn how to create an iLogic rule that validates the “range” of the value of a parameter
- Learn how to create an iLogic rule that updates an iProperty whenever the file is saved
- Learn how to create an iLogic “form” that makes it easy to change certain Inventor parameter or iProperty values
- Discover the difference between internal and external iLogic rules
Speaker
- JBJon BalgleyJon Balgley has been with Autodesk since 2005, and has worked on CAD-related software since the 1980's. He was one of the original developers of Inventor ETO, and now works on Configurator 360, iLogic, and other forward-looking projects.
PRESENTER: OK. Welcome to iLogic, from 0 to 60 in 90. So we're going to go-- start from zero, but we're going to go really fast. I hope everyone is ready. Is everybody ready? We're ready? Is anybody tired from lunch or over extended from? Yeah, not you, Paul. Anybody need an extra brain? If they need an extra brain. Yeah. Matt. Anybody else need an extra brain? OK. Here you go, we got extra brains if anybody needs any extra brains.
OK so welcome, yeah. We're going to go quickly here. The agenda today is I'm going to do a quick overview of what is iLogic. And then we're going to go through these four exercises. Each of the four exercises is independent. The exercise always starts you off in a clean state, so you don't to worry if you don't finish the previous one. No worries at all, go right into the next one, and you'll be fine.
At the end, the last one is definitely challenging, way too challenging to do it all in this class. So it's broken down into three parts, you get to pick one. And you'll see, you get to pick one, and then we'll talk about where to go next.
So that sound good? Other thing I just want to mention, is it's going to be a lot of hands on stuff. I'm not going to just walk through, and you're going to watch me, you're going to do it all. I've got some great advice from speaker mentors saying that a speaker in a lab should talk as little as possible. So I'm going to shut up, quickly, and you guys can do it.
We have some great-- Did I mentioned, we have some great lab assistants here. We have Adam Nagy, and Paul Mumford, and I don't see my third one, but these guys are great. I have also been working with iLogic for a long time. And yeah, feel free to ask them anything.
OK, so what is iLogic? So first of all, it's a built in capability of inventor, right? So it's not something extra that you have buy or anything, it's built right into Inventor. Allows you to specify and run little chunks of code. How many people here feel like they're a real genuine programmer? Couple. How many people have ever written anything that resembles programs? Yeah, OK, so, if you can write an Excel formula, then you can do basic iLogic, right?
If you want to get into full programming, that can be handled also. So yeah, and it runs at certain predefined and convenient times, right? So that's kind of a key thing. So little chunks of code, the logic that you're writing is in the VB.NET language. So that's a compatibility aspect. There's a lot of aspects that are hidden, so that you don't have to worry about a lot of the details. So it kind of keeps all of that out of your way. But you can get into it if you really want to, so it kind of-- you have the best of both worlds in that regard.
It comes with a built-in editor with snippets of pieces that you can reuse that you can use right off the bat, so you don't need an extra tool to start using it. It's all built into to Inventor. Like anything that's programming, there's a compiler aspect to it that you have to-- normally, you would have to build a program to run. It takes care of all that for you. It's all behind the scenes. You don't have to worry. It's there for you, and you just say, save and run, and you're on your way.
And last that the rules are triggered or invoked automatically as a general rule. No pun intended, sorry, as a general rule. So again, you don't even have to worry about running them. They run at the right times for you, and we'll talk about when that is.
There's two different formats for iLogic rules, internal, which is what we'll be working with mostly, and external. Internal rules live inside the file, part file, assembly file, or [? drawing ?] file. External rules live in a separate file. That has an advantage because they're, of course, independent and separate from the file, but the disadvantage there is that they don't have as easy access to the contents of the file that you want. OK?
So when iLogic rules run, it's called being triggered. So the triggers that you have are several options. And this is sort of the general, normal case. There's always exceptions. So if the logic in the rule refers to invent a parameter, and that invent a parameter's value changes, the rule will run. Very convenient. Any time it changes, it just takes care of it for you. You don't have to ask it to run. It'll just run. You can take a rule and attach it to certain events. Events are things like when a file is open, when a file is saved, either before the file is saved or after the file is saved, and so if you attach a rule to event, then it just runs at that time as well. Again, another easy way to have a rule run at the right time. And of course, there's also an option for you to say, yeah, rule, run now. And so you can do that. That's easy.
The last thing is that you can also use-- rules can ask for other rules to run. Then you have to-- that's a little bit harder. You have to at least write a little code, so to speak, to do it. It's not fully automatic. OK.
This is an example of the 60, where I hope that we can be by the end of the day today, end of the session. So on the left is a iLogic form that might allow you to configure this box. We're going to pretend that we're the custom box company making custom boxes. I've been perennially surprised at how many people, many customers make some kind of box. Does anybody in this room make something that could be categorized as a box? Yeah. Yeah. Yeah. So yeah, so it's not so unrealistic to be working on a box. OK. And then you on the right, you can see that there's different configurations, different sizes. Sometimes there's a lid. Sometimes there's not. Sometimes there's a T handle. Sometimes there's a round handle. That's the configuration. So that's what we're going to be going, heading towards. OK.
On doing the exercises, the box that you're seeing on the screen is already open to exercise one, step three or so, so you've gotten a head start already. The data sets live in this folder. So you can go there if you need to find the files, C:DATASETS. And then IM, blah, blah, blah, blah, iLogic. Yeah. The exercises should already be open on all your systems. There's a V2 PDF, if you lose it. It'll be there. And I want you to go fast because having timed it, it's only just barely doable in this amount of time, so just go. And like I said, it's OK to do not finish and go on to the next one. The yellow highlights point out things that you have to actually do. The un-yellow highlights are mostly just description. Green stuff is optional that you can skip unless you're way ahead. OK.
So exercise one, this is just kind of an overview of it. You've already got the box.IPT open on your screen. What we're going to do is add a simple rule that will not allow you to make a parameter be too small. So if you try to make the size of the box too small, it's going to say, no, don't go that small. Set it to the minimum limit and keep it at that. So that's what that rule is going to-- that's what you're going to do in this exercise, is have a rule that prevents a user from changing up parameter values from being too small.
And then the last bit is just to say, do you want to do that silently, or do you want to give the user some kind of warning about it? And so we'll experiment with different warnings. I think the first thing is just to do it silently and just have it do it, and then we can add various kinds of warnings. All right. Everybody ready? Questions on that so far? Anybody, anybody, anybody? Anybody need an extra brain? Extra brain? Yeah, yeah, OK. Yeah. All right. Go.
OK. So exercise one, written a simple iLogic rule. Any kind of high-level comments, observations, questions? OK.
AUDIENCE: [INAUDIBLE].
PRESENTER: Say it again.
AUDIENCE: Is it important to keep things in certain lines?
PRESENTER: You mean one of the error things? Yeah. So that's an aspect of Visual Basic that certain keywords are expected to be on the same line or different lines in different times. Yeah. And so that's why I wanted to point that out was, it's not really very good, doesn't give you very good error messages in those cases. And it's sensitive to that because it sort of kind of expects that you know that.
OK. So second exercise, so having written a simple rule, now we're going to go into something called iLogic forms. iLogic forms are-- I have to get this in the right place. There we go. OK. Now that's good. iLogic forms is a little bit separate from rules. You don't actually even need to write any rules to use iLogic forms. Although in this exercise, we're going to start with no rules and just using a form, and then we're going to tie in one very simple rule at the end.
So what is in an iLogic-- what is a form? So it's a very simple kind of dialogue box, a pop-up dialogue box that lets the user enter values for parameters, for iProperties or to run rules as a button. So you can show a rule as a button on your form, and then the user can click it to run that rule. So very simplistic, that's more or less all that it does, but it's great and really easy to use, so simple but limited.
Yeah, and then in addition, you can create these forms just by a very simple user interface. You can just drag and drop the controls onto the form, and then you're ready to use it.
OK. So exercise two. We're going to make a simple form that just allows you to change the values of the parameters of the box, so you can then easily-- you don't have use the parameters dialogue. You won't need to use the parameters dialogue anymore, but you can just enter values for length, width, and height. No rules for that. The form will automatically trigger any rules that are necessary, so you'll still have that clamping rule in place. And so it will run that clamping rule if you enter a value that's less than eight. Then it will bring it back to eight.
We're going to look at something called multi-value parameters. Multi-value parameters is a part of Inventor, per se. It's not really part of iLogic exactly, so although it's often used in conjunction with iLogic and forms, and you'll see why. And then also, true-false parameters that you may not be familiar with, also part of regular Inventor, not necessarily a part of iLogic per se but very useful in the iLogic context.
OK.
AUDIENCE: Is it necessary to restart Inventor? Because sometimes they have this [INAUDIBLE] message and all that.
PRESENTER: Oh, oh, yes, yes. So you don't have to-- thank you so much. You don't have to restart Inventor. The first instruction says, restart Inventor. All you have to do is just close all your files, close all your open documents, and then go to the new project. On these network computers, it takes a long time to restart Inventor. So let's avoid it if we can. OK. Go.
--having problems getting to the project. I'm going to demonstrate it on the screen. If you're doing OK, you don't have to watch.
So I'm not on the same network here. But what you'll need to do is go to the projects button. Click on that. And then you'll see that there's a-- that you're in the 1.1 clean. And then you can use the browse button. And then go to-- it'll be in a different folder, but go to the 2.1 clean. Click on that, and there's a 2.1 clean IPJ file. Click on that, open, and then you'll see that you're in this 2.1 project. Click done, and then open, and then you get a different box in the 2.1 clean folder. So that's really the key thing is that it's in the 2.1 clean folder. And you may have seen that there's a finished version of each one, as well, if you want to see the result at the end.
OK. About one minute left. Who's done? Who's done? Who's done? OK.
So comments, general comments or observations, questions? Forms. Forms are really easy. Yeah, Tom.
AUDIENCE: For multi-value parameters, there is a option in there [INAUDIBLE] select for allow custom values.
PRESENTER: Yeah.
AUDIENCE: Do we need to enable that [INAUDIBLE]?
PRESENTER: Yeah. Hang on. Yeah. So the question is, for multi-valued parameters, there is an option that you were asked to not select called allow custom--
AUDIENCE: Value.
PRESENTER: -- value. Thank you. Allow custom value, so the idea there is that if that's not checked the way it is in the exercise, then you're only allowed to choose from the ones there. If it is checked, then you're allowed to enter anything there in addition to the ones that are supplied there. I believe it--
AUDIENCE: It doesn't show [? here. ?]
PRESENTER: Does it not show up in the form?
[INTERPOSING VOICES]
PRESENTER: It doesn't let you type?
There might be something if you click on the control in the edit form.
[INTERPOSING VOICES]
PRESENTER: Yeah, yeah, yeah. There's a different format.
OK. Good question. Thank you. Other comments. Other comments, questions? OK.
Let me get my power tool here. So iLogic events. iLogic events are predefined times, situations, where iLogic will run a rule if you ask it to. So you can-- so let me just say, that the events are things like after file save or, excuse me, after file open or before file save. It can't be before file open. That would be tricky, yeah. Typically what you do or what we're going to start with are attaching an internal rule, a rule in the file, to an event that happens just for this particular file.
But for external rules that don't live in any particular file, there's also global events. There's also global events, and so external rules can be tied to global events, and so that happens on any file of a certain category. So you have a choice of any part file, any assembly file, any drawing file, or just any file. So you can make things happen when a user opens any file or when a user opens just any drawing file, or you can make things happen on just this particular file. All right? So we'll start with just this particular file, and then we're going to expand it to any file, and the--
Yeah, so the idea is that we're going to make a rule that sets an iProperty and not attached to any events for a start, just make sure that that rule works. And then we're going to attach it to this document events, and you'll see in the exercise what this document means. There's actually a tab called this document. And then we're going to convert that rule to an external rule, and that's a little-- it's not really that convenient to do that. It's not like there's a one-button thing. There's some work to convert it to an external rule, so just don't be surprised by that. And then finally, attach it to some global events.
Some people working ahead found that the instructions on the data set don't exactly match. It asks you to look at a particular rule that as if that rule exists, and the rule doesn't exist. So you just have to create it. The code for the rule is in the text of the PDF. You just have to create it, copy and paste the text in, and then you're good to go.
OK. Go. Oh, we're going-- You're going at about 20 miles an hour now. Right? Acceleration is on a curve, right? So we're about halfway through the time. But we're only accelerating up to about 20 miles an hour.
For anybody who uses Inventor, how many people here use Inventor? Yeah. There's a party Wednesday night. If you need one of these orange bands, stop by the Answer Bar, and you can get a invitation to the party.
AUDIENCE: Answer Bar?
AUDIENCE: The Answer Bar?
PRESENTER: Yeah, Answer Bar.
AUDIENCE: Where's the Answer Bar?
PRESENTER: Where is it? Sorry?
AUDIENCE: Yes.
PRESENTER: In the-- Yeah, in the expo area. I haven't been there yet. It's in the center, right? Yeah.
Yes, just to reiterate, you do have to actually create the rule named set customer project. The text for that rule is actually in the handout, but it's not predefined in advance. My mistake.
Yeah. So if you're looking for the events dialogue, it's in the manage tab. There's--
AUDIENCE: [INAUDIBLE]
PRESENTER: Sorry. Tools tab. There's an iLogic section, and then one of the buttons in that section is the event triggers dialogue.
I think you're going about 45 miles an hour now, 45. Yeah. How many people are done with exercise three? Just getting a feel here. Done with exercise three? How many people still working on it, still working on it? Yeah. OK. We'll give you a couple more minutes.
All right. Actually we're not to give you a couple more minutes. We're only going to give you one more minute. All right. So any general comments, observations? Got significantly harder, huh? No? Yes? No? Yeah, yeah. Lots more--
AUDIENCE: [INAUDIBLE]
PRESENTER: Yeah.
OK. Yeah, so it's not as easy to use. It is all just kind of menu-based, picks and clicks. There's not really any programming to attach to events. But there's a lot more pieces that need to be in the right place at the right time. Yeah.
OK. Moving on towards 60 miles an hour, some more advanced topics. So we're going to look at two different types of things. They're are closely related in this context. But they don't have to be related. So you'll see why in a minute. The two things we're looking at are using iLogic for assembly configuration and using iLogic to-- iLogic GoExcel functions to access Excel files.
So the first category of techniques, assembly configuration. So the idea is that you're going to have an assembly file and through a form, perhaps, we're going to control the components in that assembly. So some assemblies might have an extra valve or an extra widget of some kind, and other variants of the assembly do not. So turning things on and off according to some rules ultimately based on parameters. So ultimately, this is going to be based on some parameter value.
One thing that both of these styles do is they implement something that I call top-down design. So you're going to be having parameters and rules in the top level assembly file, and those rules are going to change and modify parameters in the component part files. Right? So the rules in the assembly file are going to modify the part file, so I call that top-down design. A little bit different than skeletal modeling, where you change things in a part, and it kind of propagates to the rest of the assembly. So it's different style of operation just different people have different styles. This is a style to be aware of. It's only enabled by iLogic. Right? It's not something you can do typically without having a rule in place to drive the values from the top-level assembly into the components.
There's two styles of assembly configuration. One is called the LOD style, and that's a legacy one that people have used for many years up until-- well, including now. They continue to use it. But in 2018, I think, I'm not sure, must be 2019. [? It might have been ?] 2019. Recently, we've introduced a new technique called managed assemblies for iLogic that works in a different way. And so the new managed assemblies technique is good for going forward. It's got some advantages and some disadvantages. The legacy technique is something that you'll see if you're using colleagues' rules. You'll definitely see that style, so you might want to learn that style as a good baseline technique. And there's pros and cons to both, and you'll see if you pick one, you'll definitely see the pros and cons of the one that you pick, and then later you can try the other one and see the pros and cons of that one.
Last is that within the rule editor, there's a command that-- you'll see at the top of the rule editor there's a model browser that shows the components in an assembly tree that's a separate model browser there, and you can right click on those components and capture the current state, and that will write a little fragment of a rule and insert it at your cursor point, wherever you've got the cursor in the text, and that fragment of rule is something that will make the component be the way it is right this moment. And then you'll typically modify it to do something else. So it gives you a starting point to say, Yeah, I want this component like it is now, and then you can tweak it by putting in an if statement or change some numeric values or something. OK, so capture current state, and there's different varieties of that depending upon the style that you're choosing.
The last thing is GoExcel. It allows you to read and write Excel files. You'll see that-- sorry. Typically, people use this for just as a little, tiny database, so when it's not really worth having a full-blown database but you just have a handful of data that you want to work with. You can just slap it into an Excel file and use this technique to pull the data out very, very, very quickly. Find row is kind of the most common thing that people use to search through the table of cells to find the other values of interest. So typically, you'll use find row using one particular column to find the relevant row, and then you pull the other cells out to use those other cell values.
And then last, there's an option-- you may not want to do this in the class today-- that uses a different mechanism for reading the file besides Excel itself. It's called LibXL. It's a lot faster than Excel. It fires up a lot quicker. So just be aware of it. There's a technique to turn it on and off. It's great if you don't actually need Excel within your Inventor session. Right?
So you'll see that there's 4.1, 4.2, 4.3. Pick one, and go with that. 4.1 is good if you want to work with colleagues' legacy rules for assembly configurations. 4.2 is good if you want to go with the new modern style and see what that's all about. And 4.3 is about working with Excel. It starts you off with a configurable assembly. So you don't have to do that yourself. You're starting the configurable assembly, and just walks you through the Excel part. All right. Go.
By the way, I think that I pulled out the references to LibXL from the exercise 4.3, so something that you can search for online to see how to use it. If you're leaving, feel free to please fill in your surveys. That helps me out. Thanks.
Tags
Product | |
Industries | |
Topics |