Design and Manufacturing solutions through Digital Prototyping and Interoperability

Tag Archives: Inventor

Time to Tame the Beast! Learn to Customize Autodesk Inventor

Autodesk Inventor API - Object Model

Recently, a friend (and colleague) asked me how I go about planning the development of a new application or customisation project. He already has a pretty good handle on code structure and syntax, but struggles to know where to start in actually bringing his idea to life. In his words, he suffers from “the worst kind of writers’ block.” I totally sympathise with this issue as I have the same problem myself, quite frequently. The truth is, unless I’m working on a commercial project that has been carefully scoped, budgeted and scheduled, most of the time I just ‘hack’ something together. Having said that, there are definitely a couple of tips and tricks I can share which should help novice coders get started with customising Autodesk Inventor. If there is enough interest, I could do a similar article on the Vault equivalent.

I’m going to split this up into a couple of categories:

  1. Interrogating a live document to learn from and capture information
  2. Writing pseudo code to figure out the ‘flow’ of your program

Interrogating a live document

Usually when I start working on a customisation job, I only have a rough idea of what I want to achieve. With a limited mental picture of how the finished tool may look, often the only thing I know at the start, is the rough area of Inventor I’ll be working with. For example, if I’m building a tool to ensure that the designer fills out all the appropriate metadata for a model, I know straight away, that I’ll be working a lot with iProperties.

Autodesk Inventor API Documentation

API Documentation for Autodesk Inventor

To find out more where these objects are stored, and how they interact with other objects, you need a reference. The API documentation for Inventor, while thorough, is pretty dry to read and can be difficult to navigate if you’re unfamiliar with it. By using the little trick below however, you can see the API objects in a live document, populated with real data, which makes it a lot easier to understand. Let’s say, for example, you’re looking for the “Work Point” object that represents the origin of a particular part. Now of course can go into the model browser and find it, but what if you want to access it programmatically, where does it live in the structure of the model document? Watch the video below to see how to get this information quickly.

Interrogating the Open Document in Inventor VBA Environment

The API is a complex beast, with a lot of objects, and a deep structure. To give you a head-start, the table below lists a few of the objects and collections that I use most often.

Object / Collection Contains
Document.ComponentDefinition Parameters / Constraints / Work Geometry / Occurrences / Mass Properties
Application.Documents File Operations (Open, Save etc.)
Document.Materials Materials
 Document.PropertySets iProperties
 Document.ReferencedDocuments Document References

Pseudo-code

Before diving in to the actual code, I find it is often helpful to design the logic and flow of the program by using diagrams like flowcharts. Additionally, writing out the decisions that need to be made, in plain English, can help get things clear in your head. Writing pseudo code allows you to get the structure down quickly, without worrying about the syntax and intricacies of the programming language that you will be working in later. So what is pseudo-code exactly, you may ask? I’ll try to explain with an example.

Let’s say that we have a model of a box, whose length can be manipulated. Additionally, it’s colour is dependant on it’s length. Short boxes are red, medium ones are yellow, and long ones are green.

  • Maths
    • Length < 150mm — Red
    • 150mm <= Length < 250mm — Yellow
    • Length >= 250mm — Green
  • Plain English – If the length of the box is less than 150mm, then make it a red colour. If it’s length is between 150mm and 250mm, then make it yellow, and if it is longer than 250mm, then make it green.
  • Pseudo-code

Pseudo-Code

 

  • Actual code (VB.net for example)

VB Code

Hopefully these techniques give you some confidence to get stuck in and try your first Inventor customisation project. While I’d suggest you begin with iLogic rules and forms, sometimes you hit a wall with iLogic’s scope, and you need to delve into the API to access the areas you want to work with.

’til next time…

Design & Motion are Between The Lines

Keeping Up Appearances with Autodesk InventorJust a quick post to let our readers know we have a Guest Post on Shaan Hurley’s legendary Autodesk Blog Between The Lines. Given the historical significance of Between The Lines with respect to CAD blogging, I’m pretty stoked to have finally got some work up there. Keeping Up Appearances with Autodesk Inventor shows Inventor power users how to ‘window select’ multiple faces, so they can apply appearance overrides in one hit. So please go take a look and hopefully you lot can put it to good use.

iLogic Assemblies – It’s wise to normalise!

Here’s a quick tip for those who have discovered the power of iLogic in Inventor.

When creating configurable Inventor assemblies using iLogic, there’s a process that you should follow when it comes to naming your components. It’s called “normalising” (or “normalizing for you Americans), and it will make dealing with multiple unique instances of your assembly a lot easier.

 

