Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Everyone,
I have to add certain custom iproperties to my part. All parts are sheet metals( comprises of 3mm and 4mm Aluminium sheets) and are assembled in an assembly. I don't want to open each part file and add the value /run the rule. I am looking for a i logic rule which can be run from the assembly file and will add the required custom i properties value to the appropriate parts. below is the code I created, but It is not working. Could anyone please help me to crack this.
Sub Main 'Gets the Active Document oDoc = ThisDoc.Document 'Saves this document oDoc.Save 'Checks if the active document is an assembly If oDoc.DocumentType = kAssemblyDocumentObject 'Gets the assembly occurrences Dim oOccs As ComponentOccurrences oOccs = oDoc.ComponentDefinition.Occurrences 'Call the subprocedure to traverse the assembly Call TraverseAssembly(oOccs) End If End Sub '*************** Public Sub TraverseAssembly(oOccs As ComponentOccurrences) Dim oOcc As ComponentOccurrence For Each oOcc In oOccs Select Case Thickness Case 3 If iProperties.Value("Project", "Description") = "3mm Aluminium Coping" Then iProperties.Value("Custom", "Finish Spec Code") = "F11A" iProperties.Value("Custom", "Finish Specification") = "RAL 7022 Umbra Grey - 30% Gloss YL280F" iProperties.Value("Custom", "Material definition") = "MP101 - G0030" iProperties.Value("Project", "Checked By") = "NAC" iProperties.Value("Project", "Revision Number") = "00" iProperties.Value("Project", "Project")="56U0XXXX-BA" Else iProperties.Value("Custom", "Finish Spec Code") = "F01Z" iProperties.Value("Custom", "Finish Specification") = "MILL" iProperties.Value("Custom", "Material definition") = "MP101 - G0030" iProperties.Value("Project", "Checked By")= "NAC" iProperties.Value("Project", "Revision Number") = "00" iProperties.Value("Project", "Project")="56U0XXXX-BA" End If Case 4 iProperties.Value("Custom", "Finish Spec Code") = "F01Z" iProperties.Value("Custom", "Finish Specification") = "MILL" iProperties.Value("Custom", "Material definition") = "MP101 - G0040" iProperties.Value("Project", "Checked By") = "NAC" iProperties.Value("Project", "Revision Number") = "00" iProperties.Value("Project", "Project") = "56U0XXXX-BA" iProperties.Value("Project", "Description")="4mm Aluminium Strap" End Select If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Call TraverseAssembly(oOcc.SubOccurrences) End If Next End Sub
Solved! Go to Solution.