I am new with macros and I need help about writing a macro for adding part numbers (custom property name: "Poz.") to each part in assembly according to a few rules.
In the first picture, you can see the unsorted BOM of the assembly (list of all parts without part numbers)
In the second picture there is a sorted BOM. (I added the part numbers (red) manualy for this example)
Part number adding rules:
1. Part numbers starting from no.1 should be assigned to parts with visible "Materijal" column (orange)
2. When there is no more parts with "Materijal" column, next part numbers should be assigned to parts that have the "Norma/Oznaka crteža"
column (custom config. property) starting with "FESTO". (pink)
3. Next are parts with the same custom property starting with "SMC" (blue)
4. Next are parts with the same custom property starting with "HYPEX" (grey)
5. Next are parts with the same custom property starting with all other (brown)
6. Part numbers SHOULD NOT be assigned to parts with the custom property starting with "HRN" (green) because these numbers are already
assigned in the toolbox.
I would be very grateful if anyone can help me with that.