Autodesk Inventor iLogic 101

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
thank yes so thank you everyone for joining this morning um let's jump right into it okay so just before we get started a couple years ago a colleague of mine far far as Judd also that a logic webinar and I can combine with his and what you're about to see today they gave a good grasp of getting started with AI logic and if you want to check out his webinar in it you can just do a youtube search and getting started with Autodesk Inventor I logic you know or you can go to our YouTube channel and just though you'll see all the videos there as well so what is AI logic so I logic is basically a coding language a visual basic vb.net to be specific I believe and it's built side Inventor so if you know VBA you're probably already aware of AI logic and this class this webinars probably be a little too basic for you and let me just add that I'm not a programmer I can't even spell vb.net uh-huh I'm just an inventor like most of you guys and since it is a coding language you can create conditional statements like if then else and in other words like if this happens then do something else or do that so change one dimension then maybe that will drive another dimension so so you can design models that are like rules based and when to use it so you probably use it for automating tasks you can use it for you can run checks in your models and you can also control variations in your model as well and it can take like AI parts assemblies to to the next level so basically anything you can do with your mouse and inventor can pretty much reprogram with AI logic okay so let's discuss the workflow first before even writing any code and writing anything and I logic you should prepare your model so that means renaming and defining what the key and significant parameters will be in your drawing testing the flexibility check off checking all the possible variations of your model and this would include like fully constraining your model as well so once your model checks out you can start creating your our logic rule then you would set your trigger and that will be what will you know what action will make the code run you run the rule then you can head it the rule and then edit the model run the rule and you know I'll take a few iterations in that you'll have to go through that loop a few times probably to finally get to your goal there to get to the final code our final rule so let's look at some examples I'll go right into it so let me stop the show okay so I'm just in a brand new part in this example that we're gonna start with is probably would probably be good for something like in your template right so keep that in mind so here's the iya logic browser and if it's not there you need to sort of plus sign and you'll see our logic here can also be accessed from the manage tab and you'll see the my logic browser here and we're gonna start with that rule let me discuss these tabs so rules are rules you have in this current document forms are our GUI forms so just a user interface they can create to the drive your model hopefully we have time I'll try to get to that later today global forms so forms is just for what's in this model only global forms would be copied or written directly to the hard drive so it can be accessed from anywhere inside inventor any it'll be more Universal as opposed to foreign which is local and the same with rules external rules would be universal rule throughout inventor as opposed to rules water which we're going to cover today are just rules that are local to this file only so we'll start a new rule by right clicking here and rule or I can come up here and add rule up there as well so we're gonna add a rule here I'm gonna call this description so for this first rule to get started this we're gonna create a rule and this needs to drive me crazy is I would save and release the drawing I release a model and I would forget to put a description in so this would be something to drive to notify users that they've left the description or even any actual high property out of you know any blank eye property fields so you can see here we have some system what are called snippets and some custom snippets and these are basically lines of code sections of code that are included with inventor and we'll talk about these other tabs a little bit when we write a couple other rules but the system snippets you can see we can work with parameters we have some rules there snippets there we have positioning you know there's many hi parts I features a lot of kind of pre-written code for us that'll help so you really don't need to be a full programmer but you know definite have to be able to think logically so let's start with the description so again this will just inform the user that the description I property is empty or any of these are properties you could use this kind of code for so we're gonna start with right here if then and this and you can see if there's my expression so where it says my expression this has to be substituted with whatever your expression will be and in this case we're gonna say description so I'm just gonna double click here you can see fills that out for us and see the set of tax here you can see it's our property's value on the project tab and the description field so that's where that comes from so we're going to say if it's blank which means basically in VBA equals nothing all right then do something else so we want a message box to pop up so you can see here we have message box and we're just going to say show message box so this is the message that would be displayed to the user and this will be the title of the message box so let's just save and run it as is and you can see the title of message right there because my eye property description is still empty and I'm gonna right click again to edit the rule so we know that works I'm just gonna comment this out real quick and the comment is single quote and instead of the message box let's put an input box so basically what this will do is it's going to take the input from the dialog and it's gonna put it in the description I property so we do that by again we're going to replace my pram with this parameter so I'm just gonna copy and paste and let's change the prompt - please enter description and we'll call the title missing eye drop and we'll leave the fall entry alone and let's say save and run OOP if and you can see the description comes up and we'll say description here let's say okay and if I go up to the I properties you can see it put it right in there so that's a nice little reminder for users and again that would be something maybe you want to put in your template okay so let's try another example actually the trigger is not I forgot to talk about the trigger so right now I've been running a rule by clicking down here save and run another way to run that is with the event triggers so if I click that you'll see my rule that I wrote here and these are the triggers I can use to drive this rule so I could have it when I open a new document after opening before save after save cetera so I think this would make more sense to put right before the safe right if you put it after save it's gonna save then enter the description which would be the units hit save again so this rule before saving a document it's going to pop up with a dialog and then it will save so let me just blank out the field here so when I hit save okay I'm gonna give it a name and save and you can see the pop-up there okay Ned not well that will save the document with that decided description which in this case is the fourth entry because I didn't change it okay let's look at another example so I'm gonna add another rule and this let's call this step file so I know a lot of you guys are now working with outside vendors and you have to send maybe step file out to them so you know most of the time it's done file export and then you say the step file but that can be automated so if we look at the customs Snippets you'll see one these are all the custom snippets here and you can see one of them is step you even have I just and sat files so if I just double click on the step file one you can see writes the code for us automatically and we have some other options here so for this example you can change the format for one alright there's different step formats like 2 or 3 to 14 and other options so I could just comment this out remember the single quote and the gray means it's a comment so I could fax get rid of the single quote and I could author and I could just behavior it so when this gets exported the step file it will take the author property that's within a step file and populate it with Hegeman so I'm just cooked save and run whoo and you can see it delayed for a second because it was saving a step file so let's take a look I'm gonna open here and we've got all files you'll see the step file is not there let's see what happened widen that run then you check out the rule again should run and let's take them out of look there's a step file maybe I didn't give it long enough to wait but you see the step father now and if we take a look at that rule and the comment how the custom snippets and I can see you sad sack files I just files you can see all the different formats and these are pretty much written code you're gave me do a print document one and just show that real quick you just change the parameters here and just run this on demand without having to go through the print dialog box so let me cancel this okay as far as the trigger for this oops I'm gonna go there as far as the trigger again we could put this after saving a document or before saving the document but as you're working you know if you have a large model it may take a few extra seconds to to create the step file and you don't always want to wait you know who has to three seconds to wait every time on save right so you can create a trigger and in a different manner by adding one line above this the first line I'm going to enter it is going to be this trigger equals I trigger zero and it's safe and what this allows me to do is I can just click this now the I trigger and it will execute any code that I have with that line in it so let me go in here for a second let me delete the step file and I'm going to die trigger and it that should have created the step file for us I don't think I'm waiting long enough no it's not quickly but why he's not running and it delayed last time but that line will allow you this trigger I trivial zero will um let you run your rule by clicking it I trigger option there okay okay so let's look at another example so for this one I have a model setup and basically it's a square with just a through-hole and my width is gonna equal the height and I'm going to want the hole diameter is going to be minus three less than the height okay so I'm gonna add a new rule called limits and this one's going to put restraints on our maximum and minimum height so for that we can just come here to the wizard and I'm gonna click parameter limits and this gonna take our parameter height and give it a maximum and minimum value so I'm going to put a maximum value of thirty and a minimum value of four you can see the code already here written for us in this wizard this will be the message that's displayed I'm just gonna hit apply and let's take a look at that I'm just gonna say even run none of my parameters so let's try something above thirty let's try thirty-one you can see the message that we get right maximum vu maximum allowed values 30 and the values can be corrected to the maximum which is thirty so when I hit OK you'll see automatic had changed back to thirty and if I change it to three I get the minimum error message and it changes the minimum automatically to four say okay I'm done let me edit this rule now and sure let's go to my so you can see I have one the limit and diameter set up here that one's suppressed you can see he's grayed out because I didn't want it to run when I hit the trigger or any other triggers I may have had let me suppress this rule and edit this rule so we're gonna take this rule a step further so you can see the comments I have here so what I want now is if the height is less than four I want the height to be the minimum which is four and I want to suppress the whole if the height is greater than 30 I want the diameter to be 29 and so let's add that rule in so the first rule again less than four and suppress the whole so how do we suppress the whole we've come over to the model tab I can click on the model and give me the parameters here in this window but if I right click I can capture current state and you can see the current state of the model right the whole is the feature is active which is the name whole is active and it's true which means it's not suppressed this is the extrusion it's not tapered so it's zero degrees those tapered you see the angle in here I don't need that so I get delete that and this is the current diameter type minus three so I don't need to change that right now but I do need to change this to suppress which is basically false and if the height is greater than 30 I want the diameter to be 29 so I'm going to come here to the diameter I could take this in obviously if I'm just going to right click and tap your current state and we're just gonna say diameter equals 29 and we're still gonna have this show the message box and of course you can always rewrite the message here by clicking what's in quotes but let's just save that and we'll close this and let's see if that works so we'll go up to parameters again let me move this out of the way over here so 31 and 3 hold on I forgot to unsuppressed the rule I'm gonna regenerate the rule okay there it is you can see the hole is now suppressed let's go to 31 and you see a diameter change of 29 and the height is 30 well you can see one of the conditions if you remember earlier we have a question okay clean answer that so if you noticed earlier in that whenever shown a PowerPoint slides we said we have to test every variation right with our rule and one of the variation we did not test is something in between the two values and you see what's happening here the through-hole is not coming back so that is something I will need to be addressed so let's go back into the rule okay and the last rule should be let me just copy paste from here is that rule here so if the height is between 4 and 30 the damage should be 3 inches less than the height that's to what I want that's the rule I started with initially so I need to add one more line right one more loops over here I need to have one more condition so since there is no more else is glasses just an else so if it's less than 40 we have covered greater than 30 we have covered but now we need to cover everything else in between so if it's not under if it's not less than 4 and it's not greater than 30 right that's everything else so I don't need to put any other condition here so I'm just gonna say else let's kind of type this in manually just going to take this line else the diameter is going to be height minus 3 and also I need to make sure the suppressed hole comes back so let me copy this you put it here will stay true oh and actually I should have put this here as well all right if it's greater than 30 I want the future to be unsuppressed so I'm gonna suppress it less than for every other condition we want to unsuppressed the hole let's save and run a test that now so let's come in here let's change the height to 3 good 31 and change the height to 29 and we need test values in between like 14 and you can see it's minus 3 now and you added the rule now what I'd like to do is if it's less than four I wanted let's talk about changing material as well in here so if it's less than four we want to suppress the whole and we want the material to be ABS plastic it's great in 30 since it's so large that changes to steel and if it's between the two values let's say aluminum so let's start right here I'm gonna add another line and go back to the system snippets and material is located on their material under high properties material so by just double-click on that we have this but it needs a value we have these variable properties of material and all we need to say is equals what material and since it's less than four we say this can be ABS plastic and what you put in quotes here has to exactly match when you see up here and the materials window and the materials browser if you have a typo the rule won't work so keep that in mind and if it's greater than 30 again I'm just going to copy and paste we want the material to be steel and if it's just between the two values is there are many others things we're kind of - whoops paste that and for aluminum I don't know if there's one guy can't remember for one called material called aluminum I know there's a loop material called aluminum 6061 so we'll save and run I'll test the values so let's try with three should be be as plastic it's done and you'll see it doesn't update you have to click the material and it updates and edit through it again whoops not the rule I'm sorry come here try valley between 4 and 30 yeah the material isn't updated until you click on it well it should be alone anyway I keep cutting there go to here test another value 33 and you can see change to steel didn't the browser the graphics area change the steel we can see it's not updated there until I click on it so I'm not sure if that was intended design or not but if you're working with materials just keep that in mind okay and the last thing we'd want to do is create some kind of trigger for this so let me hit save and I try to talk about forums I'm sorry not a trigger the trigger is gonna be when you change the the primer obviously so to do this I'm going to talk about forms a little bit and I'm gonna create a form of right-clicking here add form again this form would just be local to this document so you saw that I was when I was changing the height I had to go back into the effects dialog to do that so now when I had a form these are all my parameters within the drawing and these are my rules that I've created so and here's some eye problems I could add to my form so one thing I can do is I can add height to the form and you'll see I get a real-time update here and form one is here and I can rename that title to model properties or something like that okay so when I click on any of these headings any of these labels down here is where I can control the font and other options here as far as placement and like height I could change the justification the size limits on the box and whether I can resize it and whether this is a read-only box or not so right now I'm going to leave it as read-only false so I can edit it so I'm gonna hit OK again I can run the form by just clicking on it and I can change the parameters of the model here and hit done you can see the model updates its changing material it's giving me the through-hole and we still get that error message let's change it to 33 we get the error message and the whole comes back and to change the material we head up the form again we also the description one in the first example so what I could do is I can even add a new tag group you'll see what that does there I'm gonna put this below I could just drag these around and that's gonna be in that first tag group I could also add another tag group see there's the up but tab there and for that when I could add like description revision number or maybe project so revision number I'm gonna make as read-only as fault a read-only is true humps are and the project description I'll leave those in there has read-only false right so the user can go in there and edit it you can see the format right now is not in the right and group so what I'm gonna have to do is you can see just by the way it's grouped here it's not under the tag group folder so I'm just going to drag it right into the folder and you'll see the tree change here and now you can see some his second tag group so let me move this over to this one this to that one I don't see how the tabs look now let's prove this to the first tag group okay there we go don't say okay now we can run this again we can change the height we can change the description and the project I property as well I just play that and if we come back up here you can see description and a project has changed right they're at it again and the tag group name is up here so this one may be called change height and this one be you know I properties okay okay and think those are pretty much the examples I had any questions am I gonna go through that too quickly so I see Clayton answered a couple questions [Music] without question you type in many questions panel there so this can be used there is so yes you can so we have a question the question is so could this be used to export a PDF every time I say me did the IDW for sure 100% um if we had a rule the only thing is it's not included in the rule that showed you in the custom snippets and I wish they would add that however I do have where is my section of code here give me a second so what I have is I keep a word document like this with all the ones I write all the ones I use quite often and you can see one of them is printed to pedia and actually I found this a few years back doing a search on in Google and if you just do that I think you'll be able to find one is there any way to include this I could send this out to people Ashley yes sorry um yeah we can do that yeah so if I try to send mr. Ashley maybe we can send it to all the users out there sure so let me take this and let me discuss how to use this now so you would obviously you'd have to you maybe want to put this in your template right so let's imagine a second you have a rule here let's call it PDF and I'm just gonna paste the code here so in this code right you can see it's printing to this folder so you'll have to replace this in the code anytime you see this this we can go search and replace and you'll say find this and replace with you know your network drive whenever that may be and they could just replace all and that will I will say you know to whatever location is like and you can easily also update the file name here so basically all of quotes double quotes are his text output and if you run the ruler make more sense and you can in the triggers let me not say that bull I in the event triggers is he drawings you can even make this an external rule and so if we go to drawings so to--trying opens up or you create the rule in here and then the trigger would be this document or all documents you may be that match actually next one would probably better in this case so if you need to do it for all PDFs and you can do it after saving I could enter that code there okay could you maybe show how the rules applied to assemblies the rules will work the same way in an assembly so let me start any new assembly you'll start a logic tab and if the parameters aren't in the model what you can do is you can hit this link button and pull the parameters in so you can change to here and you can see you pull these parameters in from my part I see with maybe what you're saying the hind you can't be controlled from here so yeah so you can you have the rule look back I'm not trying to do it offhand but you could drive it from here for sure I'm just not sure the exact code to do that again I'm not a program yourself so what's even vault basic I'm not sure even what that's referring to it was a way to create a button on the ribbon to run a rule you can definitely do that create a button and I believe that has been done before I don't again I'm not a program so I don't know how to do that I don't know if that would be done VBA or within inventor I don't think that can be done within a better that may be more on the back end or I think you may be able to come in here if we go to the VBA editors I think we'll we need there we add rule um where's the VBA editor can't recall how to get there add form no that's not a form well yes to answer the button to answer the button on the ribbon yes you can definitely do that can you save an external rule involved yes you can save any file in the ball you just have to remember to check it in so it won't you'll have to open the file and I guess it'll be a text file or like a B bit of a DLL or different type of extension so just a mime of all can accept any type of file now the only thing you won't have is the only thing you won't have is an interface like here like the ball checking dialog so you may have to drag and drop oh that's true going back to the rib button on the ribbon yeah the eye trigger would be another way but I don't know if he's asking I think maybe wants a specific button for his rule so can you explain how external rules work so external rules when you create a rule here you create act external rule and you can see now that wants me to save outside of on my hard drive somewhere so you would just save it and then your trigger could be when you hide your triggers let me go back to the manage tab ok QC xdf so a rule show up here and you can add it again with these triggers here you can even import if you go to the add rule so in the custom write you can merge you can use that as a snippet even the rule and add it into your favorites here into your snippets share that document with us the which one the one I showed earlier the word document yeah well I'll send that out to you guys I think you're talking my snippets here these so I have some snippets here so this one returns to home view this one does a zoom all because what I'll do is I'll copy/paste portion of this into code I write if at all I think just to talk to me talk about yeah we'll try to get this out to you guys so you can see this is the one I used earlier so these are all snippets I used to use when I was in the industry and I just put this in the templates any tips for managing a code for a complex rule I think the only advice I can give is you know you have to do it sections at a time all right don't try to write the whole code at once right sections of code like I did earlier and if you're not sure where you're ever in doubt or where the air is coming from comment things out so if I wasn't sure where my arrow is happening you know you can put comments so these don't run and just keep trying to narrow it down all right but again just make sure your rules work on your CAD model you know is totally flexible and you've this you've tested all variations before you write down a logic code and then trying to write the code against sections at a time commenting out when needed all right don't try to rush Harry don't try to write everything at once do save and run a lot and go back and edit save and run edit okay Paul prefers I save your I bunch of ups text and use them externals always cache to your local workspace okay so I mean if it's not a so I need back to external rules if you do an external rule it can be a VB or I Lodge VB file you just have to drag and drop into the vault just like the text file and yes and yeah I guess yeah you always have to get the local copy down from the wall to your local workspace is your way to hit save as and have it run the rule when save as is clicked um I don't think save as is a trigger is it that's interesting there is no save as I imagine like from what from my experience I guess there probably is a way to do it but I guess not within high logic triggers again if you go you know kind of back into the VB to the vb.net then I'm guessing you probably could and have it run as like an external rule or haven't run inside of Windows and it's constantly monitoring monitoring inventor but within I logic I don't think there's a way because I don't see a save as trigger but I imagine that is possible is there any snippet that helps meat export to previous version of a drawing or print to a previous version so again I I'm not sure if we were referring to both previous version or what previous version like old versions folder I kinda have here again the VB the vb.net is very powerful and it can probably be done but again I don't think it'd be done within the AI logic domain here if you knew if you know enough code yeah you could definitely write it in here but again that's beyond my capabilities so is there any step in it's pretty nice version can you create your own trigger so again I guess I just depend as a general answer yes you probably could again if you know enough coding I feel like a programmer generally speaking I'd say yes you could probably create your own other type of trigger other than what's seen here alright but basically most of the triggers will be upon material change maybe or high property change you know they thought of most other scenarios here any modern parameter change but I would imagine yeah you probably could create some other kind of trigger other than the parameters or any of these triggers that are any of these events that are already included can the previous save as trigger question be saw by having the part somebody has a read-only file so let me see so it's read-only you save as I think even if it's read only to save as will still let you save it out I think that's why they save as if I'm understanding your question correctly I knew even if it's read only to say that still works I think what you're maybe thinking is the save as doesn't work and then it'll go back to save I'm not sure I don't think maybe maybe I'm on the understanding that question there okay so any other questions hope that answered them if not you know let me know and I'll try and give a more detailed answer if I have an answer any question okay oh if I use a safe you're gonna read only I've never tried that so let's try that so let me do this so I think when Angela is saying let me copy and we paste it in here all right let's change us to read-only and let's open that copy now so I have let me unsuppressed this rule go back to events triggers so if I have this as let's say maybe before save so it's read-only so I shouldn't be allowed to save right now yes I guess when you hit save as yeah so that automatic goes into I guess that's what she's saying when you take your read-only file automatically goes to save has but will that run the rule let me see so instead of this rule let me suppress this you add a rule just a description rule oops is nothing then you want to show the message box right to meet only so I can't I'm not sure for the sake of time let me get on to those questions sorry about that Angela let me get back to you and I'll test that offline and let you know okay while I'm going to open let's go to nice arcs question while I'm open when I'm going to open the new joint template would be possible to ask for sheet size orientation yes you could definitely do that so that would be and the triggers you'll see new document all right so you can put the rule upon new document or you can put the rule right into your into your template you could add that rule can we had a rules connected sheet named drawings from the browser with part number inserted in the joint so the sheet name drawing what do you mean by sheet name drawing where is a sheet name is that sheet named this is rename this and insert that as the part number so in that case yeah I would say you definitely could I mean I like so powerfully can definitely extract almost anything in the browser as a variable so I would say yes that can be done when you do a save as does the code and triggers stay with the new file yes it does they said the Sydney any other questions I mean I wish I was program programmer to answer give you more detailed answers sure even give you the codes for these but again you know I just again I use more of the basics we do have programmers within a company and I go to for any tough questions and you know Google is your friend a lot of the these snippets that I save are snippets like googled and just you know I just test it in you know just fiddled with till I got it right so that's where I start with a lot of my code is a Google search if I don't know it if it's not again if it's a snippets not already their update an old title block with new one yes that could definitely be done as well and import rules from another version yeah so the rules are basically a text file you can even copy and paste it so you can open the old file if you wanted to copy it to a word document or a text file open your new file and paste it in there that would be the brute force way are getting file what this is their link to this webinar to be provided oh yeah we're gonna try to email this out to you guys so actually has a list about everyone that's registered and if your email is accurate that's what she'll be sending it to our belief is that right - that's right okay it'll go out tomorrow so maybe I should talk about some of these in here or you guys get it so let me just go over some of these so this returns to home view you'll notice that if you write some code so my logic rules what happens is it doesn't go back to home view right it'll stay in some other kind of view maybe zoom way out or zoom going in so what I found is this line of code well basically it's like clicking the home view and not a recent in your model okay that's almost like zoom ah it's making zoom all on your model local of thing you may need this when you update you know you hit the I'm thinking let me model this is missing eye properties so I had this as in the past where I used to work we used to have the file name had to match the part number so I did a check on that and if people left a revision out and you again you would add these rules and then the trigger would be something like before save or after safe there's a print pdf on again remember to change the path in this code and here is where I used to link the high property model I properties to the drawing our properties I know some people use the draw our properties but I always think that all the I properties from your drawing hand your templates should come from a model and I needed a way to just overwrite everything and this one would overwrite that this code here and modify my properties description would take the property is Krypton I'm sorry the I property description and you could automatically insert the box well these are variables they have to declare in your model but it could give you like an automated description where would add the type this is again this this is probably not gonna be as relevant to you guys this for more of a reminder for myself on how to I just concatenate a description from the variables in your model okay and this is just a file path then you can that I use sometimes for prompting so I would use something like this sometimes in this code here where you could get a dialog box saying where do you want to save but when you guys save to PDF it's mostly I believe most of the time to the same folder all the time so yeah we'll get to start to you guys you save that any other questions okay so it doesn't like there any more questions coming in I miss her made down to the bottom here okay I'm at the bottom of the window actions coming in give you guys another you know 10 20 seconds here another question please get it in okay ash I don't think I see any more questions coming in okay well thank you bond further presentation today um and I'll just let everyone know that if you have additional questions you can simply reply to that confirmation or reminder email that you received from GoToWebinar we can get those to bond or your sales rep get questions answered but once again if you could take a few moments to fill out the short survey we would appreciate it it will just automatically pop up as we close down today and again you will receive a email tomorrow containing the link for the presentation today in that extra document as well and thanks for tuning yeah everybody have a great day everybody
Info
Channel: Hagerman & Company, Inc.
Views: 6,476
Rating: 5 out of 5
Keywords:
Id: eNGTZ25U1KU
Channel Id: undefined
Length: 55min 27sec (3327 seconds)
Published: Thu Apr 23 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.