Just my 2 cents....I believe in trying to separate things that should be 'user-accessible' from just code.
It makes programmers lives easier and it ensures 'most' users can maintain a hairline of sanity.
Adding the csv module and defining the 2 functions below allows for the init of the materials list to be in the form of
And the 'materials.csv' file is shown below.....you can easily add comments,titles,ownership statements in the commented header space.
Code: Select all
# -- null line below --
# -- whitespace line below --
# -- comments here --
#
"material","ss_hss","ss_cbd","ss_drill_hss","ss_drill_cbd","kp","brinell","Kd","Note"
"Softwood",225,255,185,205,0.5,0,3000,"# noqa E241"
"Hardwood",145,275,115,400,0.75,0,4000,"# noqa E241"
"Soft Plastics",225,255,185,205,0.5,0,2000,"# noqa E241"
"Hard Plastics",225,275,115,400,0.75,0,2000,"# noqa E241"
"Aluminium (6061)",175,395,135,310,0.9,95,7000,"# noqa E241"
"Aluminium (7075)",175,395,125,310,0.9,150,7000,"# noqa E241"
"Aluminium (Cast)",175,395,135,310,0.68,150,7000,"# noqa E241"
"Brass (Hard)",200,395,115,350,2.27,120,14000,"# noqa E241"
"Brass (Medium)",175,350,115,350,1.36,120,14000,"# noqa E241"
"Brass (Soft)",125,300,115,350,0.68,120,7000,"# noqa E241"
"Carbon Steel",35,120,25,90,1.88,130,24000,"# noqa E241"
"Tool Steel",12,45,10,30,1.88,400,340000,"# noqa E241"
"Stainless (303)",25,85,20,65,2.07,200,200000,"# noqa E241"
"Stainless (304)",10,37.5,10,30,2.07,125,22000,"# noqa E241"
"Stainless (316)",7.5,25,5,20,2.07,80,24000,"# noqa E241"
The whole thing provides a drop-in replacement for the hard-coded array that was there previously.
And with a little documentation the end-user can freely view and expand upon the materials properties without mucking with the coding.
Hope someone finds it useful.