As promised in the video, I have attached a copy of the dataset for anyone who is interested in seeing how it was constructed or to take a look at the code. Here it is:

iLogicBox Model

(Feature image mashup, credits: Ruth Hartnup – “All her eyes are evil”  and Monica Arellano-Ongpin - “Los ojos de un hombre”)


 

Autodesk Inventor 3D Sketch Bends Ease Tube Transitions

I prefer to work in the 2D environment when possible. It’s easier to control factors, but there are times when the 3D sketch environment saves a lot of time, and times where a 3D sketch is simply the only option.

3D Tube Bend Render in Autodesk Inventor

One such instance is routing tubing from a non-orthogonal axis fitting to a mount on an orthogonal axis. I could have used multiple 2D sketches to develop multiple work features in order to handle the transition, but what a waste of time. Plus with those extra steps, the design history gets quite complicated and begging for update failures.

3D Bend

Using a 3D sketch to layout linear geometry and 3D Bend to control the bend transitions is quite easy.  In my example, I have both mounting axes, as well as 2D geometry which delineates start and end segment tube definitions. All I need is the stuff in between.

Autodesk Inventor 3D Sketch Geometry with Work axes

  • Create a 3D sketch, and ‘Include’ all the 2D geometry that is needed as a reference.
  • Draw Line geometry representing the linear segments that are needed in the transitions.
  • Constrain the lines as needed to the references.
  • Add Dimensional constraints as needed.
  • Create 3D Bend at each vertex.

Done

Autodesk Inventor 3D Sketch Bend Geometry

Some Tips

In order for 3D Bend to work, all related linear geometry must be in the same 3D sketch. It will not work on geometry in more than one 3D sketch.

When you use the ‘Include Geometry’ tool, any geometries included can be used in a Sweep operation. In the video below, I demonstrate how included geometry can be used as part of the path in a Sweep. Note that if you want that included geometry to be ignored, just like in 2D sketches, you have to change their type to construction.

A path driven sweep will fail if your included geometry (non-construction) overlaps your sketched geometry. Essentially doubling back on itself. This will cause the Sweep to fail. Since the problem is covered up by well built line-work, it is often very difficult to discover this.

How Does It Update?

Brilliantly! I started with the tube ending all the way up to the flange, but realized that I needed room for a tube hinge  I simply adjusted the 2D sketch references for the gap needed and the updates behaved perfectly.

Autodesk Inventor 3D Sketch Tube Surface Transition

Video Demo on our YouTube Channel

 

SolidWorks 2014 VS. Inventor 2015 Filleting Showdown

SolidWorks 2014 vs Inventor 2015 Fillet dialogI’ve recently been getting stuck into learning some Autodesk CAM products, the most accessible of which are the HSM products. The dominant product of the three available is naturally the one they were all born from, HSMWorks for SolidWorks. There are far more people using that at the moment, than are using Inventor HSM and CAM 360. As a result, since I’m supporting the products in Australia and New Zealand for CADPRO Systems, I really needed to learn a bit about SolidWorks. So it’s been an intense three weeks learning a new CAD platform to a stage where I could hack up models where needed and effectively toolpath with HSMWorks. I’ve really enjoyed it and although I’ve always respected SolidWorks, as I do other mechanical CAD packages, it was nice to finally see what it’s all about on the other side of the trenches. Unsurprisingly it’s a handy set of noughts and ones, which come together to form a pretty handy tool… much like Inventor is.Curvy Part

These two products have a lot of history, each product has its areas of strengths and weaknesses. One product will suit one business better than the other, then it will be the reverse for the next company. So I don’t want to turn this into a ‘mine is bigger than yours’ contest, but as a long standing Inventor user whom respects SolidWorks achievements and well known surfacing capability, this sure did make me smirk.

 

Inventor | View Representations – You just clicked “Ok,” didn’t you?

Even for the seasoned Autodesk Inventor users out there, a frustrating little problem in Inventor assemblies occasionally pops up that seems to defy all logic.

Change the visibility of a component or workplane etc. and suddenly EVERYTHING becomes visible or invisible in your assembly? You’ve probably unintentionally broken the associativity of a view rep somewhere, by just clicking “Ok” to a dialog box that you either didn’t read or didn’t understand. #AmIRight

This video aims to provide some clarity as to what that dialog really means, and how to re-associate the view reps.

Design View Representation Associativity in Autodesk Inventor