@Anonymous wrote:
There is sometimes we have more than one API Number, do i just copy that line and change the number?
iProperties.Value("Custom", "API NUMBER 1") = APINumber
Code updated to have up to 5 API numbers (just leave the valve blank to not fill in anything)
Also added title request/insert functionality for assembly and all components..
'capture the API and Job Numbers
Title1 = InputBox("Please Enter the Title", "Title Request")
APINumber1 = InputBox("Please Enter the API Number 1", "API Number 1 Request")
APINumber2 = InputBox("Please Enter the API Number 2", "API Number 2 Request")
APINumber3 = InputBox("Please Enter the API Number 3", "API Number 3 Request")
APINumber4 = InputBox("Please Enter the API Number 4", "API Number 4 Request")
APINumber5 = InputBox("Please Enter the API Number 5", "API Number 5 Request")
JobNumber = InputBox("Please Enter the Job Number", "JOB Number Request")
'Write them to the assembly iprops
iProperties.Value("Summary", "Title") = Title1
iProperties.Value("Custom", "API NUMBER 1") = APINumber1
iProperties.Value("Custom", "API NUMBER 2") = APINumber2
iProperties.Value("Custom", "API NUMBER 3") = APINumber3
iProperties.Value("Custom", "API NUMBER 4") = APINumber4
iProperties.Value("Custom", "API NUMBER 5") = APINumber5
iProperties.Value("Custom", "JOB") = JobNumber
'Access the components
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oOccurrence As ComponentOccurrence
'Do the same for all components in this assembly..
'Iterate through all Of the occurrences
For Each oOccurrence In oAsmCompDef.Occurrences.AllReferencedOccurrences(oAsmCompDef)
'write to component iprops
iProperties.Value(oOccurrence.Name, "Summary", "Title") = Title1
iProperties.Value(oOccurrence.Name, "Custom", "JOB") = JobNumber
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 1") = APINumber1
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 2") = APINumber2
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 3") = APINumber3
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 4") = APINumber4
iProperties.Value(oOccurrence.Name, "Custom", "API NUMBER 5") = APINumber5
Next
MessageBox.Show("API/Job Process Completed", "API/JOB Status")
-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570
Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269