Pages

Tuesday, April 02, 2013

Using iLogic to Change Threads in Components... From the Assembly!

“Words form the thread on which we string our experiences.”
 Aldous Huxley

Not that long ago, I was tasked with a unique challenge. 

Trying to change threads using iLogic.  And while I knew it was possible, there was an additional twist. 

I had to do it from the assembly.   Now that's a way to add a wrinkle or two!

How do I change the threads in each component from the assembly?

 So I hit my favorite search engine, Google, and started surfing away.



And low and behold, I found my solution in the Autodesk Wikihelp, diving so deep I needed a diving bell. 

Torn from the Autodesk Wikihelp, the rule I need!

With a little testing, and verifying, I was quickly able to get this little gem to work.  The biggest thing I like about this version, is it allows for the changing to different thread types.  Such as from Metric, to Imperial. 

Using this method, I was able to set my threads from the assembly, without having to drill down into each part. 

In this example, I'm changing from a coarse thread to a fine thread, but with a little more work, I could expand this rule to do a lot more, and have it controlling much more than just coarse to fine.

Each "Feature.SetThread" command calls to the component in the following method:
"Bore :1"    ==>  This is the component being called out
"Threaded Hole"     ==>   This is the name of the feature being called
"ANSI Unified Screw Threads"         ==>   The thread type.  Basically, the tab in the Thread.xls chart.
"3/4-10 UNC"    ==>   The thread designation
"3B"   ==>   The thread class

Below is the full rule changing the threads for both the components in the assembly.

If Thread_Type = "Coarse" Then
'Callout for Bore
Feature.SetThread("Bore :1", "Threaded Hole", "ANSI Unified Screw Threads", "3/4-10 UNC", "3B")
'Callout for Shaft
Feature.SetThread("Shaft:1", "Threaded Shaft", "ANSI Unified Screw Threads", "3/4-10 UNC", "3A")

ElseIf Thread_Type = "Fine" Then
'Callout for Bore
Feature.SetThread("Bore :1", "Threaded Hole", "ANSI Unified Screw Threads", "3/4-16 UNF", "3B")
'Callout for Shaft
Feature.SetThread("Shaft:1", "Threaded Shaft", "ANSI Unified Screw Threads", "3/4-16 UNF", "3A")

End If


Now, with a multi-value list set in Parameters, I can use this small ilogic rule to change the threads for me!

Here's the rule setting coarse threads.  Notice the callout in the assembly browser.


The rule setting coarse threads

Now the rule is changing the threads to fine threads.  Now see how the callouts have changed to find in the assembly browser.



Now with fine threads, all changed by the rule.

That's it!  I hope you find this tip helpful!  And if you'd like to download the files I used in this example, you can download them from my Autodesk 360 site here!







2 comments:

  1. Anonymous3:02 AM

    Hi,

    I'm trying to use the Feature.SetThread function for ISO metric threads, but every time I try to put like "M45x2" for the thread designation, it opens a messagebox that tells me "M45x2" is wrong..

    Do you have any idea on how to solve this problem?

    ReplyDelete
    Replies
    1. Anonymous,

      Try adding the class to the line as well. For example:

      Feature.SetThread("Part1:1", "Shaft", "ANSI Metric M Profile", "M11x1.5", "4g6g")

      Delete