I saw a thread on Reddit, where someone asked how to “show both Imperial and Metric steel sizes in a Parts List”
I initially replied with a single line of iLogic, but this got me thinking. I’ve written an iLogic utility that lets users specify an alternative value for each of the members in their Frame model . The code is set up for 5 frame members, but could easily be expanded to include more.
The code is looks at the “Stock Number” of the frame member (in iProperties) and then adds a custom iProperty for the alternative member size.
Sizes are set up in the table shown below o1 is the Stock number and oA is the Alternative size, likewise for o2 and oB etc.
'Alternate Member sizes o1 = "100x100x3" : oA = "ANSI 4 x 4 x 1/4" o2 = "50x50x2" : oB = "ANSI 2 x 2 x 1/8" o3 = "" : oC = "" o4 = "" : oD = "" o5 = "" : oE = ""
Here is an animated GIF showing the code in action:

Below is the iLogic code
'iLogic code by Clint Brown @ClintBrown3D 'Code originally posted at https://clintbrown.co.uk/show-imperial-metric-frame-sizes-on-bom Sub Main() Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisApplication.ActiveDocument Call Iterate(oAsmDoc.ComponentDefinition.Occurrences, 1) End Sub Private Sub Iterate(Occurrences As ComponentOccurrences, Level As Integer) 'Iterate through Assembly Dim oOcc As ComponentOccurrence For Each oOcc In Occurrences 'Find Parts in Assembly Dim ClintsPart As String ClintsPart = oOcc.Name Try 'Alternate Member sizes o1 = "100x100x3" : oA = "ANSI 4 x 4 x 1/4" o2 = "50x50x2" : oB = "ANSI 2 x 2 x 1/8" o3 = "" : oC = "" o4 = "" : oD = "" o5 = "" : oE = "" 'Write iProps to Parts If iProperties.Value(ClintsPart, "Project", "Stock Number") = o1 Then : iProperties.Expression(ClintsPart, "Custom", "Alternate Size") = oA : End If If iProperties.Value(ClintsPart, "Project", "Stock Number") = o2 Then : iProperties.Expression(ClintsPart, "Custom", "Alternate Size") = oB : End If If iProperties.Value(ClintsPart, "Project", "Stock Number") = o3 Then : iProperties.Expression(ClintsPart, "Custom", "Alternate Size") = oC : End If If iProperties.Value(ClintsPart, "Project", "Stock Number") = o4 Then : iProperties.Expression(ClintsPart, "Custom", "Alternate Size") = oD : End If If iProperties.Value(ClintsPart, "Project", "Stock Number") = o5 Then : iProperties.Expression(ClintsPart, "Custom", "Alternate Size") = oE : End If Catch End Try 'Cycle through the sub assemblies If oOcc.DefinitionDocumentType = kAssemblyDocumentObject Then Call Iterate(oOcc.SubOccurrences, Level + 1) End If Next End Sub
You must be logged in to post a comment.