In the Explorer client, part order can be changed using the Parts view. This article describes how you can change the order of part items using the API.
The method GetPartItems returns the Items in the part number order.
The method GetParts returns the parts in no specified order. If you want them to be sorted by Part number you can use the method SortByPartNo.
Example
Console.WriteLine("Order of Parts:"); IswParts parts1 = i.GetParts(partType); parts1.SortByPartNo(); foreach (IswPart part in parts1) { IswItem partItem = part.DefObj as IswItem; Console.WriteLine(partItem.Name); }
The PartOrder can be changed by setting the PartNoProperty on the parts.
Below is a small example that reverses and renumbers the Part order every execution:
Console.WriteLine("Reversing Parts..."); int partOrder = 1; IswParts parts2 = i.GetParts(partType); parts2.SortByPartNo(); foreach (IswPart part in parts2.Reverse()) { part.PartNo = partOrder++; }