*** Update: per request of a reader I added dual unit and split header support for parts lists as well. The new macros are marked in red.
For some users, generic or general tables are an under-appreciated beast in Inventor.
Fig 1: Location of General table on the ribbon
Part of the reason could be that generic tables can morph into completely different type of tables, depending on what data you feed into them.
- When you have no view selected, a generic table allows you to bring in an Excel or CSV file and do parts list work.
Tip: it can be a good alternative for the regular parts list command when you are dealing with large assemblies.
A parts list generated with a generic table will load much less data and consume less memory when working with LOD views in your drawing. - When you have a view of an iPart or iAssembly selected, the generic table allows you to document the various configurations in the iAssembly or iPart.
In this blog post I wanted to concentrate on the usage as explained in b) and more precisely what you can do to format the generic table to fit your needs.
I wanted to address two limitations of the table with just a couple of lines of VBA code.
Displaying dual units in a general table
Dimensions and hole notes have the capability of displaying dual units. However generic tables do not have that capability.
This problem was brought up recently in this newsgroup post.
How do you add a dual or alternate unit to one of the columns in your table? Take the example of the iPart with 3 members as shown in Fig 2
Fig 2: Simple iPart with corresponding general table
To add another unit to the table, copy and paste this text in a new VBA module in Inventor's ApplicationProject (typically called Default.ivb). When working with a parts list, use this text instead.
Change the line that says
headertext = "Column 4"
To whatever the column header text is in the column you want to treat. In our example, I replace it with
headertext = "LengthA"
Now select your table first and then run the macro called "dual_units_table".
The macro will look at the alternate unit used in the linear dimension style of your active drawing standard and use that unit as second unit with this as result
Fig 3: Same iPart general table with inches added as dual unit
Wrapping column headers in a general table
This problem was brought up in this newsgroup post.
What if the column header text in your table is getting too long and you want to wrap the header into multiple lines?
Inventor does not let you enter a hard carriage returns in the Format Column dialog unfortunately, as can be seen in Fig 4.
Fig 4: Long heading but no way to wrap it to the next line
A more realistic table can be seen in the picture below .
How do you go from an unwieldy wide and space wasting table like this
to a more concise table like this
Just copy and paste this text in a new VBA module in Inventor's ApplicationProject and run the macro called "SplitHeaderCustomTable". When working with a parts list, use this text and run the macro "SplitHeaderPartsListTable" instead.
The macro will look at your first generic table and treat it automatically, so no need to select anything.
It looks for any spaces in your header text and splits the text based on the spaces.
Tip: if you want to wrap the first 2 lines of your header only and leave the remainder of the header untouched, simply change
Const max_wrap = 3
To
Const max_wrap = 2
I used this technique to keep the string "Dia. A" on the same line as it contains a space and would otherwise be automatically split.
Enjoy!
Bob



Subscribe
looks good to me
Posted by: newendtables.com | 09/04/2011 at 09:42 AM
Has this been accomplished for Parts List ?
Posted by: Bob | 03/28/2012 at 02:06 PM
It has been now thanks to your comment :-)
I have added the code relevant to a partslist.
So you can now use the dual units on a length column both in parts lists and generic tables.
And also splitting the column header is now possible both in a generic and a parts list table.
Thanks for the idea.
Bob
Posted by: Bob Van der Donck | 03/29/2012 at 10:11 AM