- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have setup my library to create a Custom Part Number concatenated from Cost Center iProp and Length. This allows my part lists to Group parts with the same name (or same lengths). Instead of all my 2x2x1/8 Tube being one item, it will be broken down based on Lengths. Works great!!
Sometimes I need to just show the opposite. I have an assembly, that has a skeleton file and a frame generator assembly. The frame is made up of a custom profile and I don't require the individual lengths, just the total length of the part. I have scoured this forum and found some rules that I have almost made work perfectly. It totals up all the lengths (my custom parameter "G_L_CUSTOM) and converts to my liking and saves it to the Part Number. Where I am stuck, is I need the information that is stored in the Cost Center iProp of any of the frame generator parts. Cost Center in the Assembly iProp is blank that is why the part number is not showing up right. Is there a way to look for Cost Center iprop in the 1st part of the Frame generator assembly, store it in the rule then the rule can grab it and concatenate my new Part Number Correctly.
Dim total As Double = 0
Dim adoc As AssemblyDocument = ThisDoc.Document
For Each occ As ComponentOccurrence In adoc.ComponentDefinition.Occurrences
Dim Val As Double
Try
Val = Parameter(occ.Name, "G_L_CUSTOM")
total = total + Val
Catch
End Try
Next occ
'round inch value and convert to fraction
oLin = RoundToFraction(total, 1/16, RoundingMethod.Round)
'convert inch value to feet
oLft = total/12
'round feet value and convert to fraction
oL=RoundToFraction(oLft, 1/16, RoundingMethod.Round)
'create part number iproperty
iProperties.Value("Project", "Part Number") = iProperties.Value("Project", "Cost Center")&" - LENGTH " & oL
'create custom Length iproperty
iProperties.Value("Custom", "Length (in)") = oLin
'ensure everything is good
MessageBox.Show("Total length: " & oL & " ft")
This image shows one of the frame generator parts and the iproperties. You can see that each of the parts uses the same methodology for the part number. Cost Center + Length
Thanks!
Product Designer at Teksign Inc.
Inventor 2016 SP1
Dell Precision 3660
i7-12700 @ 2.40GHz-4.90GHz
32GB DDR5 4400MHz RAM
NIVDIA RTX A2000 6GB
Solved! Go to Solution.