Monday, May 16, 2011

Edit a Flat Pattern Orientation

Issue:
When you create a flat pattern for a sheet metal part, Inventor seems to rotate or flip the flat in an unwanted way. Is there a way to change the orientation of the flat pattern?

Solution:
You can do this by right-clicking on the flat pattern node in the browser and choosing Edit Flat Pattern Definition.

As an added note, you can pre-determine the base face (the side facing up) by selecting that face before creating the flat pattern.









If you've defined a simplified punch and center point you can specify that it is shown on the flat pattern as well.



Thursday, May 12, 2011

Autodesk Inventor Wind Turbine Video

Here's a very impressive Inventor animation on YouTube. The video's creator reports that this project was taken on, in order to explore the concept of low speed wind turbines and learn new CAD skills. I think this is an outstanding way to learn Inventor.

According to the video details the turbine is 212 feet tall and the control surfaces are 62 feet long by 12.5 feet wide.




Some Interesting Related Links 
(compiled by the TheWindGinProject and reposted here):
Generator designed specifically for wind turbines - http://www.exro.com/
4 generator wind turbine - http://www.libertyturbine.com/
Tilt Down Tower - http://www.youtube.com/watch?v=Nf7vqRb1LBw
Power Consumption Table - http://www.absak.com/library/power-consumption-table

Monday, May 9, 2011

Where to Download Mechanical Desktop (MDT)

Issue: 
You have a "pile" of old Mechanical Desktop files and would like to open them in Inventor and reuse them as much as possible, but you don't see MDT on the install options of your version of Inventor.


Solution:
To open MDT files in Inventor 2010 or later you need to have MDT on your computer. You can download MDT 2009 (the last version released before it was discontinued) from the link listed below, and use it to edit and convert MDT files as needed.





Thursday, May 5, 2011

iLogic Update and Zoom All after a size change.

Here is a quick tip that you might find helpful.



Issue:
You have some iLogic code in a rule that changes the length of a part. It works great but you'd like to have the rule update the part on screen and zoom to fit, so that a large change of length will fit on screen.
 
Solution:
You can add the following lines of code to your rule to make this happen:

'update all
iLogicVb.UpdateWhenDone = True
'zoom all
ThisApplication.ActiveView.Fit




Thursday, April 28, 2011

Using iLogic to Trim a File Name to Populate iProperties

Issue:
You name your files with long file names consisting of a part number and some other information, and you’d like to extract that information from the file name to automatically populate the iProperties. For instance you have a file name made up of a part number and a revision number such as:
34-0987 Rev 2.ipt



Solution:
Combining the part number and revision number in the file name is actually the convention I use every day at the office. We employ a very structured part numbering/file naming system that allows us to keep an organized file system. Having the revision number in the file name removes all guess work involved with rolling component revision levels in assemblies. 

I use a simple iLogic rule in my files to extract the information from the file names and write it to the part number and revision number iProperties. The trick is using VB text string manipulation functions to strip off the information not needed.

For instance this line of code uses the VB Left function to count from the left of the string and keep only the first 7 characters for the iLogic ThisDoc.FileName(False) function:

iProperties.Value("Project", "Part Number") = (Left(ThisDoc.FileName(False),7))

The False option of the FileName function specifies the file name without the extension (34-0987 Rev 2.ipt becomes just 34-0987 Rev 2).
The VB Left function syntax is:  Left (string, length)

So this line returns: 34-0987 to the Part Number iProperty.

This next line returns the revision number by starting at the left of the file name and keeping only one character.

iProperties.Value("Project", "Revision Number") = (Right(ThisDoc.FileName(False),1))

The VB Right function syntax is:  Right (string, length)

So this line returns: 2 to the Revision Number iProperty. 
 
But what if some of our revision numbers vary in the number of characters? 
For instance: 34-0987 Rev 10 and/or 34-0987 Rev 0.3

In that case we’d use the Mid function such as this:
iProperties.Value("Project", "Revision Number") = (Mid(ThisDoc.FileName(False),13))

