'Calculate the length of the filament given the mass, diameter and
density of the filament. Set the \'Length\' field to this quantity.'

def calculateLength(self, event):

    mass = getFloat(self, self.weight_dialog.field.GetValue())
    diameter = getFloat(self, self.diameter_dialog.field.GetValue())
    density = getFloat(self, self.density_dialog.field.GetValue())
    if (mass and diameter and density):
        pi = 3.14159265359
        length = ((((4000000.0 * mass) / pi) / (diameter ** 2)) / density)
        self.length_dialog.field.ChangeValue(('%.2f' % length))
        self.statusbar.SetStatusText('')
    else:
        self.length_dialog.field.ChangeValue('---')
