
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I’m trying to create an iLogic routine that fills in the project number in the main assembly and all parts and sub asssemblies, except when a part or assembly is a “Purchased” part.
I have a rule now but it only adds the project number to the 1st layer of parts and subassemblies.
I have no clue how to have this rule fill in de project number in sub-sub assemblies and parts in sub-sub assemblies, etc. Until all levels are checked and filled in.
I hope you can really help me out. I checked several blogs on the Mod the Machine blog, but it seems that the code used there is nog working anymore in Inventor 2017.
The code I have is :
'Fill in project number
pProject = InputBox("Projectnummer", "Projectnummer")
' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
oAsmDoc = ThisApplication.ActiveDocument
' Get the assembly component definition.
Dim oAsmCompDef As AssemblyComponentDefinition
oAsmCompDef = oAsmDoc.ComponentDefinition
' Iterate through all of the Part Occurrences
Dim oOccurrence As ComponentOccurrence
For Each oOccurrence In oAsmCompDef.Occurrences
' Set Reference to Occurrence Name
Dim oOccName As String
oOccName = oOccurrence.Name
If oOccurrence.Definition.BOMStructure = 51970 'Normal
iProperties.Value(oAsmDoc,"Project", "Project") = pProject
iProperties.Value(oOccName,"Project", "Project") = pProject
End If
If oOccurrence.Definition.BOMStructure = 51971 'Phantom
iProperties.Value(oAsmDoc,"Project", "Project") = pProject
iProperties.Value(oOccName,"Project", "Project") = pProject
End If
If oOccurrence.Definition.BOMStructure = 51972 'Reference
iProperties.Value(oAsmDoc,"Project", "Project") = pProject
iProperties.Value(oOccName,"Project", "Project") = pProject
End If
If oOccurrence.Definition.BOMStructure = 51974 'Inseparable
iProperties.Value(oAsmDoc,"Project", "Project") = pProject
iProperties.Value(oOccName,"Project", "Project") = pProject
End If
Next
Thanks a lot for taking time to read my question!
Best Regards,
Sjaak
Solved! Go to Solution.