- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi there, I have a section of code (see below) which runs a program which highlights a part/subassembly red, then gives the user a list dialgue box in order to easily replace the compent. At present, I have this code repeated for each part/subassembly in my main assemby (i.e. FRAME, POWER_RISER, BUSBAR_CHAMBER, BUSBAR_ASSEMBLY...).
Having the code repeated multiple times, means it is very time consuming to modify. I want to be able to generate a list then have the code below, run for each of the entries in the list. So I need something along the lines of
dim mylist as something
mylist = FRAME, POWER_RISER, BUSBAR_CHAMBER, BUSBAR_ASSEMBLY...
FOR each entry in mylist
run all the code below (with the words 'BUSBAR_ASSEMBLY' replaced with 'mylist'
END
Could someone give me some help with the code writting please?
Thanks,
Wayne
Component.Color("BUSBAR_ASSEMBLY")="Red(FLAT)"Parameter("busbar_assembly_partno")=InputListBox("Please select the part number of the busbar assembly you wish to use", MultiValue.List("busbar_assembly_partno"), MultiValue.List("busbar_assembly_partno"), Title :="Assembly Editor", ListName :="Busbar Assembly")Component.Color("BUSBAR_ASSEMBLY")="As Material"iPart.ChangeRow("BUSBAR_ASSEMBLY", Parameter("busbar_assembly_partno"))'Component.Replace("BUSBAR_ASSEMBLY","C:\ARTICULATE\09\090\09090GT0000023\" & Parameter("busbar_assembly_partno") & ".iam", True)iLogicVb.UpdateWhenDone=True
'Check to see if the part has changed. If it hasn't, check to see if it exists.IfParameter("busbar_assembly_partno")<>iProperties.Value("BUSBAR_ASSEMBLY", "Project", "Part Number")IfDir("C:\ARTICULATE\09\090\09090GT0000023\"&Parameter("busbar_assembly_partno")&".iam")=""ThenMessageBox.Show("The busbar assembly, "&Parameter("busbar_assembly_partno")&", does not exist locally. Please GET the part from Vault (you don't need to check it out) then click 'OK'", "Assembly Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)iPart.ChangeRow("BUSBAR_ASSEMBLY", Parameter("busbar_assembly_partno"))MessageBox.Show("Now please Check , "&Parameter("busbar_assembly_partno")&", back in", "Assembly Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)EndIfEndIf
'Check to see of the part has changed. If it hasn't, prompt to check it out of vault.IfParameter("busbar_assembly_partno")<>iProperties.Value("BUSBAR_ASSEMBLY", "Project", "Part Number")MessageBox.Show("The busbar assembly could not be changed to "&Parameter("busbar_assembly_partno")&". Make sure you have the latest version of the file and all it's children from Vault then click 'OK'", "Assembly Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)iPart.ChangeRow("BUSBAR_ASSEMBLY", Parameter("busbar_assembly_partno"))EndIf
'Check to see of the part has changed. IfParameter("busbar_assembly_partno")<>iProperties.Value("BUSBAR_ASSEMBLY", "Project", "Part Number")MessageBox.Show("The busbar assembly could still not be changed to "&Parameter("busbar_assembly_partno")&". iAssemblies are jerks", "Assembly Editor", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1)EndIf
Inventor 2013 Certified Professional
Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Solved! Go to Solution.