Hello, I am attempting to learn a little bit of iLogic on my own in order to accomplish what will hopefully be a huge time saver in the long run. My company has lots of parts/assemblies that are all very similar except for a few parameters that need to change. I have set up this iAssembly so that I can easily go to the iAssemby table, change some parameters and get a new part. However, one parameter that I need to vary is the hole size and thread, but those are not selectable options in the iAssembly table. I have attempted to work around this with iLogic, and I actually have code (seen below) that does what I want it to do, but I want this iAssembly to be able to accomadate many more entries. Currently, the code is not set up for that and contains some bugs.
In plain English, I would like my code to proceed as follows:
If "129053B.iam" is the active iAssembly component, set the assembly feature "Hole 1" to the specified thread type, designation, and class.
Else If "122223C.iam" is the active iAssembly component, set the assembly feature "Hole 1" to the specified thread type, designation, and class.
and so on and so forth as I add different configurations.
The following code is what actually does what I want it to do for these two configurations, but it it not setup for future entries and contains some bugs.
If Component.iComponentIsActive("129053B.iam") = True Then
Feature.SetThread("Hole 1", "ANSI Unified Screw Threads", "1/2-13 UNC", "2B")
Else If Component.iComponentIsActive("122223C.iam") = True Then
Feature.SetThread("Hole 1", "ANSI Unified Screw Threads", "3/8-16 UNC", "2B")
End If
InventorVb.DocumentUpdate()
If Component.iComponentIsActive("122223C.iam") = True Then
Feature.SetThread("Hole 1", "ANSI Unified Screw Threads", "3/8-16 UNC", "2B")
Else If Component.iComponentIsActive("129053B.iam")= True Then
Feature.SetThread("Hole 1", "ANSI Unified Screw Threads", "1/2-13 UNC", "2B")
End If
You would think that I would be just fine with only the first half of the code, and then just append Else Ifs as needed, but it doesn't seem to change the hole correctly when switching between the two components.
Am I just missing a simple step, or is there a better way to accomplish what I am trying to do? Every time I change the active iAssembly I want this rule to run.
Thanks a bunch.
Here are some pictures for reference.
Alex
Extra Credit Question: How can I make "Hole 1" a clearance hole or a threaded hole with iLogic?