You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
532 B
22 lines
532 B
class Material: |
|
def __init__(self, ID, density): |
|
self.ID = ID |
|
self.density = density |
|
|
|
DB = [] |
|
|
|
@staticmethod |
|
def GetMaterialIDs(): |
|
result = [] |
|
for m in Material.DB: |
|
result.append(m.ID) |
|
return result |
|
|
|
@staticmethod |
|
def Get(ID): |
|
for m in Material.DB: |
|
if m.ID == ID: return m |
|
return None |
|
|
|
Material.DB.append(Material('Stainless steel', density = 8.00)) |
|
Material.DB.append(Material('Aluminium', density = 2.71))
|
|
|