-
Notifications
You must be signed in to change notification settings - Fork 1
/
sDynaUiMain.py
913 lines (751 loc) · 32.9 KB
/
sDynaUiMain.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
#--------------------Library-------------------#
#----------------------------------------------#
import sys
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import *
from sDynaUi import *
from about import *
from manual import *
import xlsxwriter
import xlrd
from MDOF import *
import matplotlib.pyplot as plt
import numpy as np
import os
#--------------Create Application--------------#
#----------------------------------------------#
Application = QApplication(sys.argv)
WinMain = QMainWindow()
WinMain.setWindowIcon
ui = Ui_sDyna() #sDynaUi.py class isminden kopyalandı.
ui.setupUi(WinMain) #tasarımdaki form ile pencereyi birleştir
WinMain.show() #pencereyi göster.
WinAbout=QDialog()
uiAbout = Ui_Dialog()
uiAbout.setupUi(WinAbout)
WinManual=QDialog()
uiManual = Ui_Manual()
uiManual.setupUi(WinManual)
#---------------Create DataBase----------------#
#----------------------------------------------#
import sqlite3
global curs
global conn
conn = sqlite3.connect("sDynaDB.db")
curs = conn.cursor()
curs.execute("DELETE FROM sDyna")
conn.commit()
curs.execute("CREATE TABLE IF NOT EXISTS sDyna( \
Floor NUMERIC NOT NULL PRIMARY KEY, \
Mass NUMERIC NOT NULL, \
Rigidity NUMERIC NOT NULL)")
conn.commit()
#---------------lineEdit Enable----------------#
#----------------------------------------------#
ui.lne_Mass.setEnabled(False)
ui.lne_Rigidity.setEnabled(False)
ui.progressBar.hide()
def comboact():
ui.lne_Mass.setEnabled(True)
ui.lne_Rigidity.setEnabled(True)
#---------------SAVE---------------#
#----------------------------------#
def addData():
checkUnique = 1
_lne_Mass = ui.lne_Mass.text()
_lne_Rigidity = ui.lne_Rigidity.text()
_cm_Floor = ui.cm_Floor.currentText()
try:
_lne_Mass= float(_lne_Mass)
_lne_Rigidity=float(_lne_Rigidity)
if bool(_lne_Mass) and bool(_lne_Rigidity) and bool(_cm_Floor)==True:
curs.execute("SELECT Floor FROM sDyna")
liste = curs.fetchall()
if len(liste) != 0:
for j in range(len(liste)):
for i in liste[j]:
if i == int(_cm_Floor):
checkUnique = 0
if checkUnique == 1:
curs.execute("INSERT INTO sDyna (Floor, Mass, Rigidity) VALUES (?,?,?)", (_cm_Floor,_lne_Mass,_lne_Rigidity))
conn.commit()
makeList()
ui.lne_Mass.setEnabled(False)
ui.lne_Rigidity.setEnabled(False)
elif checkUnique == 0:
QMessageBox.about(WinMain,"Error","This floor has added already. Use Change button to change")
WinMain.show()
checkUnique = 0
else:
ui.statusbar.showMessage("Error: Data must be entered.",10000)
except Exception:
QMessageBox.about(WinMain,'Error','Input can only be a number')
pass
#---------------LIST---------------#
#----------------------------------#
def makeList():
ui.tb_data.clearContents() #tablo içeriğini siler.
curs.execute("SELECT * FROM sDyna")
for rowIndex, rowData in enumerate(curs):
for columnIndex, columnData in enumerate(rowData):
ui.tb_data.setItem(rowIndex,columnIndex,QTableWidgetItem(str(columnData)))
ui.lne_Mass.clear()
ui.lne_Rigidity.clear()
ui.cm_Floor.setCurrentIndex(-1) # "-1" comboBox içine hiçbirşey yazmamayı ifade eder.
#-----Current Floor Number-----#
curs.execute("SELECT COUNT (*) FROM sDyna")
floorNumber = curs.fetchone()
ui.label_savedFloor.setText(str(floorNumber[0]))
# floorNumber[0] bizim kat sayımızı veriyor!!
# floorNumbers = curs.fetchall()
# ui.label_savedFloor.setText(str(len(floorNumbers)))
#------------RESET ALL---------------#
#------------------------------------#
def deleteAll():
answer1 = QMessageBox.question(WinMain,"Delete all","Are you sure to reset data?",\
QMessageBox.Yes | QMessageBox.No)
if answer1 == QMessageBox.Yes:
curs.execute("DELETE FROM sDyna")
conn.commit()
ui.tb_data.clearContents() #tablo içeriğini siler.
ui.lne_Mass.clear()
ui.lne_Rigidity.clear()
ui.cm_Floor.setCurrentIndex(-1) # "-1" comboBox içine hiçbirşey yazmamayı ifade eder.
ui.lne_EQData.clear()
ui.lne_Interval.clear()
ui.label_savedFloor.clear()
else:
WinMain.show()
#------------------EXIT-------------------#
#-----------------------------------------#
def exit_():
answer = QMessageBox.question(WinMain,"EXIT","Are you sure to exit from program?",\
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
conn.close()
sys.exit(Application.exec_())
else:
WinMain.show()
#------------------DELETE-ROW-------------------#
#-----------------------------------------------#
def deleteRow():
answer = QMessageBox.question(WinMain,"Delete the floor","Are you sure to delete this floor?",\
QMessageBox.Yes | QMessageBox.No)
if answer == QMessageBox.Yes:
slcted = ui.tb_data.selectedItems()
if bool(slcted)==True:
dlt = slcted[0].text()
try:
curs.execute("DELETE FROM sDyna WHERE Floor='%s'"%(dlt))
conn.commit()
makeList()
ui.statusbar.showMessage(str(dlt)+". floor's data have been deleted successfully.",10000) #10000 milisaniye=10 saniye mesaj görünecek.
except Exception as Error:
ui.statusbar.showMessage("Error:"+str(Error),10000)
else:
ui.statusbar.showMessage("There is no selected items.",10000)
else:
ui.statusbar.showMessage("Deleting process has been cancelled.",10000)
WinMain.show()
#------------------CHANGE-ROW-------------------#
#-----------------------------------------------#
def changeRow():
answer2 = QMessageBox.question(WinMain,"Change the floor's features","Are you sure to change this floor?",\
QMessageBox.Yes | QMessageBox.No)
uniquenumber=1
_lne_Mass = ui.lne_Mass.text()
_lne_Rigidity = ui.lne_Rigidity.text()
_cm_Floor = ui.cm_Floor.currentText()
try:
_lne_Mass=float(_lne_Mass)
_lne_Rigidity=float(_lne_Rigidity)
if answer2 == QMessageBox.Yes:
if bool(_lne_Mass) and bool(_lne_Rigidity) and bool(_cm_Floor)==True:
curs.execute("SELECT Floor FROM sDyna")
liste = curs.fetchall()
for j in range(len(liste)):
for i in liste[j]:
if i == int(_cm_Floor):
uniquenumber=0
if uniquenumber==0:
curs.execute("UPDATE sDyna SET Mass = ?, Rigidity = ? WHERE Floor = ?" , (_lne_Mass,_lne_Rigidity,_cm_Floor))
conn.commit()
makeList()
ui.lne_Mass.setEnabled(False)
ui.lne_Rigidity.setEnabled(False)
else:
QMessageBox.about(WinMain,"Error","Choosen floor cannot be find in table.Please save the floor first.")
# WinMain.show()
checkUnique = 0
else:
ui.statusbar.showMessage("Error: All data must be entered.",10000)
else:
ui.statusbar.showMessage("Changing process has been cancelled.",10000)
WinMain.show()
except Exception:
QMessageBox.about(WinMain,'Error','Input can only be a number')
pass
#--------------------SEARCH---------------------#
#-----------------------------------------------#
def search_():
search1=ui.cm_Floor.currentText()
search2=ui.lne_Mass.text()
search3=ui.lne_Rigidity.text()
curs.execute("SELECT * FROM sDyna WHERE Floor=? OR Mass=? OR Rigidity=? OR\
(Mass=? AND Rigidity=?) OR (Floor=? AND Rigidity=?) OR (Mass=? AND Floor=?)",\
(search1,search2,search3,search2,search3,search1,search3,search2,search1))
conn.commit
ui.tb_data.clearContents()
for rowIndex, rowData in enumerate(curs):
for columnIndex, columnData in enumerate(rowData):
ui.tb_data.setItem(rowIndex,columnIndex,QTableWidgetItem(str(columnData)))
#-----------------ABOUT-------------------#
#-----------------------------------------#
def about_():
WinAbout.show()
#-----------------Manual-------------------#
#-----------------------------------------#
def manual_():
WinManual.show()
#---------------EQ FILE-------------------#
#-----------------------------------------#
def eqfile():
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(WinMain,"Select Earthquake File", "","All Files(*);; Text Files (*.txt);; Excel Files (*.xlsx);; CSV Files (*.csv)", options=options)
ui.lne_EQData.setText(fileName)
#---------------SAVE EXCEL FILE-----------#
#-----------------------------------------#
def saveExcelFile():
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
savedfileName, _ = QFileDialog.getSaveFileName(WinMain,"Save File","","Xlsx Files (*.xlsx)", options=options)
if savedfileName !='':
if savedfileName.endswith(".xlsx")==True:
workbook=xlsxwriter.Workbook(savedfileName)
else:
workbook=xlsxwriter.Workbook(savedfileName+ ".xlsx")
worksheet=workbook.add_worksheet("sDyna")
curs.execute("SELECT * FROM sDyna")
colnames = [desc[0] for desc in curs.description]
data = curs.fetchall()
# Start from the first cell. Rows and columns are zero indexed.
row = 1
col = 0
row1=0
# Iterate over the data and write it out row by row.
for header in range(0,len(colnames)):
worksheet.write(row1,col+header,colnames[header])
for Floor, Mass, Rigidity in (data):
worksheet.write(row, col, Floor)
worksheet.write(row, col + 1, Mass)
worksheet.write(row, col + 2, Rigidity)
row += 1
workbook.close()
#-------------OPEN EXCEL FILE-------------#
#-----------------------------------------#
def openExcelFile():
# Choosing Excel File
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
fileName, _ = QFileDialog.getOpenFileName(WinMain,"Select Database", "","Excel Files (*.xlsx)", options=options)
try:
wb = xlrd.open_workbook(fileName)
sheet = wb.sheet_by_index(0)
sheet.cell_value(0, 0)
deleteAll()
for i in range(1,sheet.nrows):
floorExcel=sheet.cell_value(i, 0)
massExcel=sheet.cell_value(i,1)
rigidityExcel=sheet.cell_value(i,2)
curs.execute("INSERT INTO sDyna (Floor,Mass,Rigidity) VALUES (?,?,?)", (floorExcel,massExcel,rigidityExcel))
conn.commit()
makeList()
except Exception:
pass
#-------------------RUN-------------------#
#-----------------------------------------#
def run():
curs.execute("Select Mass From sDyna")
massList = curs.fetchall()
for i in range(len(massList)):
massList[i] = massList[i][0]
curs.execute("Select Rigidity From sDyna")
rigidityList = curs.fetchall()
for i in range(len(rigidityList)):
rigidityList[i] = rigidityList[i][0]
#-----Total Floor Number-----#
curs.execute("SELECT COUNT (*) FROM sDyna")
floorNumber = curs.fetchone()
_lne_EQData = ui.lne_EQData.text()
_lne_Interval = ui.lne_Interval.text()
#-----------Run MDOF-----------#
yapi=Yapi(massList, rigidityList, floorNumber[0])
completed = 0
while completed < 12:
completed += 0.0001
ui.progressBar.setValue(completed)
ui.txt_Results.setText("RESULTS")
yapi.massMatrix()
ui.txt_Results.append("\n" + "Mass Matrix\n" + (str(yapi.m_matrix)))
yapi.rigidityMatrix()
ui.txt_Results.append("\n" + "Stiffness Matrix\n" + (str(yapi.k_matrix)))
yapi.naturalFrequency()
yapi.dampingRatio(0.05)
yapi.dampingMatrix()
ui.txt_Results.append("\n" + "Damping Matrix\n" + (str(yapi.c_matrix)))
ui.txt_Results.append("\n" + "Natural Frequency\n" + (str(yapi.wn)))
ui.txt_Results.append("\n" + "Natural Period\n" + (str(yapi.Tn)))
yapi.amplitudeCalc()
ui.txt_Results.append("\n" + "Amplitudes\n" + (str(yapi.amp)))
while completed <44:
completed += 0.0001
ui.progressBar.setValue(completed)
yapi.generalMassMat()
ui.txt_Results.append("\n" + "Generalized Mass Matrix\n" + (str(yapi.M_Generalized)))
yapi.generalStiffnessMat()
ui.txt_Results.append("\n" + "Generalized Stiffness Matrix\n" + (str(yapi.K_Generalized)))
yapi.generalDampingMat()
ui.txt_Results.append("\n" + "Generalized Damping Matrix\n" + (str(yapi.C_Generalized)))
yapi.modeParticipatingFactor()
ui.txt_Results.append("\n" + "Mode Participating Factor\n" + (str(yapi.lam)))
while completed < 72:
completed += 0.0001
ui.progressBar.setValue(completed)
yapi.effectiveParticipatingMass()
ui.txt_Results.append("\n" + "Effective Participating Mass\n" + (str(yapi.M_eff)))
while completed < 98:
completed += 0.0001
ui.progressBar.setValue(completed)
yapi.earthquakeData(_lne_EQData,float(_lne_Interval))
os.remove("EarthquakeData.png")
yapi.spectra1()
yapi.psuedoAcceleration()
yapi.baseShear()
ui.txt_Results.append("\n" + "Modes' Base Shear forces\n")
for i in range(0,yapi.storeynumber):
ui.txt_Results.append(str(round(yapi.Ft[i][0],2)))
yapi.baseShearSRSS()
ui.txt_Results.append("\n" + "Total Base Shear Force with SRSS = " + str(round(yapi.totalFt[0],2)) + " kN")
while completed < 100:
completed += 0.0001
ui.progressBar.setValue(completed)
ui.progressBar.hide()
ui.progressBar.setProperty("value", 0)
#--------------ProgressBar----------------#
#-----------------------------------------#
def run_():
ui.progressBar.setFormat("Running %p.00%")
ui.progressBar.show()
answer4 = QMessageBox.question(WinMain,"Run","Are you sure to run?",\
QMessageBox.Yes | QMessageBox.No)
if answer4 == QMessageBox.Yes:
try:
run()
except Exception as Error:
ui.txt_Results.clear()
ui.statusbar.showMessage("Error: There is an invalid value",10000)
else:
ui.progressBar.hide()
ui.statusbar.showMessage("Running has been cancelled.",10000)
WinMain.show()
#-------------WORD--------------#
#-------------------------------#
def word():
from docx import Document
from docx.shared import Inches, Pt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
from docx.enum.table import WD_TABLE_ALIGNMENT
options = QFileDialog.Options()
options |= QFileDialog.DontUseNativeDialog
savedfileName, _ = QFileDialog.getSaveFileName(WinMain,"Save File","","Docx Files (*.docx)", options=options)
if savedfileName !='':
if savedfileName.endswith(".docx")==True:
savedfileName=savedfileName
else:
savedfileName=(savedfileName+ ".docx")
completed = 0
while completed < 12:
completed += 0.0001
ui.progressBar.setValue(completed)
#-------Run bof getting results------#
curs.execute("Select Mass From sDyna")
massList = curs.fetchall()
for i in range(len(massList)):
massList[i] = massList[i][0]
curs.execute("Select Rigidity From sDyna")
rigidityList = curs.fetchall()
for i in range(len(rigidityList)):
rigidityList[i] = rigidityList[i][0]
curs.execute("SELECT COUNT (*) FROM sDyna")
floorNumber = curs.fetchone()
_lne_EQData = ui.lne_EQData.text()
_lne_Interval = ui.lne_Interval.text()
yapi=Yapi(massList, rigidityList, floorNumber[0])
yapi.rigidityMatrix()
yapi.massMatrix()
yapi.naturalFrequency()
yapi.dampingRatio(0.05)
yapi.dampingMatrix()
yapi.amplitudeCalc()
yapi.ModalShapes()
yapi.generalMassMat()
yapi.generalStiffnessMat()
yapi.generalDampingMat()
yapi.modeParticipatingFactor()
yapi.effectiveParticipatingMass()
yapi.earthquakeData(_lne_EQData,float(_lne_Interval))
yapi.spectra2()
yapi.spectra1()
yapi.psuedoAcceleration()
yapi.baseShear()
yapi.baseShearSRSS()
#-----Create and edit .docx file-----#
document=Document()
header=document.add_heading("sDyna REPORT",0)
header.alignment=1
document.add_paragraph("This report has been automatically generated by sDyna software. ")
#--------Writing down Matrixes-------#
curs.execute("SELECT COUNT (*) FROM sDyna")
rowNumber = curs.fetchone()
ArrayNameLocation=math.floor(rowNumber[0]/2)
#--------Mass Matrix--------#
document.add_heading("Mass Matrix\n",level=1)
tableMass = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableMass.allow_autofit = False
# table.style = "Table Grid"
for i in range(1,rowNumber[0]+1):
for cell in tableMass.columns[i].cells:
cell.width = Inches(0.5)
#----------Labeling Mass Matrix-----------#
cell = tableMass.cell(ArrayNameLocation, 0)
cell.width = Inches(1.5)
cell.text = 'm ='
#----------Creating Mass Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableMass.cell(i,j+1)
cell.text="{}".format(yapi.m_matrix[i][j])
for row in tableMass.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Labeling Rigidity Matrix-----------#
document.add_heading("Stiffness Matrix\n",level=1)
tableRigidity = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableRigidity.allow_autofit = False
for i in range(1,rowNumber[0]+1):
for cell in tableRigidity.columns[i].cells:
cell.width = Inches(1.1)
cell = tableRigidity.cell(ArrayNameLocation, 0)
cell.width = Inches(1.8)
cell.text = 'k ='
#----------Creating Rigidity Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableRigidity.cell(i,j+1)
cell.text="{}".format(round(yapi.k_matrix[i][j],2))
for row in tableRigidity.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Labeling Damping Matrix-----------#
document.add_heading("Damping Matrix\n",level=1)
document.add_paragraph("Damping ratio has been taken as 0.05.")
tableDamping = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableDamping.allow_autofit = False
for i in range(1,rowNumber[0]+1):
for cell in tableDamping.columns[i].cells:
cell.width = Inches(1.1)
cell = tableDamping.cell(ArrayNameLocation, 0)
cell.width = Inches(2)
cell.text = 'c ='
#----------Creating Damping Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableDamping.cell(i,j+1)
cell.text="{}".format(round(yapi.c_matrix[i][j],2))
for row in tableDamping.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Creating Natural Frequency-----------#
document.add_heading("Natural Frequencies and Periods",level=1)
document.add_paragraph("")
for i in range(0,rowNumber[0]):
p=document.add_paragraph("")
a = p.add_run("ω")
font = a.font
font.size = Pt(9)
sub_p=p.add_run("{}".format(i+1))
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(9)
b = p.add_run(" = {} rad/sec ---------------> T".format(round(yapi.wn[i][0],3)))
font = b.font
font.size = Pt(9)
sub_p=p.add_run("{}".format(i+1))
font = sub_p.font
font.size = Pt(9)
c = p.add_run("= {} sec".format(round(yapi.Tn[i][0],3)))
font = c.font
font.size = Pt(9)
sub_p.font.subscript=True
#----------Amplitudes-----------#
document.add_page_break()
document.add_heading("Modes' Amplitudes",level=1 )
document.add_paragraph("")
tableAmplitude=document.add_table(rows=rowNumber[0],cols=rowNumber[0]+1)
for i in range(0,rowNumber[0]):
cell1=tableAmplitude.cell(i,0)
a1=cell1.add_paragraph("Mode {} Amplitudes".format(i+1))
for j in range(0,rowNumber[0]):
cell=tableAmplitude.cell(i,j+1)
a=cell.add_paragraph("φ")
sub_text=a.add_run("{}{}".format(i+1,j+1))
sub_text.font.subscript=True
a.add_run(" = {}".format(round(yapi.amp[i][j],3)))
tableAmplitude.allow_autofit=False
tableAmplitude.style = "Table Grid"
for row in tableAmplitude.rows:
row.height = Inches(0.4)
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Mode Shapes-----------#
document.add_paragraph("")
document.add_picture("ModeShapes.png",width=Inches(6),height=Inches(3))
os.remove("ModeShapes.png")
document.add_page_break()
#----------Generalized Mass Matrix-----------#
document.add_heading("Generalized Mass Matrix",level=1)
document.add_paragraph("")
tableGenMass = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableGenMass.allow_autofit = False
for i in range(1,rowNumber[0]+1):
for cell in tableGenMass.columns[i].cells:
cell.width = Inches(0.5)
cell = tableGenMass.cell(ArrayNameLocation, 0)
cell.width = Inches(1.5)
cell.text = 'M ='
#----------Creating Generalized Mass Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableGenMass.cell(i,j+1)
cell.text="{}".format(round(yapi.M_Generalized[i][j],2))
for row in tableGenMass.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Generalized Stiffness Matrix-----------#
document.add_heading("Generalized Stiffness Matrix",level=1)
document.add_paragraph("")
tableGenStiffness = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableGenStiffness.allow_autofit = False
for i in range(1,rowNumber[0]+1):
for cell in tableGenStiffness.columns[i].cells:
cell.width = Inches(0.5)
cell = tableGenStiffness.cell(ArrayNameLocation, 0)
cell.width = Inches(1.5)
cell.text = 'K ='
#----------Creating Generalized Stiffness Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableGenStiffness.cell(i,j+1)
cell.text="{}".format(round(yapi.K_Generalized[i][j],2))
for row in tableGenStiffness.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
#----------Generalized Damping Matrix-----------#
document.add_heading("Generalized Damping Matrix",level=1)
document.add_paragraph("")
tableGenDamping = document.add_table(rows=rowNumber[0], cols=rowNumber[0]+1)
tableGenDamping.allow_autofit = False
for i in range(1,rowNumber[0]+1):
for cell in tableGenDamping.columns[i].cells:
cell.width = Inches(0.5)
cell = tableGenDamping.cell(ArrayNameLocation, 0)
cell.width = Inches(1.5)
cell.text = 'C ='
#----------Creating Generalized Damping Matrix-----------#
for i in range(0,rowNumber[0]):
for j in range(0,rowNumber[0]):
cell=tableGenDamping.cell(i,j+1)
cell.text="{}".format(round(yapi.C_Generalized[i][j],2))
for row in tableGenDamping.rows:
for cell in row.cells:
paragraphs = cell.paragraphs
for paragraph in paragraphs:
for run in paragraph.runs:
font = run.font
font.size= Pt(9)
while completed < 58:
completed += 0.0001
ui.progressBar.setValue(completed)
#----------MODAL PARTICIPATING FACTOR FOR EACH MODES-----------#
document.add_heading("Modal Participating Factors",level=1)
document.add_paragraph("")
for i in range(0,rowNumber[0]):
p=document.add_paragraph("")
a = p.add_run("Γ")
font = a.font
font.size = Pt(9)
sub_p=p.add_run("x{}".format(i+1))
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(9)
b = p.add_run(" = {} ".format(round(yapi.lam[i][0],3)))
font = b.font
font.size = Pt(9)
sub_p.font.subscript=True
#----------Effective Participating Mass Of Each Mode-----------#
document.add_heading("Effective Participating Mass of Each Mode",level=1)
document.add_paragraph("")
for i in range(0,rowNumber[0]):
p=document.add_paragraph("")
a = p.add_run("M")
font = a.font
font.size = Pt(9)
sub_p=p.add_run("x{}".format(i+1))
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(9)
b = p.add_run(" = {} ".format(round(yapi.M_eff[i][0],3)))
font = b.font
font.size = Pt(9)
sub_p.font.subscript=True
#----------Earthquake Acceleration Data-----------#
document.add_picture("EarthquakeData.png",width=Inches(6),height=Inches(4))
os.remove("EarthquakeData.png")
document.add_paragraph("")
#----------Psuedo Displacement Respond Spectrum-----------#
document.add_picture("PseudoDisplacement.png",width=Inches(6),height=Inches(4))
os.remove("PseudoDisplacement.png")
document.add_paragraph("")
document.add_picture("PseudoAcceleration.png",width=Inches(6),height=Inches(4))
os.remove("PseudoAcceleration.png")
#----------Psuedo Acceleration Respond Spectrum-----------#
document.add_heading("Psuedo Acceleration Respond Spectrum",level=1)
document.add_paragraph("")
for i in range(0,rowNumber[0]):
p=document.add_paragraph("")
a = p.add_run("S")
font = a.font
font.size = Pt(11)
sub_p=p.add_run("ae{}".format(i+1))
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(11)
b = p.add_run(" = {} ".format(round(yapi.Sae[i][0],3)))
font = b.font
font.size = Pt(11)
sub_p.font.subscript=True
#----------Mode's Base Shear Forces-----------#
document.add_heading("Modes' Base Shear Forces",level=1)
document.add_paragraph("")
for i in range(0,rowNumber[0]):
p=document.add_paragraph("")
a = p.add_run("V")
font = a.font
font.size = Pt(11)
sub_p=p.add_run("x{}".format(i+1))
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(11)
b = p.add_run(" = {} ".format(round(yapi.Ft[i][0],3)))
font = b.font
font.size = Pt(11)
sub_p.font.subscript=True
#----------Estimation of Base Shear Force with SRSS method-----------#
document.add_heading("Total Base Shear Force with SRSS method",level=1)
document.add_paragraph("")
p=document.add_paragraph("")
a = p.add_run("V")
font = a.font
font.size = Pt(11)
sub_p=p.add_run("T")
sub_p.font.subscript=True
font = sub_p.font
font.size = Pt(11)
b = p.add_run(" = {} ".format(round(yapi.totalFt[0],3)))
font = b.font
font.size = Pt(11)
sub_p.font.subscript=True
while completed < 100:
completed += 0.0001
ui.progressBar.setValue(completed)
ui.progressBar.hide()
ui.progressBar.setProperty("value", 0)
document.save(savedfileName)
else:
ui.progressBar.hide()
#--------------Printing Bar----------------#
#-----------------------------------------#
def word_():
ui.progressBar.setFormat("Printing %p.00%")
ui.progressBar.show()
answer4 = QMessageBox.question(WinMain,"Print","Are you sure to print?",\
QMessageBox.Yes | QMessageBox.No)
if answer4 == QMessageBox.Yes:
try:
word()
except Exception as Error:
os.remove(savedfileName)
ui.statusbar.showMessage("Error: There is an invalid value",10000)
else:
ui.progressBar.hide()
ui.statusbar.showMessage("Printing process has been cancelled.",10000)
WinMain.show()
#-----------------Links-------------------#
#-----------------------------------------#
def linkOnur():
import webbrowser
webbrowser.open('https://www.linkedin.com/in/onur-%C3%BClk%C3%BC-836434128/')
def linkAli():
import webbrowser
webbrowser.open('https://www.linkedin.com/in/alitatici/')
def linkAFAD():
import webbrowser
webbrowser.open('https://tadas.afad.gov.tr/')
#---------------SIGNAL-SLOT---------------#
#-----------------------------------------#
ui.pb_Add.clicked.connect(addData)
ui.pb_reset.clicked.connect(deleteAll)
ui.pb_Exit.clicked.connect(exit_)
ui.pb_dltRow.clicked.connect(deleteRow)
ui.pb_find.clicked.connect(search_)
ui.pb_list.clicked.connect(makeList)
ui.actionAbout.triggered.connect(about_)
ui.actionManual_2.triggered.connect(manual_)
ui.pb_change.clicked.connect(changeRow)
ui.cm_Floor.activated.connect(comboact)
ui.pb_fromfile.clicked.connect(eqfile)
ui.pb_Save.clicked.connect(saveExcelFile)
ui.pb_Open.clicked.connect(openExcelFile)
ui.pb_run.clicked.connect(run_)
ui.pb_Print.clicked.connect(word_)
uiAbout.pushButton_2.clicked.connect(linkOnur)
uiAbout.pushButton.clicked.connect(linkAli)
uiManual.commandLinkButton.clicked.connect(linkAFAD)
sys.exit(Application.exec_())