Design and Manufacturing solutions through Digital Prototyping and Interoperability

Tag Archives: Inventor

Autodesk Inventor: Copy Items Between Sheets Easily

It is easy to create another standard view in Inventor drawings, but what about when the view has been detailed or you have a customized Parts List? You can easily copy Views and Parts Lists from sheet to sheet, complete with all the annotations associated.

Copy / Paste

  • Select the items to copy: Select from the Graphics Window or from the Browser.
  • Pick the Sheet header in the browser
  • Paste through the context menu: After picking the header, right-click -> and select Paste.

Autodesk Inventor Copy Paste View

Drag / Drop Between Sheets

Alternately, you can drag to copy the items.

  • Select the items to be copied: The same procedure applies from above
  • Pick / drag the selected items towards the browser
  • Drop into the view tree: This is the odd part. You need to drop the items down into the tree organization. Just pull you cursor down below where the Views are organized; you should notice the darkened line marker alerting you to where the items will be copied. When satisfied, release the mouse button.

Autodesk Inventor Drag Views to copy them between sheets

Autodesk Inventor Pasted views

In the example above notice the Parts List and views that were copied. All annotations were copied over with the views. In this example I’ve edited the parts list and balloons according the the sheet purpose after the copy was complete.

@%#&! Autodesk Vault just overwrote my file

Recover Overwritten Vault CAD FilesIf you’ve used Autodesk Vault at any time, then its highly likely you have downloaded a file you already have checked out and overwrote a chunk of your work. Unfortunately that’s just one of several scenarios, which can result in you losing your work. The real trick to preventing this of course, is to check your work into Vault every couple of hours (similar to continually saving within your CAD application). Nevertheless, there could be a number of reasons why checking in your work continuously isn’t feasible. I often hear the comment “I wish Vault had a recycle bin”, I’ve even murmured those words myself and you know what it’s a reasonable request. Why can’t Vault create an old version of the files it’s overwriting? Although its likely possible, it could get mighty confusing.

Just over a year ago, one of my staff downloaded a skeletal / master model from Vault while trying to work around a problem he had, the problem was he already had it checked out, but worse he hadn’t checked in the file for a couple of days. He had created components, built a main assembly and even produced a drawing. Needless to say overwriting his skeletal model with what was essentially a template file, was highly undesirable. Don’t judge him though, he’s new to this Autodesk Inventor / Vault game, all while dealing with a temperamental VPN connection & a new replicated Vault, so he’s been doing a grand job. All of my staff and myself have all made this mistake once or twice.

Autodesk Vault Inventor Project File Old Versions Setting

In the past the Inventor Old Versions folder has been our first port of call, depending on how your Inventor Project File is setup, these folders can be a gold mine during these arse puckering moments. The project file setting I am referring to is shown in the image above, I like to set Old Versions To Keep On Save to equal 5 on all Vault project files. Of course, this tactic is of no use to AutoCAD users, but it does have some of it’s own backup treasures which may or may not be useful within any given situation.

This time however, I’m glad he made the mistake, because it prompted me to ponder if some of the new Windows Explorer features in Windows 7 on wards would help out here. The particular feature which inspired me to Google for a solution, was the undo tool. In Windows 7 or 8 if you delete a file in a folder, then press Ctrl + Z, it will undo the delete command and restore the file. In this case the file had been overwritten by an application and not as a result of the user interacting directly with the folder. So I took a punt and searched for:

“Recovering an overwritten file”

The first search return took me to this site. Method 3 of 4 was a particular surprise, I couldn’t believe it, I’d seen this tab in the Windows 7 Property menu before but I’d never realized it’s impact. The command worked perfectly, the 2 days of lost work was returned thanks to this hidden gem. You can even open or copy the previous version to a different location if you aren’t confident it’s the right way to go. Be warned though, this isn’t a fail safe, but this is always worth a check in this situation. The best part though? This is handy for all Windows users, not just Vault users.

Windows 7 Restore Previous Version Tab

Then I went and took a look at Windows 8 to make sure this behaviour still existed, it turns out it doesn’t and this article explains why. Thankfully Microsoft just improved it out right, the only catch is you have to enable it and point it to a non system drive. Take a look at this well written article explaining how to do that. Another bit of good news is Windows 10 has maintained the same system as Windows 8, so we are looking good into the future. If you are the owner of your Autodesk software, then you could re-purpose your Autodesk USB installation media, to leverage this native Windows benefit.

These tools for Windows 7 & 8 are cracking little gems, lurking in the background, rarely used but invaluable all the same just waiting for the opportunity to shine and save your butt. The best part is they can be used on any file stored on your hard drive and not just those your use for CAD. Check them out and if you need to, enable it. With respect to the title of this post, I haven’t really shown you how to prevent it happening in the first place, I will do this in an upcoming post covering dialog and prompt suppression within Vault and it’s application add-ins.

Autodesk Inventor API: Assembly Document Hierarchy

We will look briefly at raw document references in this article, and then take a bit of time stepping into the Assembly Document container hierarchy in a follow up.

