Inventor General Discussion

Inventor General Discussion

Reply
Valued Contributor
dbcox
Posts: 61
Registered: ‎10-14-2009
Message 1 of 6 (470 Views)
Accepted Solution

Threaded Holes with iLogic

470 Views, 5 Replies
09-05-2013 01:36 PM

Hi,

 

I am using Inventor and Excel to create several parts automatically.  Most everything is driven directly by Excel through the parameter table, but since Inventor will not import tolerances, I am using iLogic to assign tolerances to those critical dimensions.

 

I am also having trouble with threaded holes through.  The parts have drilled and tapped holes.  I can easily assign a parameter to the drill and thread depth, but not the thread size/designation.  With some investigation, I discovered iLogic has the "ThreadDesignation" command.  The problem is, there are about 30 different threads it could be, depending on the part, so I cannot do a simple if then statement to determine which of a couple of options it would be.

 

I tried linking the thread designation through Excel, but Inventor will not import text...  I then tried to create the designation by importing the diameter, pitch, and 0 or 1 variable for UNC or UNF (using IF THEN to determine UNC or UNF), but had no luck there. So then I tried to link the Excel file using the GoExcel.CellValue command.  That worked, EXCEPT, it would only work once.  If the thread size changed in Excel, I would get an error saying a unit change isnt' allowed (although no units where changed).

 

Any help will be greatly appreciated.

 

David Cox

Matt,

 

Thanks for the info!  I thought about that, and that is certainly doable.  However, I am pretty new to iLogic.  Can you elaborate on the "select case statement" and how I need to code it?  I assume it will lookup a value (the number parameter) in Excel and return the thread value.  But, I don't know how to code that.

*Expert Elite*
mrattray
Posts: 2,507
Registered: ‎09-13-2011
Message 2 of 6 (438 Views)

Re: Threaded Holes with iLogic

09-06-2013 07:13 AM in reply to: dbcox

You could encode the thread into some arbitrary number and link that through Excel.

1) List on paper every possible thread (that's applicable to this) and assign them all an arbitrary number (1,2,3,etc.)

2) Link that value into Inventor along with your other parameters.

3) Use a select case statement to decode back to a real thread designation as a string variable.

4) Use the ThreadDesignation method to assign the thread callout.

 

If you don't like this idea (it is kind of crude) you could try the Inventor Customization forum as well.

Mike (not Matt) Rattray

Valued Contributor
dbcox
Posts: 61
Registered: ‎10-14-2009
Message 3 of 6 (435 Views)

Re: Threaded Holes with iLogic

09-06-2013 07:38 AM in reply to: mrattray

Matt,

 

Thanks for the info!  I thought about that, and that is certainly doable.  However, I am pretty new to iLogic.  Can you elaborate on the "select case statement" and how I need to code it?  I assume it will lookup a value (the number parameter) in Excel and return the thread value.  But, I don't know how to code that.

*Expert Elite*
mrattray
Posts: 2,507
Registered: ‎09-13-2011
Message 4 of 6 (432 Views)

Re: Threaded Holes with iLogic

09-06-2013 07:45 AM in reply to: dbcox

Select case is just a more sophisticated form of If Then. It's better for big messy logic statements. Here's an example:

 

Sub ExampleSelect()

Dim test As Integer

test = 2

Select Case test
Case = 1
 'Do this if test = 1
Case = 2, 3
 'Do this is test = 2 or 3
Case Else
 'Do this if other conditions are false
End Select

End Sub



Sub Example IfThen()

Dim test As Integer

test = 2

If test = 1 then
'Do this if test = 1
ElseIf test = 2 Or test = 3 Then
'Do this if test = 2 or 3
Else
'Do this if other conditions are false
End If

End Sub

 

These two subs do exaclty the same thing, but one is a bit "wordier" than the other.

Mike (not Matt) Rattray

Valued Contributor
dbcox
Posts: 61
Registered: ‎10-14-2009
Message 5 of 6 (420 Views)

Re: Threaded Holes with iLogic

09-06-2013 10:11 AM in reply to: mrattray

Mike,

 

Thank you for the quick reply!  Is there a way to pull in an Excel file to accomplish the same thing?  The issue is there are many, many possibilities, and we add to them regularly.  If I could just add to a "master" spreadsheet that Inventor could reference, I would be in a lot better shape.  Is that possible?

 

Thanks,


David

Valued Contributor
dbcox
Posts: 61
Registered: ‎10-14-2009
Message 6 of 6 (402 Views)

Re: Threaded Holes with iLogic

09-07-2013 10:00 AM in reply to: dbcox

I figured it out!  It turns out the error I was getting about the unit change was NOT due to iLogic.  I had placed the text parameter in the same column as all of my dimensional values, which was causing the error!

 

I still wish Autodesk would allow the parameter table import text, especially now that text is allowed...

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.