This line starts at the 13th character from the left and keeps everything from there on. 

So it returns: 
10 (where 34-0987 Rev 10 is the part number)
0.3 (where 34-0987 Rev 0.3 is the part number)
2 (where 34-0987 Rev 2 is the part number)

The VB Mid function syntax used here is:  Mid (string, start)

If we had a long file name such as 34-0987, 4x4 Steel Bracket, Rev 5.ipt we could use the Mid function to selectively write part of the file name to the Description iProperties by specifying not only the start but also the length of the text string to select. In this case starting at character 10 and  selecting the next 17 characters. 

iProperties.Value("Project", "Description") = (Mid(ThisDoc.FileName(False),10,17))

This returns: 4x4 Steel Bracket as the description. This illustrates the use of the Mid function with a Length, but of course to use that line effectively, your description would need to always remain the same number of characters. However, you might be able to use the Len function to get the character count of the string and create a function in the code to calculate the number of characters remaining once the file name and Rev number are subtracted, see the link below for more on the Len function and other VB String Manipulation tools.

The VB Mid function syntax for specifying the length also is:  Mid (string, start, length)
You can find more information on VB Text String Manipulation here:
http://msdn.microsoft.com/en-us/library/e3s99sd8%28v=vs.80%29.aspx

Thanks to Quinn for the subject of this topic.

Wednesday, April 27, 2011

Bring Back the Classic Right Click Menu in Autodesk Inventor 2012

Issue:
You've tried to use the new Marking Menus in Inventor 2012, but find that they are too slow, too busy, or too distracting to use comfortably. You'd prefer to use the old style right click context menu found in earlier releases of Inventor. Is there a way to set the interface back to the old style?


Solution:
Fortunately, Autodesk has provided an option to disable the marking menu and use the classic old style right click context menu. To find this option go to the Tools tab and click the Customize button.



Then select the Marking Menu tab and check the Use Classic Context Menu check box:


This allows you to work as you have in the past, using the old style right click menu.



Update:
Inventor 2017 R2 allows you to turn off the Marking Menu and Mini Toolbars by going to the View tab > User Interface button as shown:




Previous to Inventor 2017 R2:

Of course now you're probably going to want to know how to disable the mini toolbars and use just the classic style dialog boxes.

Unfortunately, Autodesk has not provided the ability to turn off the mini toolbars, so we're stuck with the current strange Jekyll and Hyde interface, which is cluttered, distracting and in many cases incomplete.

You might take a moment to go to the Feature Request link and request that Autodesk fix this in the next release, so that there is an option to use just the classic dialog boxes. The more requests they get on this, the more likely it is to be changed, so do your part and let them know what you think about it.

Monday, April 25, 2011

Using Excel and iLogic to Retrieve Part Numbers From a Drawing Log

Issue:
Because you don't use Vault and don't use an MRP or ERP system you utilize a simple spreadsheet as a part number log to record part numbers and descriptions. This works well, but you'd like to use iLogic to read the spreadsheet and copy in the information you've already entered, rather than having to re-type it or copy/paste it.


Solution:
You can use the GoExcel.Open function in iLogic to do this. I use this approach at home for a simple and effective drawing log. It allows me to maintain consistency between the drawing log and my models. Having the information in the spreadsheet allows me to search and index past designs quickly. Here's an example:

This spreadsheet contains just two columns. One for the Part Number and one for the Description.

 

The first thing needed in the iLogic rule is a line to locate the spreadsheet, such as:


GoExcel.Open("J:\My Drawing Log.xls", "Sheet1")

When the iLogic rule is triggered, it follows the GoExcel address. I then want to tell it what infromation to read from the sheet. I'll add a For/Next function to it, to look at Column A and find the first empty cell in that column.  In the example above this would be cell 8A.


'index row 2 through 10000
For rowPN = 2 To 10000
'find first empty cell in column A
 If (GoExcel.CellValue("A" & rowPN) = "") Then
