-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMainMenu.py
674 lines (504 loc) · 25 KB
/
MainMenu.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
from PyQt5.QtCore import * # core Qt functionality
from PyQt5.QtWidgets import *
from PyQt5.QtGui import * # extends QtCore with GUI functionality
from PyQt5.QtOpenGL import * # provides QGLWidget, a special OpenGL QWidget
from PyQt5 import uic
from Model import * # import Model to access tower objects
from Definition import * # import constants from Definition
from Message import * # pop up window for illegal entries
from ProjectSettings import * # open project settings dialog
from DisplaySettings import * # open display settings dialog
from VariableAssignment import * # open panel assignment dialog
from BracingScheme import * # open bracing definition dialog
from FloorPlan import * # open floor plan ui
from DesignVariable import * # open bracing and section group UI
from TowerVariation import * # generate tower variations
from SAPModelCreation import * # create and run towers in SAP2000
from Panels import *
from Face import * # open face ui
from RunTowers import * # open run towers dialog
from View2DEngine import * # import View2DEngine
from View3DEngine import * # import View3DEngine
from FileWriter import * # save or overwrite file
from FileReader import * # open existing file
import resources # For icons and UIs
import math as m
import sys # We need sys so that we can pass argv to QApplication
import os
class MainWindow(QMainWindow):
def __init__(self, *args, **kwargs):
super(MainWindow, self).__init__(*args, **kwargs,)
# Load the UI
fileh = QFile(':/UI/autobuilder_mainwindow_v3.ui')
fileh.open(QFile.ReadOnly)
uic.loadUi(fileh, self)
fileh.close()
# Project Settings data object
self.projectSettingsData = ProjectSettingsData()
# Tower object
elevs = self.projectSettingsData.floorElevs
self.tower = Tower(elevs)
self.tower.setSections(self.projectSettingsData.sections)
# File location
self.fileLoc = ''
self.fileName = ''
# Status
self.isSaved = False
self.isClosed = False
# Default for 2021 competition tower
self.tower.defineFloors()
floorPlan11 = FloorPlan()
floorPlan11.nodes = [Node(0,0), Node(12,0), Node(12,12), Node(0,12), Node(3,3), Node(9,3), Node(9,9), Node(3,9)]
floorPlan11.nodePairs = [[0,1],[1,2],[2,3],[3,0],[4,5],[5,6],[6,7],[7,4]]
floorPlan11.generateMembersfromNodes()
floorPlan12 = FloorPlan()
floorPlan12.nodes = [Node(2/3,0), Node(12,0), Node(12,12), Node(2/3,12)]
floorPlan12.generateNodePairs()
floorPlan12.generateMembersfromNodes()
floorPlan13 = FloorPlan()
floorPlan13.nodes = [Node(1+1/3,0), Node(12,0), Node(12,12), Node(1+1/3,12)]
floorPlan13.generateNodePairs()
floorPlan13.generateMembersfromNodes()
floorPlan14 = FloorPlan()
floorPlan14.nodes = [Node(2,0), Node(12,0), Node(12,12), Node(2,12)]
floorPlan14.generateNodePairs()
floorPlan14.generateMembersfromNodes()
floorPlan15 = FloorPlan()
floorPlan15.nodes = [Node(2+2/3,0), Node(12,0), Node(12,12), Node(2+2/3,12)]
floorPlan15.generateNodePairs()
floorPlan15.generateMembersfromNodes()
floorPlan16 = FloorPlan()
floorPlan16.nodes = [Node(3+1/3,0), Node(12,0), Node(12,12), Node(3+1/3,12)]
floorPlan16.generateNodePairs()
floorPlan16.generateMembersfromNodes()
floorPlan17 = FloorPlan()
floorPlan17.nodes = [Node(4,0), Node(12,0), Node(12,12), Node(4,12)]
floorPlan17.generateNodePairs()
floorPlan17.generateMembersfromNodes()
floorPlan18 = FloorPlan()
floorPlan18.nodes = [Node(4+2/3,0), Node(12,0), Node(12,12), Node(4+2/3,12)]
floorPlan18.generateNodePairs()
floorPlan18.generateMembersfromNodes()
floorPlan19 = FloorPlan()
floorPlan19.nodes = [Node(5+1/3,0), Node(12,0), Node(12,12), Node(5+1/3,12)]
floorPlan19.generateNodePairs()
floorPlan19.generateMembersfromNodes()
floorPlan20 = FloorPlan()
floorPlan20.nodes = [Node(6,0), Node(12,0),Node(12,12), Node(6,12)]
floorPlan20.generateNodePairs()
floorPlan20.generateMembersfromNodes()
allFloorPlans = [floorPlan11, floorPlan12, floorPlan13, floorPlan14, floorPlan15, floorPlan16, floorPlan17, floorPlan18, floorPlan19, floorPlan20]
for fp in allFloorPlans:
numNodes = len(fp.nodes)
for i in range(numNodes):
fp.addTopConnection(str(i+1), i)
fp.addBottomConnection(str(i+1), i)
default = Bracing('default')
default.nodePairs = [[Node(0,0), Node(0,1)], [Node(0,1), Node(1,1)], [Node(1,1), Node(1,0)], [Node(1,0), Node(0,0)]]
default.materials = ['BALSA_0.1875X0.1875', 'BALSA_0.1875X0.1875', 'BALSA_0.1875X0.1875', 'BALSA_0.1875X0.1875']
default.generateMembersfromNodes()
self.tower.addBracing(default)
for elev in elevs[:13]:
self.tower.floors[elev].addFloorPlan(floorPlan11)
for i, elev in enumerate(elevs[12:]):
self.tower.floors[elev].addFloorPlan(allFloorPlans[i+1])
for plan in allFloorPlans:
self.tower.addFloorPlan(plan)
self.tower.generateFaces()
self.tower.generateColumnsByFace()
#------------------------------------------------
# Set project settings data for all views
self.setProjectSettingsDataForViews()
# Set menu bar
self.setMenu()
# Add icons to the toolbars
self.setIconsForToolbar()
# Add icons to section view
self.setIconsForSectionView()
# Icon for MainWindow
self.setWindowIcon(QIcon(':/Icons/letter_A_blue-512.png'))
# Views ----------------------------
self.setTowerInViews()
# View 2D --------------------------
self.elevation_index = 0
self.elevation = 0
self.panel_direction = 1
self.view_2D_up.clicked.connect(self.translate_z_up_2DView)
self.view_2D_down.clicked.connect(self.translate_z_down_2DView)
self.view_2D_panel_orientation.clicked.connect(self.change_panel_orientation)
# Update views -----------------------------
timer = QTimer(self)
timer.setInterval(20) # period in miliseconds
timer.timeout.connect(self.view_3D_opengl.updateGL) # updateGL calls paintGL automatically!!
timer.timeout.connect(self.set2DViewDimension)
timer.timeout.connect(self.updateSectionView)
timer.timeout.connect(self.view_2D_painter.update)
timer.start()
def setTowerInViews(self):
self.view_3D_opengl.setTower(self.tower)
def setProjectSettingsDataForViews(self):
self.view_3D_opengl.setProjectSettingsData(self.projectSettingsData)
def setIconsForSectionView(self):
# Set icon for up button
self.view_2D_up.setIcon(QIcon(':/Icons/arrow-090.png'))
# Set icon for down button
self.view_2D_down.setIcon(QIcon(':/Icons/arrow-270.png'))
# Set icon for panels orientation button
self.view_2D_panel_orientation.setIcon(QIcon(':/Icons/flip.png'))
def setIconsForToolbar(self):
# For file managment tools----------------------------------
# Add button for opening files
self.openFile_button = QAction(QIcon(':/Icons/folder-horizontal-open.png'), "Open File", self)
self.openFile_button.setStatusTip("Open File")
self.openFile_button.triggered.connect(self.openFile)
self.files_toolbar.addAction(self.openFile_button)
# Add button for saving files
self.saveFile_button = QAction(QIcon(':/Icons/disk.png'), "Save File", self)
self.saveFile_button.setStatusTip("Save File")
self.saveFile_button.triggered.connect(self.saveFile)
self.files_toolbar.addAction(self.saveFile_button)
# For general tools-------------------------------------------
# Add button for Project Settings
self.setting_button = QAction(QIcon(':/Icons/gear.png'), "Project Settings", self)
self.setting_button.setStatusTip("Project Settings")
self.setting_button.triggered.connect(self.openProjectSettings)
self.functions_toolbar.addAction(self.setting_button)
# Add button for Display Settings
self.displaySetting_button = QAction(QIcon(':/Icons/application-sidebar.png'), "Display Settings", self)
self.displaySetting_button.setStatusTip("Display Settings")
self.displaySetting_button.triggered.connect(self.openDisplaySettings)
self.functions_toolbar.addAction(self.displaySetting_button)
# Add button for Editing Bracing Scheme
self.brace_button = QAction(QIcon(':/Icons/Bracing - 24x24.png'), "Edit Brace Scheme", self)
self.brace_button.setStatusTip("Edit Brace Scheme")
self.brace_button.triggered.connect(self.openBracingScheme)
self.functions_toolbar.addAction(self.brace_button)
# Add button for Editing Floor Plan
self.floorPlan_button = QAction(QIcon(':/Icons/Floor Plan - 24x24.png'), "Edit Floor Plan", self)
self.floorPlan_button.setStatusTip("Edit Floor Plan")
self.floorPlan_button.triggered.connect(self.openFloorDesign)
self.functions_toolbar.addAction(self.floorPlan_button)
# Add button for Editing Panel
self.face_button = QAction(QIcon(':/Icons/table.png'), "Edit Face", self)
self.face_button.setStatusTip("Edit Face")
self.face_button.triggered.connect(self.openFace)
self.functions_toolbar.addAction(self.face_button)
# Add button for Editing Panel
self.panel_button = QAction(QIcon(':/Icons/Panel - 24x24.png'), "Edit Panel", self)
self.panel_button.setStatusTip("Edit Panel")
self.panel_button.triggered.connect(self.openPanel)
self.functions_toolbar.addAction(self.panel_button)
# Add button for Editing Bracing Groups
self.editDesignVariable_button = QAction(QIcon(':/Icons/pencil.png'),"Edit Design Variables", self)
self.editDesignVariable_button.setStatusTip("Edit Design Variables")
self.editDesignVariable_button.triggered.connect(self.DesignVariable)
self.functions_toolbar.addAction(self.editDesignVariable_button)
# Add button for Assign Design variable
self.assignDesignVariable_button = QAction(QIcon(':/Icons/pencil_plus.png'),"Assign Bracing Design", self)
self.assignDesignVariable_button.setStatusTip("Assign Bracing Design")
self.assignDesignVariable_button.triggered.connect(self.openAssignment)
self.functions_toolbar.addAction(self.assignDesignVariable_button)
# Add button for Constraintset
self.constraint_button = QAction(QIcon(':/Icons/filter - 24x24.png'), "Modify Constraint", self)
self.constraint_button.setStatusTip("Modify Constraint")
self.constraint_button.triggered.connect(lambda x: x) # add function
self.functions_toolbar.addAction(self.constraint_button)
# Add button for Generating Tower
self.generateTower_button = QAction(QIcon(':/Icons/Generate Tower - 24x24.png'), "Generate Tower", self)
self.generateTower_button.setStatusTip("Generate Tower")
self.generateTower_button.triggered.connect(self.generateInputTable)
self.functions_toolbar.addAction(self.generateTower_button)
# Add button for Running Tower
self.runTower_button = QAction(QIcon(':/Icons/Run Tower - 24x24.png'), "Run Tower", self)
self.runTower_button.setStatusTip("Run Tower")
self.runTower_button.triggered.connect(self.openRunTowers)
self.functions_toolbar.addAction(self.runTower_button)
# For views controls------------------------------------------
# Add button for going up the tower
self.up_button = QAction(QIcon(':/Icons/arrow-090.png'), "Up", self)
self.up_button.setStatusTip("Up")
self.up_button.triggered.connect(lambda x: self.view_3D_opengl.moveUp())
self.views_toolbar.addAction(self.up_button)
# Add button for going down the tower
self.down_button = QAction(QIcon(':/Icons/arrow-270.png'), "Down", self)
self.down_button.setStatusTip("Down")
self.down_button.triggered.connect(lambda x: self.view_3D_opengl.moveDown())
self.views_toolbar.addAction(self.down_button)
def closeEvent(self, event):
warning = WarningMessage()
# Prompt to save
if not self.isSaved:
title = 'Your file has not been saved. Do you want to save it?'
if self.fileLoc:
warning.popUpConfirmation(title, self.saveFile)
else:
warning.popUpConfirmation(title, self.saveAsFile)
# Prompt to close Autobuilder
title = 'Do you want to close Autobuilder?'
warning.popUpConfirmation(title, self.setIsClosed)
if self.isClosed:
event.accept()
else:
event.ignore()
def setIsClosed(self):
self.isClosed = True
def setMenu(self):
# Project Settings
self.action_ProjectSettings.triggered.connect(self.openProjectSettings)
# Floor plans
self.action_FloorPlan.triggered.connect(self.openFloorDesign)
# Generate Panels from Floor Plans
self.action_GPFromFloorPlan.triggered.connect(self.generatePanelsFromFloorPlan)
# Panels
self.action_Panel.triggered.connect(self.openPanel)
# Bracing Scheme
self.action_BracingScheme.triggered.connect(self.openBracingScheme)
# Bracing Design
self.action_DesignVariable.triggered.connect(self.DesignVariable)
# Assign Bracing Design
self.action_AssignVariable.triggered.connect(self.openAssignment)
# Modify Constraint
self.action_Constraint.triggered.connect(lambda x: x)
# Generate Tower
self.action_GenerateTowers.triggered.connect(self.generateInputTable)
# Run Tower
self.action_RunTowers.triggered.connect(self.openRunTowers)
# Save File
self.action_Save.triggered.connect(self.saveFile)
# Save File As
self.action_SaveFileAs.triggered.connect(self.saveAsFile)
# Open File
self.action_Open.triggered.connect(self.openFile)
# Save file ------------------------------------------------------------------------------
def saveFile(self, signal=None):
if self.fileLoc != '':
filewriter = FileWriter(self.fileLoc, self.tower, self.projectSettingsData)
try:
filewriter.writeFiles()
# Update status
self.isSaved = True
except:
warning = WarningMessage()
warning.popUpErrorBox('Fail to save files. Please check if you have permission to access the files or the directory.')
else:
self.saveAsFile()
def saveAsFile(self, signal=None):
fileInfo = QFileDialog.getSaveFileName(self, "Save As", "untitled.ab", "Autobuilder files (*.ab)")
if fileInfo[0]: # No action if no file was selected
self.fileLoc = fileInfo[0]
self.fileName = fileInfo[0].split("/")[-1]
self.setWindowTitle("Autobuilder 3.0 - {}".format(self.fileName))
filewriter = FileWriter(self.fileLoc, self.tower, self.projectSettingsData)
try:
filewriter.writeFiles()
# Update status
self.isSaved = True
except:
warning = WarningMessage()
warning.popUpErrorBox('Fail to save files. Please check if you have permission to access the files or the directory.')
# Open file ------------------------------------------------------------------------------
def openFile(self, signal=None):
# Prompt to save
if not self.isSaved:
warning = WarningMessage()
title = 'Your file has not been saved. Do you want to save it?'
if self.fileLoc:
warning.popUpConfirmation(title, self.saveFile)
else:
warning.popUpConfirmation(title, self.saveAsFile)
fileInfo = QFileDialog.getOpenFileName(self, "Open File", "autobuilder.ab", "Autobuilder files (*.ab)")
if fileInfo[0]: # No action if no file was selected
self.fileLoc = fileInfo[0]
self.fileName = fileInfo[0].split("/")[-1]
self.setWindowTitle("Autobuilder 3.0 - {}".format(self.fileName))
#NOTE: reset psData as well!!
self.projectSettingsData.reset()
self.tower.reset() # clean all data in tower
try:
filereader = FileReader(self.fileLoc, self.tower, self.projectSettingsData)
filereader.readMainFile()
except:
warning = WarningMessage()
warning.popUpErrorBox('Fail to open file. Please check if the selected file is corrupted.')
self.tower.build()
# Reset Status
self.isSaved = False
# For Project Settings --------------------------------------------
def openProjectSettings(self, signal):
projectSettings = ProjectSettings.ProjectSettings(self)
projectSettings.Populate()
projectSettings.exec_()
# For Display Settings --------------------------------------------
def openDisplaySettings(self, signal):
displaySettings = DisplaySettingsUI(self)
displaySettings.exec_()
# For Bracing Scheme --------------------------------------------
def openBracingScheme(self, signal):
bracingScheme = BracingScheme(self)
bracingScheme.exec_()
# For 2D view -----------------------------------------------------
def set2DViewDimension(self):
size = self.view_2D_painter.size()
self.view_2D_painter.dimension_x = size.width()
self.view_2D_painter.dimension_y = size.height()
def View2DObjects(self):
''' --> list(ViewMember), list(ViewNode), list(ViewText) '''
renderX = self.projectSettingsData.renderX
renderY = self.projectSettingsData.renderY
# Step 1: Get floor plan and panels at the current elevation level
floor = self.tower.floors[self.elevation]
floorPlans = floor.floorPlans
panels = floor.panels
vMembers = []
vNodes = []
vTexts = []
# Step 2: Create view objects for panels
color_panel = Color.Panel['MainMenu']
color_text = Color.Text['MainMenu']
vText = ViewText()
for panel in panels:
vMember = ViewMember()
# Set View Objects attributes --------------------------------
vMember.setColor(color_panel)
vMember.setSize(View2DConstants.MEMBER_SIZE)
vMember.setDimX(renderX)
vMember.setDimY(renderY)
vText.setColor(color_text)
vText.setSize(View2DConstants.TEXT_SIZE)
vText.setDimX(renderX)
vText.setDimY(renderY)
# Find panel corners coordinates
lowerLeft = panel.lowerLeft
lowerRight = panel.lowerRight
base = Member(lowerLeft, lowerRight)
angle = base.angle()
rot = self.panel_direction * m.pi/2
dx = m.cos(angle - rot)
dy = m.sin(angle - rot)
upperLeft = Node(lowerLeft.x + dx, lowerLeft.y + dy)
upperRight = Node(lowerRight.x + dx, lowerRight.y + dy)
# Panel members ------------------------------------
vMember.addMember(Member(lowerLeft, upperLeft))
vMember.addMember(Member(upperLeft, upperRight))
vMember.addMember(Member(upperRight, lowerRight))
vMembers.append(vMember)
# Panel labels --------------------------------------
label = ''
dsettings = self.tower.displaySettings
checkList = [
dsettings.pName,
dsettings.pLength,
]
value = [
'P-' + panel.name,
'L=' + str(panel.averageSideLength()),
]
for i, check in enumerate(checkList):
if check:
label = label + value[i] + ' '
vText.addMember(Member(lowerLeft, lowerRight))
vText.addText(label)
vText.setLocation(Node(0.5, 0.5*self.panel_direction)) # midpoint
vTexts.append(vText)
# Step 3: Create view object for floor plans
color_fplan = Color.FloorPlan['MainMenu']
color_node = Color.Node['MainMenu']
limit = len(color_fplan) - 1
for i, floorPlan in enumerate(floorPlans):
vMember = ViewMember()
vNode = ViewNode()
# Set View Objects attributes --------------------------------
vMember.setColor(color_fplan[min(i, limit)])
vMember.setSize(View2DConstants.MEMBER_SIZE)
vMember.setDimX(renderX)
vMember.setDimY(renderY)
vNode.setColor(color_node)
vNode.setSize(View2DConstants.NODE_SIZE)
vNode.setDimX(renderX)
vNode.setDimY(renderY)
# Floor plan members and nodes ------------------------------
for member in floorPlan.members:
vMember.addMember(member)
vNode.addNode(member.start_node)
vNode.addNode(member.end_node) # redundant but just in case
vMembers.append(vMember)
vNodes.append(vNode)
return vMembers, vNodes, vTexts
def updateSectionView(self):
if not self.tower.floors: # update only when floors are provided
return
vMembers, vNodes, vTexts = self.View2DObjects()
self.view_2D_painter.reset() # clear all the existing objects
for vMember in vMembers:
self.view_2D_painter.addMember(vMember)
for vNode in vNodes:
self.view_2D_painter.addNode(vNode)
for vText in vTexts:
self.view_2D_painter.addText(vText)
self.view_2D_elevation.setText('Z = ' + str(self.elevation))
def translate_z_up_2DView(self, signal):
# prevent list to go out of range
self.elevation_index = min(len(self.tower.elevations)-1, self.elevation_index+1)
self.elevation = self.tower.elevations[self.elevation_index]
def translate_z_down_2DView(self, signal):
# prevent list to go out of range
self.elevation_index = max(0, self.elevation_index-1)
self.elevation = self.tower.elevations[self.elevation_index]
def change_panel_orientation(self, signal):
self.panel_direction *= -1
# For FloorDesign--------------------------------------------
def openFloorDesign(self, signal):
floorPlan = FloorPlanUI(self)
floorPlan.exec_()
# For Face--------------------------------------------
def openFace(self, signal):
face= FaceUI(self)
face.exec_()
# For Panel--------------------------------------------
def openPanel(self, signal):
panel= panelsUI(self)
panel.exec_()
def generatePanelsFromFloorPlan(self, signal):
if self.tower.panels:
warning = WarningMessage()
title = 'Do you want to generate panels in addition to the existing ones?'
warning.popUpConfirmation(title, self.tower.generatePanels_addToFloors)
else:
self.tower.generatePanels_addToFloors()
# For Bracing Group --------------------------------------------
def DesignVariable(self, signal):
designVariable = DesignVariable(self)
designVariable.exec_()
def openAssignment(self, signal):
assignment = VariableAssignment(self)
warning = WarningMessage()
try:
# make sure bracing groups and section groups have been defined
skey = list(self.tower.bracingGroups.keys())[0]
bkey = list(self.tower.sectionGroups.keys())[0]
assignment.exec_()
except:
warning.popUpErrorBox('Please define bracing and section groups first!')
return # terminate the saving process
# For Tower Variations --------------------------------------------
def generateInputTable(self, signal):
if self.fileLoc == '':
msg = WarningMessage()
msg.popUpErrorBox('Please save before generating input table')
return
generateTower = GenerateTower(self)
generateTower.exec_()
# Run towers --------------------------------------------
def createSAPModels(self):
if not self.tower.inputTable:
msg = WarningMessage()
msg.popUpErrorBox('Please generate input table before running SAP2000')
return
runTower = RunTower(self)
runTower.exec_()
def openRunTowers(self, signal):
runTowers = RunTowers(self)
runTowers.exec_()
if self.projectSettingsData.toRun:
self.createSAPModels()
self.projectSettingsData.toRun = False