(Dec-23-2019, 05:13 PM)Gribouillis Wrote: These classes are empty for now but you will be free to add features to them later.
It would be a good idea to include an example of a typical input file if you can do that.
There is an obstacle again. I would like to deal with the materials first.
Here are the material statement in a software.
TABLE: "MATERIAL PROPERTIES 01 - GENERAL"
Material=4000Psi Type=Concrete SymType=Isotropic TempDepend=No Color=Magenta Notes="Customary f'c 4000 psi 23/12/2019 2:17:43 pm"
Material=A615Gr60 Type=Rebar SymType=Uniaxial TempDepend=No Color=White Notes="ASTM A615 Grade 60 23/12/2019 2:18:28 pm"
Material=A992Fy50 Type=Steel SymType=Isotropic TempDepend=No Color=Red Notes="ASTM A992 Grade 50 23/12/2019 2:17:43 pm"
Material=C30 Type=Concrete SymType=Isotropic TempDepend=No Color=Blue Notes="Concrete added 23/12/2019 2:18:37 pm"
Material=C45 Type=Concrete SymType=Isotropic TempDepend=No Color=Blue Notes="Concrete added 23/12/2019 2:20:37 pm"
Material=C60 Type=Concrete SymType=Isotropic TempDepend=No Color=Blue Notes="Concrete added 23/12/2019 2:21:13 pm"
TABLE: "MATERIAL PROPERTIES 02 - BASIC MECHANICAL PROPERTIES"
Material=4000Psi UnitWeight=2.40276966513304E-06 UnitMass=2.45014307299925E-10 E1=2534.56354148831 G12=1056.0681422868 U12=0.2 A1=0.0000099
Material=A615Gr60 UnitWeight=7.84904757236607E-06 UnitMass=8.0038007068661E-10 E1=20389.0191580383 A1=0.0000117
Material=A992Fy50 UnitWeight=7.84904757236607E-06 UnitMass=8.0038007068661E-10 E1=20389.0191580383 G12=7841.93044539935 U12=0.3 A1=0.0000117
Material=C30 UnitWeight=2.49830467094493E-06 UnitMass=2.54756172606745E-10 E1=2263.76994673377 G12=943.237477805739 U12=0.2 A1=0.0000099
Material=C45 UnitWeight=2.49830467094493E-06 UnitMass=2.54756172606745E-10 E1=2692.05074746719 G12=1121.68781144466 U12=0.2 A1=0.0000099
Material=C60 UnitWeight=2.49830467094493E-06 UnitMass=2.54756172606745E-10 E1=3059.14857666726 G12=1274.64524027803 U12=0.2 A1=0.0000099
The first three materials are default inside the software so I would not extract the information inside it. Also, a same material has divided into two table so I would like to deal with 'material properties 01' first.
SAP = open('Frame SAP.$2k', 'r') #Using the 'class' for the material statement 01 class SAP_Material_Statement01: def __init__(self, Name, Type, Symtype, Tempdepend, Colour, Notes): self.Name = Name self.Type = Type self.Symtype= Symtype self.Tempdepend = Tempdepend self.Colour = Colour self.Notes = Notes def __repr__(self): return '{}( Material={} Type={} SymType={} TempDepend={} Color={} Notes="{}")'.format(self.__class__.__name__, self.Name, self.Type, self.Symtype, self.Tempdepend, self.Colour, self.Notes) #Try to apply the things in it and see whether it is same as the statement inside the file test = SAP_Material_Statement01('C30', 'Concrete', 'Isotropic', 'No', 'Blue', 'Concrete added 23/12/2019 2:18:37 pm') #print(test) #empty class (In fact, I dont know how to use it) class material_(SAP_Material_Statement01): pass #Since there are many other kinds of statements, so I would like to extract the things in material prop 01 SAP_material_statement_01 = [] for line in SAP: split_01 = line.split('=') #From the above statement, it start with Material=C30 with 3 space bar infront of it #print(split_01) #Thus, I should split the '=' split_02 = line.split(' ') #Since I am dealing with material prop 01, the TempDepend is always =No in the majority cases #print(split_02) #Thus, I split the ' ' and use TempDepend=No for an indication to let me extract the things only in material prop 01 if split_01[0] == ' Material' and split_02[4] == 'TempDepend=No': SAP_material_statement_01.append(line) print(SAP_material_statement_01) for line in SAP_material_statement_01: print(line.split())
I have stopped in this step. I need all the things after '=' (e.g. C30, Concrete, Isotropic).
However, I do not know the next step