How to setup UoM to convert from Weight to Pieces

In this case it appears that the material is a component of an item that is being manufactured for sale or to be used in another process. So the final product could have a Bill of Materials, and a operation resulting in a finished item. Perhaps this somewhat similar question will help:

https://discuss.frappe.io/t/same-item-but-different-lengths/89222/5