Beispiel #1
0
def read_axial_direction():
    with open('Axial_Direction.txt', 'r') as file:
        for line in file:
            linie = line.split(',')
            lista = process_input(str(linie[1]))
            for i in lista:
                statement = 'INSERT OR REPLACE INTO AxialDirection VALUES(?,?)'
                c.execute(statement, (linie[0], i))
                conn.commit()
Beispiel #2
0
 def addGroup(self):
     string_elements=self.line_insert_elments.text()
     string_group_name=self.line_insert_group.text()
     #Process data with Patran_input.py
     result_list_elm = patran_input.process_input(string_elements)
     self.table_group_elem.setHorizontalHeaderLabels(['Group Name','Elements'])
     numRows = self.table_group_elem.rowCount()
     self.table_group_elem.setColumnCount(2)
     self.table_group_elem.insertRow(numRows)
     self.table_group_elem.setItem(numRows, 0, QtWidgets.QTableWidgetItem(string_group_name))
     self.table_group_elem.setItem(numRows, 1, QtWidgets.QTableWidgetItem(str(result_list_elm)))
Beispiel #3
0
def read_mpcSUM_groups():
    with open('MPC_Forces_Sum.txt', 'r') as file:
        listaGrupuriMPCsum = []
        for line in file:
            linie = line.split(',')
            listaGrupuriMPCsum.append(linie[0])
            c.execute('DROP TABLE IF EXISTS {} '.format(linie[0]))
            c.execute('CREATE TABLE IF NOT EXISTS {} (nid INTEGER)'.format(
                linie[0]))
            lista = process_input(str(linie[1]))
            for i in lista:
                statement = 'INSERT OR REPLACE INTO ' + linie[0] + ' VALUES(?)'
                c.execute(statement, (i, ))
                conn.commit()
    return listaGrupuriMPCsum
Beispiel #4
0
def read_cbush_groups():
    with open('CBUSH_IF_Groups.txt', 'r') as file:
        listaGrupuri = []
        for line in file:
            linie = line.split(',')
            listaGrupuri.append(linie[0])
            c.execute('DROP TABLE IF EXISTS {} '.format(linie[0]))
            c.execute('CREATE TABLE IF NOT EXISTS {} (eid INTEGER)'.format(
                linie[0]))
            lista = process_input(str(linie[1]))
            for i in lista:
                statement = 'INSERT OR REPLACE INTO ' + linie[0] + ' VALUES(?)'
                c.execute(statement, (i, ))
                conn.commit()
    #return listaGrupuri[:-1] because we don't want to retrieve ElementeEliminate as a group name
    return listaGrupuri[:-1]
Beispiel #5
0
def read_groups_metalic():
    file = open('INPUT/GroupMetalic.txt', 'r')
    listaGrupuri = []
    for line in file:
        linie = line.split(',')
        listaGrupuri.append(linie[0])
        c.execute('DROP TABLE IF EXISTS {} '.format(linie[0]))
        c.execute(
            'CREATE TABLE IF NOT EXISTS {} (eid INTEGER,fos_y REAL,fos_u REAL)'
            .format(linie[0]))
        lista = process_input(str(linie[3]))
        for i in lista:
            statement = 'INSERT OR REPLACE INTO ' + linie[0] + ' VALUES(?,?,?)'
            c.execute(statement, (i, linie[1], linie[2]))
            conn.commit()
    #return listaGrupuri[:-1] because we don't want to retrieve ElementeEliminate as a group name
    return listaGrupuri[:-1]
Beispiel #6
0
def read_metal_props():
    '''
    Function to create MetalProps table from user input file MetalicProperties.txt
    where user specifies Material Name, allowables Sigma Yield, Sigma Ultimate,
    and the elements in the respective properties.
    INPUT: MetalicProperties.txt file created by user, must be in the same directory
    OUTPUT: table MetalicProps in database
    '''
    file = open('INPUT/MetalicProperties.txt', 'r')
    c.execute('DROP TABLE IF EXISTS MetalicProps')
    for line in file:
        if line != '\n':
            linie = line.split(',')
            c.execute(
                'CREATE TABLE IF NOT EXISTS MetalicProps (eid INTEGER,material TEXT,sigY REAL,sigU REAL)'
            )
            listaElm = process_input(str(linie[3]))
            for i in listaElm:
                statement = 'INSERT OR REPLACE INTO MetalicProps VALUES(?,?,?,?)'
                c.execute(statement, (i, linie[0], linie[1], linie[2]))
                conn.commit()
        else:
            continue
Beispiel #7
0
def read_hc_props():
    '''
    Function to create HCprops table from user input file GroupHCprop.txt
    where user specifies property name, HC ply number, allowables (FsL and FsW)
    and the elements in the respective properties.
    INPUT: GroupHCprop.txt file created by user, must be in the same directory
    OUTPUT: table HCprops in database
    '''
    file = open('INPUT/GroupHCprop.txt', 'r')
    c.execute('DROP TABLE IF EXISTS HCprops')
    for line in file:
        if line != '\n':
            linie = line.split(',')
            c.execute(
                'CREATE TABLE IF NOT EXISTS HCprops (eid INTEGER,pid INTEGER,FsL REAL,FsW REAL)'
            )
            listaElm = process_input(str(linie[4]))
            for i in listaElm:
                statement = 'INSERT OR REPLACE INTO HCprops VALUES(?,?,?,?)'
                c.execute(statement, (i, linie[1], linie[2], linie[3]))
                conn.commit()
        else:
            continue