For the scope of this discussion, I will limit that object hierarchy as follows:

Document -> AssemblyDocument -> AssemblyComponentDefinition -> ComponentOccurences -> ComponentOccurence

and

ComponentOccurancesEnumerator

Assembly Components

This is what cleaned up my code tremendously. I am dividing into parts so that it is (hopefully) easier to digest.

Assembly Component Occurrences are all components in an assembly, which contain Occurrences, or each component. This section will discuss using these, and the functionality associated with extracting each portion.

Assembly Component Definition

The complete component container; similar to the CAD Bill of Materials (BOM), except that the actual BOM definition data is contained separately inside this structure.

Base Object Class: AssemblyDocument

Type: Standard Object

Object Definition: AssemblyComponentDefinition

Returned By: AssemblyDocument.ComponentDefinition Function

Access to the Assembly component structure is performed through this object. We need to declare an ‘AssemblyComponentDefinition’ object, and assign it with data from a call to the Assembly Document’s ‘ComponentDefinition’ function.

Example:

Enter

Now that the Assembly Component Definition is filled, it is time to do some digging.

Component Occurrences

As you might expect, these are the containers that each component document is present in.

If a part definition occurs 10 times in an assembly, there are 10 Component Occurrences, and all 10 will show up in this container. The benefit here is that skeleton and reference files are not part of the ‘Assembly Component Definition’ structure, so they don’t get in the way here.

Base Object Class: AssemblyComponentDefinition

Type: Collection Object

Object Definition: ComponentOccurrence

Referenced at: AssemblyComponentDefinition.Occurences

The Occurrences collection is the whole enchilada of Component Occurrences, which you can access directly.

Now we can declare a ‘ComponentOccurence’ object, and use it to inspect each ‘ComponentOccurrence’ that exists in our ‘AssemblyComponentDefinition’.

In this example, I used a For Each function to pull each component.

Example:

This is a great way to quickly run through the Assembly and get every component. What follows is more functionality when you want to be specific about what you are getting.

Occurrence Enumeration

This object goes hand in hand with the next function. While its complete functionality is still not quite understood by me, this object acts as a container to catch a collection of Component Occurrences, and disseminate them by type into an intelligent object with appropriate functions.

Base Object Class: ComponentOccurences

Type: Collection Object

Object Definition: ComponentOccurrencesEnumerator

Referenced At: itself as dimensioned object

In the last example, we bypassed the need for this and iterated through our Assembly Component Definition’s collection of Components directly, like a book, one page at a time. However when we want the Assembly Component Definition to hand us a big list of components, we need somewhere to put them.  The Inventor API has provided this container for that purpose.

We need to define the ‘ComponentOccurrenceEnumerator’ object for the next section.

Example:

‘ Define the Component Occurrence Enumerator 
Dim oLeafOccs As ComponentOccurrencesEnumerator

All Leaf Occurrences

Leaf Occurrences are part files in an assembly, the end of any branching in the structure.

Base Object Class: AssemblyComponentDefinition

Type: Function

Function Call: Occurences.AllLeafOccurrences

Returns: ComponentOccurrence

This function returns the very same Component Occurrences as we iterated through previously, however this function only returns a collection of those components that represent the end of assembly branches, Part or ‘Leaf’ objects.

While we were able to peruse the Assembly Component Definition’s components like reading a book, in this function, the Assembly Component Definition object will dump an appendix in our lap.

Here, we will fill our Component Occurrence Enumerator by a call to the Component Definition’s ‘AllLeafOccurrences’ function. Then define another Component Occurrence to represent and investigate each Leaf Occurrence that is in our filled Enumerator.

Example :

All Referenced Occurrences

The Inventor API will also permit users to extract all occurrences of specific Inventor documents.

Base Object Class: AssemblyComponentDefinition

Type: Function

Function Call: AssemblyComponentDefinition.Occurences.

AllReferencedOccurrences(Document)

Returns: ComponentOccurrences

This function will return all instances of the specified document, at any level within a Component Definition.

This example takes a file name, and returns all occurrences of it that exist. It uses a call to opened documents expecting that if it exists, Inventor has it opened. Some good bounds checking could be applied to catch any error associated with an unopened file.

Example:

Closing Thoughts

I used this code to automate the production of drawings, running out as many as 20 at a time, right out of an assembly drawing file. I added substantial enhancements so that each drawing contained views, parts lists, as well as automating the population of various key iProperty values as well.

Help Button

I hope this helps you get a jump start on iLogic Assembly code as much as it did for me. If you’d like more information on Inventor, iLogic, or even how we built the drawing generator, stop by Design & Motion.

 

REFERENCES:

Mod The Machine article “Accessing Assembly Components” from 2009

The Autodesk Inventor 2014 API chart

Mod the Machine Article “Understanding File References” from 2008

Autodesk Inventor API: General Document Notes

It has been some time since I was regularly programming. My background was C++ and I was moving to C# when, well, I started writing; it appears as though there is only enough time to either research engineering software, or research software API.