'create a variable for the cell value that is one row less than the empty cell row
    lastPN = GoExcel.CellValue("A" & rowPN - 1)
    lastDesc = GoExcel.CellValue("B" & rowPN- 1)
         Exit For
 End If
Next

In the snippet above the variable called lastPN reads the value of the cell that is one less the first empty cell in Column A. Then a variable called lastDesc is set to the value in the same row but for column B.

So in this case iLogic would read in the Part Number: 09-0805 and the Description: hardware, latch, cam action

In order to write these values to the model I'll use this bit of code:

'check to see if Part Number is the same as the file name or blank
If iProperties.Value("Project", "Part Number") = ThisDoc.FileName(False) Or iProperties.Value("Project", "Part Number") = "" Then
'set iProperty to value read in from excel
iProperties.Value("Project", "Part Number")  =  lastPN
'set iProperty to value read in from excel
iProperties.Value("Project", "Description")  =  lastDesc
Else
End If

This checks the information in spreadsheet against the iProperties of the model and then writes the values of the target cells to them if the part number is the same as the file name (less the file extension) or if the part number is empty.

To add a new part number to my drawing log, I would simply fill in the Part# and Description for the next row, and then save the spreadsheet:



Now when the rule is run, this new Part Number and Description are looked up and written to the model file iProperties.

Next, I've added a confirmation dialog box with Yes/No buttons to the end of the rule to allow me to accept or reject the returned values (in case I run the rule without remembering to save the spreadsheet after adding a new row, etc.)



'show results and ask user to confirm results
question = MessageBox.Show("PN: " & lastPN & vbLf _
& "Description: " & lastDesc & vbLf _
& "Is this correct?", "iLogic from Excel", MessageBoxButtons.YesNo )

'if answer is no
If question = vbNo Then
'clear these iProperties
iProperties.Value("Project", "Part Number")  =  ""
iProperties.Value("Project", "Description")  =  ""
'run rule again
Goto StartRule
'if answer is yes exit rule
Else End If

If the information is incorrect I click No and the Part Number and Description iProperties are cleared and then the rule is run from the beginning again. If the information is correct, then the rule exits.

Note that if an empty cell is found further up the list, the iLogic rule will stop at it and read in the row above it. In the example below a cell in column A has been cleared and the spreadsheet saved.


Now the rule will return the part number and description for row 4, since cell 5A is empty. I often use this to update existing models by inserting a blank row below the changed part number and then running the rule in the corresponding model. Then I simply remove the empty row when done.

Here is the code for the complete rule:


'---------start of iLogic code---------

StartRule:
'read excel file
GoExcel.Open("J:\My Drawing Log.xls", "Sheet1")

'index row 2 through 10000
For rowPN = 2 To 10000
'find first empty cell in column A
 If (GoExcel.CellValue("A" & rowPN) = "") Then
'create a variable for the cell value that is one row less than 
'the empty cell row
    lastPN = GoExcel.CellValue("A" & rowPN - 1)
      lastDesc = GoExcel.CellValue("B" & rowPN- 1)
         Exit For
 End If
Next

'check to see if Part Number is the same as the file name or blank
If iProperties.Value("Project", "Part Number") = ThisDoc.FileName(False) _  
Or iProperties.Value("Project", "Part Number") = "" Then
'set iProperty to value read in from excel
iProperties.Value("Project", "Part Number")  =  lastPN
'set iProperty to value read in from excel
iProperties.Value("Project", "Description")  =  lastDesc
Else
End If

'show results and ask user to confirm results
question = MessageBox.Show("PN: " & lastPN & vbLf _
&"Description: " & lastDesc & vbLf _
& "Is this correct?", "iLogic from Excel", MessageBoxButtons.YesNo )

'if answer is no
If question = vbNo Then
'clear these iProperties
iProperties.Value("Project", "Part Number")  =  ""
iProperties.Value("Project", "Description")  =  ""
'run rule again
Goto StartRule
'if answer is yes exit rule
Else End If


'---------end of iLogic code---------