Example #1
0
    def save_and_update_graphics(self, _mstring):
        # record start time
        dts = str(datetime.now())  # .strftime('%Y/%m/%d %H:%M:%S')
        self.tab3.moveCursor(QTextCursor.MoveOperation(11))
        self.render_text(self.tab3,
                         dts + ": {} command executed \n".format(_mstring))
        # save tab1 to input file
        self.save_file()
        # reset data file

        if self.filename != "":
            f = open(self.filename, 'r')
            self.setWindowTitle(self.window_title + " :: " +
                                str(self.filename))

            data.ResetStrData()
            ReadInput(f.readlines(), data)
            f.close()
            #
            self.tab3.moveCursor(QTextCursor.MoveOperation(11))
            self.tab3.insertPlainText(
                str(datetime.now()) +
                ": Data file reset and Input file read \n")
            # need to retrieve data from tab1
            #
            # reset mayavi window
            self.mayavi_widget.visualization.plot_model_geometry(data)
            #
            self.tab3.moveCursor(QTextCursor.MoveOperation(11))
            self.tab3.insertPlainText(
                str(datetime.now()) + ": Graphics redrawn \n")
Example #2
0
    def Solve(self):
        #
        self.save_and_update_graphics('Solve')
        #
        # solve
        solve_2d_truss.truss2d(data, self.filename)
        dtf = str(datetime.now())  # .strftime('%Y/%m/%d %H:%M:%S')
        self.tab3.moveCursor(QTextCursor.MoveOperation(11))
        self.tab3.insertPlainText(dtf + ": Solve finished\n")
        # write output to screen
        tab2txt = Write_OutputData(data, self.filename)
        self.render_text(self.tab2, tab2txt)
        # self.render_text(self.tab2b.tab1, tab2txt)

        # write output to file
        outfilename = 'RES_' + os.path.basename(self.filename)
        f = open(outfilename, 'w')
        f.write(tab2txt)
        f.close()

        self.tab3.moveCursor(QTextCursor.MoveOperation(11))
        self.tab3.insertPlainText(
            str(datetime.now()) + ": Output file written \n")

        # deformation
        self.mayavi_widget.visualization.plot_deformation(data)
        # stress contour

        self.statusBar().showMessage('READY')