Depending on what type of pipe you're actually using or how many types/grades/standards..... this could be pretty simple or quite in depth.
I have just written a pretty comprehensive piece of code for my add-in suite that runs through an entire BOM and classifies all part and assemblies into categories and then further sorts them according to thickness/size/grade etc.
The pipe section I had planned on sorting by each grade, but ultimately I found that I could just sort by nominal diameter and then by wall thickness to get what I needed. That being said, we don't really use a lot of pipe here and the stuff we use is generally ASME schedule pipe.
How my code works is I created a separate Class called BomSorterRowObject which essentially stores each BOM row item as well as it's Part Number and Item Number. It also has 5 slots for assigning sorting parameters. From there I created an Enumeration type that contains my 'document classifications' as well as their respective value that always goes into Sort1 which is the primary sort level of the sorting function.
The BOM Sorter goes through each level of the BOM and identifies each row object .....creates a new BomSorterRowObject.....and then goes about trying to identify the object type and classify it (in Sort1 using it's enum type and then for each respective type by finding it's descending sorting parameters......ie diameter, length, thickness, etc).
For the Content Center stuff, you can use the Property called "Family" which may help you to identify which specific folder from the content center the pipe came from. I used Regex to look for keywords in the Family Name that would help me to classify the parts. Another option would be to add a custom property to the Content Center parts that would help you to classify them.
Honestly, without more information on what you're using, how you use it, or what you're trying to do......it's hard to really offer any real specific suggestions.