Recently I decided I wanted some drawing automation; something to take care of the repetitive tasks beyond a good template. Being quite detail oriented, I like a complete drawing. This requires a lot of copying parent exploded views, parts lists, and so forth. While creating an iLogic drawing iProperties checker, I thought iLogic could help me with the drawing creation as well.

What follows is a collection of key notes that I made during my iLogic Assembly document function research; these are the same functions we used to develop the automated drawing creation tool.

Autodesk Inventor API Chart

We will look briefly at the general Document class in this article, and then take a bit of time stepping into the Assembly Document container hierarchy in a follow up.

Introduction

It is very important to understand the Inventor assembly document structure and hierarchy. Each component in an assembly is a Document. Each Document is simply a reference to a file that is, or will be upon saving, stored on a file server or local drive.

Documents however can be interpreted in numerous ways. In our case, Documents represent Parts, Assemblies, Spreadsheets, Drawings, etc. Inventor has Class Objects that have intelligence built in to deal with how an Assembly Document, for example, will behave.

Just Give Me Everything

First, we can get all file references by calling for ‘AllReferencedDocuments’. This function is basically a document dump.

Base Object Class: Document

Type: Function Call

Object Function:  AllReferencedDocuments

Returns: Document object

This function does a jam-up job of returning all FILE instances within any Document object. Only one instance per file is returned, regardless of how many times a part is used in an assembly.

This function is not reserved to Assembly files and will work on any Document class based object. This makes it a great, universal front end build for code that needs to work in a broad range of Inventor documents.

Caution should be used to provide significant bounds checking as to what type of Document is being returned, as AllReferencedDocuments will return anything at all; Spreadsheets, Part files, you name it.

Example: (working with only the part files in a document)

‘ Get the active assembly document.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
‘ Iterate through all of the documents referenced by the assembly.
Dim oDoc As Document
For Each oDoc In oAsmDoc.AllReferencedDocuments

‘ Verify that the document is a part.
If oDoc.DocumentType = kPartDocumentObject Then
Dim oPartDoc As PartDocument
oPartDoc = oDoc

‘——————
‘Do something with the part document here
‘——————-

End If
Next

This is great when you want everything, but I need to see some structure, and having some refinement would be nice. We’ll return with those details and the Assembly Document container hierarchy in the follow-up article.

REFERENCES:

Mod The Machine article “Accessing Assembly Components” from 2009

The Autodesk Inventor 2014 API chart

Mod the Machine Article “Understanding File References” from 2008

And they’re off! – The (Great?) Inventor Constraint Race

Ok so this one is a bit silly,  but it has practical implications.

In Inventor these days, there are so many ways of sticking one bit to another bit. Constraints, Joints, the “Assemble” command, iMates, or even no constraints at all in certain skeletal modelling workflows. So which is the most efficient!? Like anything, there is no cut and dried answer to that question, that would apply to all cases. It’s a matter of horses for courses.

Horses RacingCredit: Paul Kehrer“Full Stretch”

Just for fun, I thought I’d put a few of these methods to the test in a somewhat controlled environment. I decided to eliminate some variables by keeping the test to one type of connection, a simple pin in a hole, multiplied a few times.

The “horses” are:

  • #1 – “New-fangled Assemble”   Place and “assemble” one by one. Thanks to Scott Moyse for entering this horse in the race.
  • #2 – “Drag-Connect”   Place all then drag-connect.
  • #3 – “Trusty Old Constraint”  Place all then manually constrain.
  • #4 – “G’day iMate”   Named iMates for automatic connection on placement. Thanks to Peter Crawley for entering this horse in the race.
  • #5 = “All the iMates”   Right-click and select “Place at all Matching iMates.”  Another entry courtesy of Peter Crawley, but it was disqualified from the race for alleged doping after finishing in only 2 seconds.

I thought I’d introduce them first, one by one…


And now…. without further ado, place your bets, and let’s go racing!

Did you make any money?

Feature image credit: A Day At The RacesGary J. Wood

Autodesk Inventor : How to Change Welding Material

I was kicking about the Autodesk Discussion Groups and found this question:

Default Weldment Material [How to change it?]

Your drawing Parts lists show the material for all welded assemblies (weldments) as Welded Aluminum-6061. Using the assembly iProperties in the weldment gets you nowhere, as the material is deactivated. This frustrated me for some time too, and the solution is sadly quite logical: It’s a weld bead, so go to the Welding Bead section!

From the Ribbon, navigate to the Weld tab. Under the Process panel, pick Welds to go to the area that you would add your welds.

In the Assembly Browser, pick Welds -> Beads. From the context menu, pick iProperties.

Inventor 2015 Weldment Bead Material

The Physical tab will now allow you to change the Material. This makes perfect sense since your assembly does not have a material, but you are adding material in the welding process. (You can actually make the change one level up from the Welds collection header.)

After the change, the material will update in your Inventor Assembly Parts Lists.

Join the Community