Soz not sure where exactly to post this,
Hey, I can't release the part im working on, but ill try and explain my issue, else I will make mock up to represent it.
im effectively working on replacing components that fit into a certain hole pattern, each of these "plug" components have the same iMates within them. The replace component command through inventor UI works fine, but im trying to automate this through iLogic.
I have an excel spreadsheet with a value called Plug Type, which the User can choose from 7 pre-determined Plugs. then names of these parts are : in the excel u basically choose 1-7 and a linked parameter plug_type is linked in the sub-assembly.
Plug 1.ipt
Plug 2.ipt
Plug 3.ipt etc
And so in the subassembly i attempted to use iLogic as follows :
if Component.IsActive("Plug Type 1:1") = true then
if plug_type = 1 then
else
Component.Replace("Plug Type 1:1", "Plug Type " & plug_type & ".ipt", True)
end if
elseif Component.IsActive("Plug Type 2:1") then
if plug_type = 2 then
else
Component.Replace("Plug Type 2:1", "Plug Type " & plug_type & ".ipt", True)
end if
..........and so on
end if
it works fine if plug type 1 is in the sub assembly, and the option is one of the other plugs( it then replaces the component fine), but if any other one is in there, it errors when its looking to see if Plug Type 1:1 is active.
Is there another way of structuring this? I've only just started looking at iLogic, but i know using the API I could iterate through all the brower nodes for Plug Type, then cut the string to find out which number is active on the end, but im trying to stay away from VBA for now.
Thanks
Harry