How can I calculate product price based on product attributes? I would like to calculate prices for all of my products based on value of the length or weight attribute multiplied by price per meter/g of the material selected for the product.

What is the best way to do this?

I have created content type material which has price per unit attribute. Each product when created is a assigned a material and length/weight. 

When I tried to use the pricing rules i discovered I can only do simple things to the existing price and not calculate a brand new price :(

Once I have solution to this I want to be able to allow the user to select the weight/length and for the price to update accordingly. 

Best Regards, Atta
The pricing rules give you the basic mathematical functions to manipulate a price (add, subtract, multiply), but they also give you the ability to set it to a specific amount. The rub just comes in calculating that amount you want to set it to first. : )

Rules allows you to calculate a value and then use that in subsequent actions, so that would be the course of action you might take ... you could, for example, ensure the rule knows about the fields you need to access on the product to make the calculation, multiply it out into a calculated value, and then set the price amount to that calculated amount.

However, this is a scenario where I'd typically expect a custom action to be created. Complex mathematical operations should be handled in code where they can be tracked, tested, etc.