AU Class
AU Class
class - AU

Understanding Geometry and B-Rep in Inventor and Fusion 360

Diesen Kurs teilen
Suchen Sie nach Stichwörtern in Videos, Präsentationsfolien und Handouts:

Beschreibung

A critical component of any CAD system is the ability to accurately describe a design. For mechanical CAD systems, the solid and surface geometry that's used to represent part geometry is extremely important. This class will investigate the internals of how Inventor software and Fusion 360 software represent solids and surfaces. We'll look at how solids and surfaces are constructed and modified, and how you can access this information through the Inventor and Fusion 360 APIs. We'll look at how to use the API to query and evaluate the shape of a model. We'll also cover some modeling functionality that is only available through the API. Because both Inventor and Fusion 360 both use Shape Manager for the modeling core and the APIs for both products are very similar in this area, both products are covered, along with their few differences.

Wichtige Erkenntnisse

  • Discover how Inventor and Fusion 360 represent surfaces and solids and what B-Rep is
  • Understand how to use the Inventor and Fusion 360 APIs to query a model
  • Understand what transient or temporary B-Rep is and discover some of its capabilities
  • Understand how to create and display transient and temporary B-Rep bodies

Referent

Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
  • Chapters
  • descriptions off, selected
  • subtitles off, selected
      Transcript

      BRIAN EKINS: And so I'm Brian Ekins. A little bit about me so. I first saw my first CAD system in the mid '70s I guess on a high school field trip. And there's an old Applicon 880 system I think, and that just blew me away. And so right then I said, ah, that's what I want to do. So Brigham Young had a degree at the time called design engineering. It was kind of mechanical engineering with a little bit of computer science, but focused towards CAD.

      And so again it was when CAD was kind of new and not very many people knew it. And so I went through that and I got a job at Intergraph where I was using CAD. And so I was a CAD instructor and developing course material for the systems they had at the time and then as an applications engineer for about 10 years there. So that was working with kind of sales support, showing customers that our software could do it better than the other guy kind of thing. And so that was kind of fun. You're building boats one week and jewelry the next week and ceiling fans the next week, whatever the customer came in was doing.

      And then they came to me and said, we're working on this new software called Solid Edge and you like to program. So at BYU we've done some programming on the different CAD systems. I enjoyed that. And so working with customers too with is AEI write little programs to automate stuff. And they said, well, you like to program. You kind of understand it from the user perspectives. Why don't you design the API for Solid Edge? I had no idea what that meant, but kind of got thrown into it. And so did the API for Solid Edge, then moved to Autodesk, did it for Inventor, and then lately for Fusion.

      And so now I've got my own company just kind of helping people automate themselves. And I'm working on some software I hope to have released here pretty soon. And I like to still use this stuff. So here's some stuff I've designed and made some woodworking things. And some of these we'll talk about a little later because I've written programs to be able to do it and using some of the stuff we're going to talk about today, and this one just to throw in a little bit.

      I don't know if you've seen this thing, this shaper origin. So it's a handheld CNC router. So handheld CNC doesn't seem to go together, but should take a look at it. So I've been working with them to route some software awhile ago from Fusion to that device. So these things were cut out on it. Some of them were anyway.

      So this is my prediction. I have no idea if it's right, but I want to get a judgment on an idea of the audience here. So how many here are programming with Fusion now? 1, 2, 3. I was wrong. OK.

      [LAUGHTER]

      So most of you Inventor. I assumed it would be majority Inventor, I just didn't know what the percentage would be. So this class I said B-Rep for Inventor and Fusion. And the stuff we're going to talk about's almost identical between the two. So I thought, well, just why not cover it both? And so where there are some differences I'll point them out, but there's not very much that is different actually.

      All right. So why should you care about this stuff to begin with? And if you're just using Inventor or Fusion, you probably don't. It's just you don't have to think about it and you'll see it in a second what we're talking about. But when you interact with the model and stuff you don't think about the internals of how it's represented and you just don't have to. It's just automatic when you pick an ad, you pick a face. But when you're programming it you need to know all these details. All right. So programming you need it.

      So let's just look real quick at building a model interactively. So we're going to make something really simple here. I drew that blue sketch and I extruded up, and then I picked a face on the back of that bottom block to create a new sketch on, and then drew that other blue sketch and extruded it forward, and then I picked these four edges to add fillets, and I picked these cylinders to position some holes. And there's our finished part. It's really simple. Nothing new here.

      So let's look specifically even at the fillet. So when you place a fillet interactively-- so you run the command, brings up this nice dialog, guides you through everything you need to do a fillet. All right. So you're selecting edges. Really easy to pick exactly what edge, boop, boop, boop. You can specify the radius, you click OK, and there's the result.

      So to do the same thing with the inner program, it's really not that much different. So it's really this call. So there's a collection of fillets that supports this function to say Create, Add a Simple Fillet. So a simple fillet is basically a it's not variable and it doesn't have set backs and all that other stuff. So I pass in a list of edges, the radius, and it creates a fillet. So basically the same, right?

      And that's really what Inventor is. You've got your user interface where I've got the dialog, I'm picking things on the screen, and the command is gathering input from you. And when you click OK it takes that input and it calls an internal function to say create this fillet and here's the information. And so Inventor then does the result and you end up with the final fillet.

      When I call the API, instead of having command to gather the input you kind of gather it in ways we'll talk about in a second. And then I call that function add simple and it takes that and then it calls the same function that the command did to create the fillet. So both end up doing exactly the same thing inside core Inventor or core Fusion and it's just you've got your user interface and you've got your programming interface.

      But the big difference between these two and what we're going to focus on today is how do I pick those edges? In the UI it's really simple. I know what edge is. Just click, click, click, click, and Done. But how do I tell it those edges through a program? How do you tell it what those edges? What does that mean inside a program? And so that's what we're going to kind of look at.

      And kind of an analogy I like to look used for this is-- so the UI is like flying a plane on a nice clear day. Just pure visual. You can be in the plane with somebody and say, I want to go over there. Oh OK, and just turn over. No problems, all visual flying. The API is kind of like this. Windows are taped shut, just instruments. So it's a lot different and it's obviously a lot harder. So it's just kind of the nature of the beast. I don't think it can ever be totally simplified as easy as the users pick. So we'll talk about what's there.

      And there also isn't one way to do this stuff. So your problems are going to be different than your problem versus her problem and his problem. Everybody's going to have different things that need to be solved in different ways. And even two people that have the same problem, you could solve it in different ways and still get the right answer. So there's not really a right answer to any problem. The right answer is that it gives you the correct result you need consistently, then that's right. So when you're playing with this stuff don't worry about, oh, this is really some crazy code. But if it gives you the right answer, then it's good enough. Maybe there's a more efficient way, but if you've got it to work, that's pretty good.

      So we're going to be talking about a bunch of tools, and then you kind of figure out how to put those tools together to make it to work. And I think kind of how I approached this is it's a puzzle. So I've got this problem and I just approach it with the idea it's solvable, I just have to figure out how to put these pieces together to make it work. And I might come up with a solution today and then thinking about it for a couple of days realize, oh, there's this better way. So it kind of evolves if you continue to think about it too. So some you play with and just work with over time.

      So there's a few topics we're going to talk about, and the big one first off is topology. So we're talking about B-Rep, which we'll get into. And a part of B-Rep is something called topology. And I hope this doesn't shatter anybody's reality here, but solids aren't really solid. And what I'm going to talk about most of this class isn't really Inventor or Fusion specific, it's all the cat engines out there. This applies to them.

      And so solids aren't really solid and what they are really is they're a set of surfaces that are connected, and it's watertight, so there's no leaks. And then that is a solid. And so that's called a boundary representation. So the surfaces defined a boundary or this closed volume. And so that's what B-Rep is. B-Rep is just an abbreviation for boundary representation. So just kind of a mathematical computer graphics way of defining a solid is a B-Rep.

      So Autodesk owns a kernel that does all this modeling stuff. They call it Autodesk Shape Manager, or ASM might be referred to. And there's other ones out there, Parasolid and Acis, and they're all pretty similar. But Fusion and Inventor both based on ASM. And what we're talking about here is kind of exposing ASM. And so that's why they're the same. I mean they're built on the same thing. So we can talk about them together.

      So this topology stuff defines this envelope that encloses a solid. And as part of that, it defines how everything's connected. So that's really the topology. Topology is referring to how things connect to one another. And we'll go into more detail on this. And you don't have to see this from the back, but this is the API structure for these. So on this side Inventor, over there for Fusion. And they're identical. Fusions got two extra objects that I'll talk about when we get to them, and other than that the only difference is the names are different, but just slightly so.

      So the Fusion ones all start with B-Rep. So we chose that to differentiate it from Fusion had mesh bodies and also T spline bodies. And so these are B-Rep bodies. And Inventor just has some other names, but they're equivalent.

      So starting at the top of that, that object model structure we've got a body. And in Inventor this was a bad choice in the original design called the surface body, but really think of it again of this boundary representation. It's a body made up of surfaces, and it can be closed or open. So if it's entirely closed and watertight then it's a solid, even though that's where it's bad. It's called surface body, but it can represent a solid too.

      So we've got service body or in Fusion of B-Rep body. And so it represents this group of surfaces. And then in Fusion you have lumps. If we could do it over and again in Inventor I'd add it into in Inventor too. So inside the core lumps exist in Inventor too, it's just not exposed to the API. But the reality is you probably never use it anyway. I never found anybody yet that really needed lumps. So it probably doesn't matter that it's there.

      And the ironic thing is to put it in Fusion to be complete, but then the Fusion API or the Fusion UI makes sure that you always ever only have one lump. So lumps don't really matter in Fusion, but it's in the API. So that was kind of a goofy thing. But what a lump is, so I can have a body. A body can have one or more lumps. And so this is a body that has one lump. If I made that whole big, now I have one body, but it has two lumps. So those are two connected areas, but in venerable c that still is one body.

      If I did that same operation on Fusion it automatically breaks it into a separate body. So a body always only ever has one lump. And then there's something called a shell. So both Fusion and Inventor support a shell. And this is another one that's very rarely used. So we'll go real quick. So here I have a body, would also have one lump, but has three shells. So I've got this cube and it has two internal cubes creating voids inside the solid. And so each one of those connected set of faces are a shell.

      And so a body always has one shell that's the outside and then it can have one or more internal shells to represent voids. I mean you can't manufacture that really. I guess you can 3D print it depending on what the material is if you can get it out or whatever, but in most manufacturing these just don't occur. So the lump in the shell really aren't used very often. Typically you have one body that has one lump, that has one shell, and so you don't really care about the lump and shell part of it. So the body is really important.

      And now we're getting down into the more important things are faces. So each face represents a surface of this body. So you're already used to it in the UI. When you say create a new sketch and you go pick a face on a model, that's the same face we're talking about here. When you select a surface, that's a face. So the API face object is just the API representation of a face that you could select in the model.

      And then there are loops. And so every face always has at least one loop, that always has one outer loop. So we have a face, and here is its outer loop. And then it can have one or more internal loops-- well, zero or in internal loop. So this one has one inside loop. So when I go to a face I can say, give me your loops. And so there's always going to be one, could be more, and then for each one of those loops I can ask it are you the inside or an outside loop?

      And then there are edges. So here's an edge. Again, this is something you're very familiar with. In the UI this is what I'm picking to fillet, are edges, and this is just the API wrapper for that same kind of object. And an edge. So it represents the side of a face, but they're also important because they define the topology too, how things are connected. So there's one edge there and it's shared by those two faces. So it defines the connection between the two faces. And so I can ask that edge what are your faces that you connect? And it would give me those two, or from the face I can get the edge and then I could again ask it for which faces so I could find its adjacent edge.

      So let's look at the little bit of stuff here. All right. So I just wrote several little samples here. So a solid's not a solid. So there you can see all the faces we've gotten. But it's pretty cool, right? It behaves as a solid.

      All right. So I can get mass properties I can cut it sections, all this stuff. But it's really not. So it's asked me to pick a face. So there's the face I just selected. So now I'm going to ask that face give me your loops. So there's two loops. So it's highlighting the first loop that it found. And then a loop is made up of edges.

      So there's the first of four loops and that edge. And then each edge, remember, it finds a connection to another face. So from this face I get that edge and that edge connects to this space, and then that edge connects to that face, that edge connects to that face, that edge connects to that face. And now here's the other loop, and that edge connects to that face, and so on.

      So just to kind of illustrate the topology. So I'm using API to find all these things, and then for this I'm using client graphics or infusions called custom graphics, but same thing to be able to just draw extra graphics into the window just for the demo.

      OK. So we've got edges-- so they're pretty important. --and we've got vertices. So the vertices are the corners. So it's the ends of edges. It's not just the end of an edge, it's like an edge, it's shared too. So those three edges all share that one single vertex. And so I can ask that vertex what edges come into you, and I can ask each of those edges what are your two vertexes? And then it'll give me that vertex and then I could find the other edges that connect into it. So again, this topology. So I can walk all through that by finding who's related to who else.

      This one I won't spend much time on either. So it's confusing and you'll never use it. But just so if you're looking at the model and you wonder what the heck that is. So in Inventor it's called EdgeUse, and Fusion this BRepCoEdge. So this would be a CoEdge. So it's kind of like the loop that we talked about before. There's edges, but these are specific to that face. Remember, edges were shared. So an edge defined relationship for one edge, one face to another.

      With these CoEdges, they're specific to a face. They're not shared. And one thing that that lets you do is what this picture is showing, is that they're oriented in a consistent way. So they're head to tail around. So an outer loop goes counterclockwise around the face and any inner loops go clockwise around the face the way they're oriented. And the weird thing with these-- and we'll talk about it a little bit more in a minute. --is that they're not defined in 3D space, they're defined in the 2D parametric space of a surface. And I'll explain that more in a second. But if you're just saying I don't know what that is, doesn't matter because 99.9% you won't use it anyway.

      All right. So we've got these topology objects. And so we were talking about before, I want to place a fillet. How do I find a specific edge? All right. So here are some ways that I can get those topology objects, edges, faces, vertices. And one is by traversing that hierarchy and finding it.

      So let's say, for example, I want to find every face in this part that's parallel to the x, y plane. So I could traverse the body. I go to the body and then go through all the faces in the body and once I got every face-- and we'll talk a little bit more in a second, other stuff I can do with it. --for every face I could look to see if it's planar or not. And then if it is planar then I could get a normal from it and then see if that's parallel or perpendicular to the plane that I care about.

      I can get things from features. So if I've created an extrude feature from that extrude feature, there's some properties on it to ask it what faces did you create? All right. So if I had a box and then I created a rectangle and extruded it down to create a rectangular pocket, then I could ask it what faces did you create? And it would return those five faces that it built.

      And then some features return these categorized ones. And so an extrude is one. So I can ask it, give me your top faces. So those are the faces that were in the plane of the sketch that got built. So if I did the first extrude-- so I had a cap on each end. It would give me that cap on that face that represents the cap. It'll give me the bottom face. So in the pocket I could ask for the end faces and it would give me that bottom face, or I could ask for side faces and then it would give me all the faces around the extrude.

      So some features have that mostly I think extrude or volve, loft, maybe sweep. But all of them have where they'll give you the faces that they created, and all of them will tell you what body or bodies they impacted too in the creation. Fusion doesn't have any API for sheet metal at all, but in Inventor you can ask it in a flat pattern, give me the top face and the bottom face and I think the side faces too. So I have some shortcuts to get specific faces in the flat pattern.

      So another way to find things is by location. And this is typically if you built a part. So if I drew a sketch and extruded it, I know what size it is because I just build it and then I could say I want the face that's at this x, y, z location in space. So there's a function, it's called find by point that then would give me the face that's at that location. So I can find them by a point. Array is a point and a direction. So you're basically shooting this ray, a sun ray. You can think of it shooting this thing through the model and then it'll give me back everything that it hit and the location where it hit it.

      And by selection. So I can turn it over to the user, say you pick it, which you will do a lot for a lot of things for the initial stuff. So I'll show you some samples where have the user pick a body and then a face and then I do a whole bunch of operations after that using the other B-Rep stuff. But I need some information from the user to get started.

      So Inventor doesn't know which edges you want to fillet. You have to tell it. And so sometimes in your command you'll be asking the user, give me some stuff to start with. And then what I'm calling here by association is I can get B-Rep from some other things too. So let's see. From an assembly constraint, for example, I could get the cylinder that the constraint is tied to. So from a sketch I could get the plane that it's attached to. So I can get things from that.

      And then a really important one here that I'm including in this is by attributes. So I can basically name things. So iLogic added a new UI for this, but it's existed for years, the ability to attach attributes. So any kind of information you want to an item, and a common use for that is to just add a text string that you treat as a name so you can find it later.

      So we talked about topology, and so I've got a question for you. So everybody will take just a second is, think of what a body would be that has six faces and 12 edges. So somebody said something here. So give everybody just a second. So how many got this? So that's right. How many got this? So that's right. How many got this? How many you got this? That's right.

      So the point is topology doesn't tell me anything about the shape of this thing. All it is is telling me how everything connects, that there's some face here. Could be flat, could be this revolution thing of a curve that's a face. I don't know what it looks like, but I know it's connected to this other face.

      So one of the ways now I can figure out kind of what this thing looks like is through these evaluators, and they let me do some more examination on faces and curves. So in Inventor from a face I can get the surface evaluator, and Fusion from a B-Rep face I can get a surface evaluator-- names even the same there. --and from an edge I can get a curve evaluator, and from a CoEdge or EdgeUse we can get a curve 2D evaluator. But what these evaluators let me do is examine more about the shape of that face.

      And so some common things from a surface evaluator is so I can ask it for the area. I can get normals. So if this is some surface-- and so at some point on that it's a direction perpendicular off the surface at that point. So that's a normal. So over here it would be in this direction, appear to be in this direction. And so using this evaluator I can get normals at any point on a surface, I can get a tangencies at any point on a surface, the curvature.

      So if I got a surface, at that point what size sphere would fit into that? It's the radius. So kind of the curvature. And I can do this model space, parametric space conversion, that I'll talk about in just a second. And then I can do some similar things on a curve. I can get the length, get points along the curves, and normals, tangencies, curvatures, and one that's kind of useful is I can get strokes. So what that is for a smooth curve I can give it a tolerance and then it'll return a set of lines basically that approximate that curve within that tolerance.

      So I'll spend a second on this parametric space. It's good to have just a basic understanding of this. You won't use it a lot, but a little bit. So those evaluators sometimes work in metric space and not model space. So just so you understand what we're talking about here. And so every surface has its own 2D parametric space.

      So here's a simple surface, a plane. And so you think of just a sheet of graph paper and we've said that the lower left hand corner is 0, 0 and the upper right is 1,1. And so now I can specify any point on that plane with two values. You can give it any x, y between 0 and 1, and that will precisely define any point on that plane.

      But now if that plane's made of rubber-- so I can stretch it around any shape, but I can still define any point on that plane with just two values, the x,y. And the kind of standard for this parametric space, instead of x,y, they use UV. Means the same thing. So just some value in the one direction and some value in the other direction. But two values I can define any point on that.

      Here I've taken that and just taken the graph paper and wrapped it around till it touches, made a cylinder, but I can still define any point on that with two values. And even here just in this case I brought two of the edges till they just become a point, but then wrapped it around so now I have this sphere. And again, any two values I can precisely define any point on that. So that's the 2D parametric space of the surface.

      Let's see. Which was that I was using? It used to be you had to do it for a normal, but we made it easier now so you don't have to. But before with the normal I had to tell it what parametric space point do I want to calculate the normal at. So usually I knew where it was in 3D, then I would have to call a function and say, OK, I have a 3D point. Where does that exist in this 2D parametric space? And then I would have the UV in parametric space, and then I could pass that and say, OK, give me the normal at that point.

      Order some functions that will return information in the UV and then I can get the equivalent in model space. So you map back and forth between this 2D space and the 3D space. So usually you don't have to use it, but sometimes depending on which evaluator calls you're making, you'll have to. So I know like, for example, tangencies you have to do that in parameter space.

      And visualize that a little better hopefully. Let's see. So that one I clicked and it went iterated over all the faces in the body. So it saw that there was just one body in the file, so it just automatically did it and didn't ask me to pick anything. So it went over all the faces. And there's a very useful function on the face that says give me a point on the face. And it's just a random point on the face. And that's what I used here. And then at that point I asked it, OK, give me the normal. And when you get a normal on a face it always points outside of the solid. So that's important. It always points outside. And then I just drew these little arrows at that location.

      But that point on a face is really useful because otherwise you don't know what's on a face. So if I had a rectangle, but then I did a whole bunch of cutouts on it-- so where's a point going to be on the face, or where is it going to be in a cut out? And that'd be pretty hard for you to figure out. So that point on face turns out to be pretty useful. But it's just random where the point is, it's just it's guaranteed to be on the face. And so you can see they are kind of random where they end up. So that's just showing point on face and that the normals point out.

      So here I calculated, what? 420 by 20 normals on that face. So that gives you a little better idea of what normals are. And here's that parametric grid.

      So I'm getting the selection from the user of a face and then using that evaluator and just getting a whole bunch of points along it's consistent U value, changing the V, and drawing a series of lines basically in that direction and then stepping over another set and then doing it in the other direction to draw this grid. And so there's a lot of calculations, but you can see it's pretty fast. And then drawing it with the plane graphics.

      And here's another one kind of putting some of this together. Something that's maybe a little more semi useful, so I want to measure the thickness. So I've started an interaction events object. So that's kind of a command. So it lets me get selections from the user and it also notifies me as the user's moving the mouse over the model and where the current location of the mouse is. So I'm getting that location and it's also telling me which face he's on.

      So I get basically that point where the cursor is right now. Inventor passes that back to me just as the user moves the mouse around. So I take that point and the face that got passed in, get the normal, but then fire array in the other direction through the model. And so it fires through that point and then hits something else. And then where it hit again, that's the distance I'm measuring. So there's those two points and then I just draw a line again using client graphics to show that and display some graphics.

      Now, if there's any questions as we go along here, I'm happy to stop and take them. Any so far? OK. Yeah. So we've got this parametric space. So far we've talked about, we've got the topology, faces, edges, finds how everything is connected. We can do these evaluators, but then I can also find out exactly what shape the face is. So from a Face, an Edge, a CoEdge and Vertex--

      So from a face there's a property called geometry and it will return one of these depending on what shape it is. So I get back a cylinder, or a plane, or sphere, depending on what that face is. So if I get back a cylinder then this cylinder object will tell me has a point and a direction and a radius. So now I kind of where that cylinder is in space. So now I can find out the real geometry about that face.

      The thing that's a little bit funny about these is the cylinder I get back has a point and a direction and a radius. So by itself it's always a full cylinder and it's infinite in both directions. So what defines its boundaries are the edges of the topology, of the B-Rep. And so if I put a fillet on a corner of a cube, so I just got a partial cylinder, but what I would get back if I asked for the geometry is one of these cylinder objects. It's a full cylinder and infinite in both directions. So I have to look at the edges to know, woah, it's really a cylinder this tall.

      So they're accessed through this geometry property. There's different terms that you could call this. But when I go to face and I say give me your geometry and it gives me back a cylinder, for example, that's a tear off or it's transient or temporary, however you want to think of it, but that cylinder I get back is it's a snapshot of that geometry at that second I asked for it. Because if I go and change the model and change the size of that fillet, this doesn't change. So it's just what it looked like at the time I asked for it.

      And these geometry objects, the cylinder, the radius property, I can set. I can change it, but it's not going to change the model. So it doesn't know where it came from, it's just a way for Inventor to this cylinder guy just encapsulates all the information that would define a cylinder. But it doesn't know where it came from or how it's being used. There we go.

      So a couple of things I just want to point out that are useful with these. I don't know if people think of it as a math object, maybe more geometry, but a point object has a couple of functions that are useful, a lot of times as a distance too. So like that measure one. So I had the point that Inventor gave me where the cursor currently is and then I fire the ray through and get the other point, and then there's just a function that says distance too. So from this point I'd say give me the distance to this one, because we back the value and that's what I display.

      And I can compare two points to see if they're equal. Another very useful object is vector. So a vector just defines a direction and a distance, direction and a magnitude. It doesn't have a point. There's no position associated with a vector, it's just a direction, a direction and a magnitude. But some of these useful operations on an angle are on a vector. So I can check the angle, compare it to another vector, if it's equal to another vector, parallel, perpendicular, length.

      Normalize. What that does is I could have a vector that's any length and if I call this on it, it makes it a length of one. And that's useful sometimes. And then ScaleBy just changes the length. It scales it by some value. So these would be useful. What we were talking about before, I want to find all the faces that are parallel to maybe the x, y work plane. So you go to all the faces, I could look for all the planar ones first, and when I find one of the planes I could get a normal from it and then check to see if that normal is parallel to the normal of the x, y plane.

      All right. So maybe we can discuss this. So we're back to that problem we were doing interactively. And we're at this point, but now I'm writing a program. I'm not picking them as a user. And so I've got these four edges. How am I going to find those?

      AUDIENCE: Do you have parameters that draw [INAUDIBLE] size of the plane, you basically just go [INAUDIBLE].

      BRIAN EKINS: OK. So find them by either position in space basically. And so that will work. Yeah. These two, right? Yeah. So he's saying that we've got two edges that really are the intersection between two other faces. So maybe we can use that somehow. Any other ideas?

      Like I said before, doing this kind of stuff there isn't a right or wrong answer. If it works, call it good. Yeah. So we'll look through some code here in a second. So I wrote this up and I basically did what you guys suggested for these. And because the program is building this all from scratch, so it knows where everything is because it built the sizes. And so these I found kind of by their location. I looked for the endpoints to see if they were where I expected them to be and then used them for that.

      These get a little bit more interesting. So when I did this extrusion, remember from an extrude I can ask it, give me the top face of the extrude. And so I was able to just get this face by asking the extrude feature for it. And then these faces I could get from this extrude because those are the side faces of that extrusion. So I could get this face and then I could get the side faces from this, and then I could look to find any edges where any of these faces connect to this face.

      So we'll look at the code. I think it's not really rocket science, but it's not something you do on your first day of programming. So let's look at this program. Let's see. Where'd I put it? There we go. So here I'm just running it. There we go. So that was totally from scratch. It's opened up a brand new parts file, build all of this stuff. And here's the code to do that. Somewhere in here. Here we go, this one.

      Is that big enough in the back? I can make a little bigger. So here I'm creating a new document. So this is a Windows form application, so I'm creating an EXE, and the EXE can connect to Inventor and drive it. And so these are the easiest ones to write. They're quicker to debug than an add-in because you don't have to keep starting up and stopping Inventor. And they work pretty good. The only problem is they running out of process they run a little bit slower because there's more overhead in one process talking to another process. So I have this XE running in one process and Inventor running, and they're talking back and forth.

      And part of the reason they're slow is Inventor is over here trying to listen to the user doing stuff. And so it's listening to the user and trying to listen to this thing coming from outside. And so just too much going on. And there's this property I can call that kind of turns off the user UI so now I can just focus on calls coming from outside. So it just speeds it up. I wouldn't have to have that.

      So here I create a sketch on the x, y work plane. I know it's the third one. It's the same order they are in the browser. And then I draw a rectangle-- so this has nothing to do with the B-Rep stuff. --and then I created an extrusion. So now I have that first extrusion, the base, as extrude one. And then so from extrude one I ask it, what bodies did you create? And I know it created one, and I just get that. So the first body that it created, and so now I store that in this variable.

      So now I have the body that's out there so far. And now I want to build the sketch on the back to kind of build that tombstone looking thing on the back. I want to build a sketch on the back face of that base. And so here I just tried to use several different things in this program so you can see different approaches. But here I'm using that find using point and I'm passing in an x, y, z coordinate and a filter of what I want to get. I want to get faces. And then this is the tolerance of how close it has to be to that point, and then it return back whatever it found.

      So just point something out while we're here. So in the API, everything always is centimeters. And I was drawing the part in inches, so I'm just converting to centimeters. So I get back the first found object which should be that back face and I add a sketch to it. So now I've got a sketch on the bottom of that block that I build on the bottom. And now I'm drawing the line, an arc along the top, the line and the cross. So just that shape, and then extrude it. And I have the second extrude that defines that tombstone thing.

      All right. And now this is the code that's fighting the edges for those fillets. I was looking at it this morning. I wrote this a few days ago and I was looking at it this morning, well, I think this could be a little simpler. But I left it with what it was. That's why I say it kind of evolves over time as you think about it. But here I'm getting an edge, I get the start vertex and the end vertex, and I'm looking for an edge where it starts at 0, 0. And then the top is at 2 inches up. So I'm looking for an edge that's here and an edge that's over here. So that's what that's doing. So it's checking the vertex coordinates and then if it matches what is supposed to, it adds it to a collection of edges.

      And once I found both of them, then I quit looking and jump out. And then I add those fillets. And then here's the other one for those corners where the surfaces meet. So I have the top face of that extrude. So I have this face that I can get from the extrude, which is this.

      So I save that in the variable. So I have the top face and then I'm going to iterate from the extrude too, which is that tombstone thing. From it I can say, give me your side faces, which is going to be three faces. It's going to be that plane on one side, the cylinder on the top, and the plane down the other side. So I'm going to iterate through each of those side faces and then I'm going to see-- let's see. --and then on each of those side faces I'm going to iterate over all of its edges and then see if any of those edges connect to the top face.

      All right. So let's look at the picture. So when you're coding this stuff you got to not have any distractions. Keep everything straight. So I have this face, maybe even the model. Let's back up. So I have this face and then I'm getting each of these three faces, one on the other side. So I'm iterating over these three. And then for this face I'm iterating over each of its edges, and then as I come to each of those edges I find out if it connects to this face or not. And then if it does then I know, oh, that's the edge I want to put the fillet on.

      So first one I think when you think of oh well, yeah, all this stuff is connected, so what? But it's pretty powerful to be able to use it like this, but it does take some thought in how you can take advantage of that. Then it adds that fillet, and then I want to do the holes. So I need to find those cylinders. And so the first two on the front corners I can just ask the fillet, what faces did you create? And it's going to be those two cylinders. So it just gives it to me right off. I don't have to really hunt.

      And then for the one on that tombstone thing, again, I can just go to those side faces and look through the three side faces and just get the one where the geometry is a cylinder, and then I know that's the face there. So that's it.

      OK. So real quick, another little bit of this is there's some stuff called transient B-Rep, or transit geometry. Well, transient B-Rep in this case. And so you can create B-Rep stuff that doesn't show up in Inventor or Fusion, and it's not saved anywhere either. So you're creating B-Rep outside the context of any document. And basically you're calling ASM the geometry kernel directly to do stuff. And it's way, way faster.

      So there's a lot of overhead inside Inventor and Fusion when you create a feature because, well, first you're having to create a sketch to define shapes. So that's some overhead. And then when you do the extrusion it's having to add stuff into the browser, it's creating graphics, it's doing a lot of naming stuff so that it can keep all the parametrics correct. And so there's a lot of stuff that's happening overhead. And if you don't really need a parametric model, you just want the end result geometry, then you don't need all that stuff and you can just go to kind of the bare metal with this transient B-Rep.

      And so show a quick example. Let's see. We're almost out of time. So this is one I did in Fusion just because I'd done this more recently. So I had the part and I ran one program that put a whole bunch of points around the outside of it, and not even all the points. You can kind of see there I deleted a bunch of them. But there were 199 points on the outside of that face. And then what it would do is a Boolean operation at each one of those points with some other defined part. So it was to create like gouges on this.

      And so I had 199 points and just using a regular combined feature-- and Fusion, what do I do to subtract one body from another? It took 62 seconds. It's not horrible. And then doing the same thing with this temporary B-Rep took seven seconds. And to do the whole thing, which was 671 points, that took 31 seconds. So it's way faster. In this case, it was about an order of magnitude. But in a lot of cases, it's going to be even significantly faster than that.

      And this is another example that I had in Fusion. I'll run this one real quick. I'm going to port this over to the Inventor at some point too. So here we got a part. So this was something I was experimenting with is I want to create-- I don't know if you can see this kind of shape. I did this weird shape just as a test. So to create a shape you couldn't even really do on five axis. There's some weird places to get into it, but I wanted to do it just with the three axis router. So basically I sliced it so I could do each slice with the three axis and then glue up the slices.

      And so here I've got this weird part, and I want to do that same thing. And so here's the program. So what body do I want to cut? What's the bottom face right here? Slice thickness and the size of the board I want to lay it out on and the tool diameter, it's just defining the spacing between layouts. But now see how fast this is.

      So it already did the computation of all the body. Now you see that thing flashing, so now it's creating a real body. So now Fusion's having to do kind of parametric work now. So all the work to actually slice it and get all those pieces it did in probably a second, and then the rest of the time, which still wasn't bad, it generated this. There we go. so here's the original body sliced up and then all the pieces laid out. So then you could three axis and see those and then stack them up and you would get back the original part.

      So there's a transient geometry. In the paper I go into more detail. There's another thing you can do with B-Rep too, is you can get a mesh representation of B-Rep. So if you're feeding it to a graphics engine or something. So there's capabilities to do that.

      So I didn't post them to AU yet. I'll post them there, but also on my website I'll post them because then I can keep you up to date. That's a problem, especially samples with AU papers. I mean they go out of date and you can't update that stuff. It's just locked away on the AU website. But I'll put this on my website. And so thank you, and enjoy the party tonight.

      [APPLAUSE]

      Downloads