diff options
author | deepa-chaudhari | 2015-06-12 19:09:54 +0530 |
---|---|---|
committer | deepa-chaudhari | 2015-06-12 19:09:54 +0530 |
commit | f2feca225837ad425a37d96fa5bc547abdfea73a (patch) | |
tree | 3bea6f2e60d3b5865a82915002d2be5f13facd5d | |
parent | 3a33538fa928154000843c6ebf6bc836ee2cafeb (diff) | |
download | OsdagLive-f2feca225837ad425a37d96fa5bc547abdfea73a.tar.gz OsdagLive-f2feca225837ad425a37d96fa5bc547abdfea73a.tar.bz2 OsdagLive-f2feca225837ad425a37d96fa5bc547abdfea73a.zip |
error handling
-rw-r--r-- | Connections/Shear/Finplate/fin.log | 22 | ||||
-rw-r--r-- | Connections/Shear/Finplate/finPlate.ui | 2 | ||||
-rw-r--r-- | Connections/Shear/Finplate/finPlateMain.py | 59 | ||||
-rw-r--r-- | Connections/Shear/Finplate/finplate_calc1.py | 67 | ||||
-rw-r--r-- | Connections/Shear/Finplate/nutBoltPlacement.py | 4 | ||||
-rw-r--r-- | Connections/Shear/Finplate/saveINPUT.txt | 2 | ||||
-rw-r--r-- | Connections/Shear/Finplate/ui_finPlate.py | 4 |
7 files changed, 106 insertions, 54 deletions
diff --git a/Connections/Shear/Finplate/fin.log b/Connections/Shear/Finplate/fin.log index 82081b6..a45941d 100644 --- a/Connections/Shear/Finplate/fin.log +++ b/Connections/Shear/Finplate/fin.log @@ -1,13 +1,31 @@ <link rel="stylesheet" type="text/css" href="log.css"/> <div class="LOG INFO"> - <span class="DATE">Thu, 11 Jun 2015 23:54:20</span> + <span class="DATE">Fri, 12 Jun 2015 18:51:34</span> <span class="LEVEL">INFO</span> <span class="MSG">: Overall finplate connection design is safe</span> </div> <div class="LOG INFO"> - <span class="DATE">Thu, 11 Jun 2015 23:54:20</span> + <span class="DATE">Fri, 12 Jun 2015 18:51:34</span> + <span class="LEVEL">INFO</span> + <span class="MSG">: Overall finplate connection design is safe</span> + </div> + + <div class="LOG INFO"> + <span class="DATE">Fri, 12 Jun 2015 18:54:45</span> + <span class="LEVEL">INFO</span> + <span class="MSG">: Overall finplate connection design is safe</span> + </div> + + <div class="LOG INFO"> + <span class="DATE">Fri, 12 Jun 2015 18:56:23</span> + <span class="LEVEL">INFO</span> + <span class="MSG">: Overall finplate connection design is safe</span> + </div> + + <div class="LOG INFO"> + <span class="DATE">Fri, 12 Jun 2015 18:56:23</span> <span class="LEVEL">INFO</span> <span class="MSG">: Overall finplate connection design is safe</span> </div> diff --git a/Connections/Shear/Finplate/finPlate.ui b/Connections/Shear/Finplate/finPlate.ui index 07555b9..02ceab0 100644 --- a/Connections/Shear/Finplate/finPlate.ui +++ b/Connections/Shear/Finplate/finPlate.ui @@ -171,7 +171,7 @@ <enum>Qt::NoFocus</enum> </property> <property name="toolTip"> - <string>Save Image</string> + <string>Save 3D Images</string> </property> <property name="text"> <string>...</string> diff --git a/Connections/Shear/Finplate/finPlateMain.py b/Connections/Shear/Finplate/finPlateMain.py index a8e0371..e36c791 100644 --- a/Connections/Shear/Finplate/finPlateMain.py +++ b/Connections/Shear/Finplate/finPlateMain.py @@ -110,6 +110,8 @@ class MainController(QtGui.QMainWindow): self.ui.actionSave_log_messages.triggered.connect(self.save_log) self.ui.actionEnlarge_font_size.triggered.connect(self.showFontDialogue) self.ui.actionZoom_in.triggered.connect(self.callZoomin) + self.ui.actionSave_3D_model_as.triggered.connect(self.save3DcadImages) + self.ui.actionSave_current_2D_image_as.triggered.connect(self.save2DcadImages) self.ui.combo_Beam.addItems(get_beamcombolist()) @@ -133,7 +135,7 @@ class MainController(QtGui.QMainWindow): # Initialising the qtviewer self.display,_ = self.init_display(backend_str="pyqt4") - self.ui.btnSvgSave.clicked.connect(self.save3DtoIGES) + self.ui.btnSvgSave.clicked.connect(self.save3DcadImages) #self.ui.btnSvgSave.clicked.connect(lambda:self.saveTopng(self.display)) self.connectivity = None @@ -157,7 +159,18 @@ class MainController(QtGui.QMainWindow): def callZoomin(self): self.display.DynamicZoom() + + def save2DcadImages(self): + files_types = "PNG (*.png);;JPG (*.jpg);;GIF (*.gif)" + fileName = QtGui.QFileDialog.getSaveFileName(self, 'Export', "/home/deepa/Cadfiles/untitled.png", files_types ) + fName = str(fileName) + file_extension = fName.split(".")[-1] + if file_extension == 'png' or file_extension == 'jpg' or file_extension == 'gif': + self.display.ExportToImage(fName) + QtGui.QMessageBox.about(self,'Information',"File saved") + + def disableViewButtons(self): ''' Disables the all buttons in toolbar @@ -199,8 +212,7 @@ class MainController(QtGui.QMainWindow): self.ui.comboPlateThick_2.addItem(str(i)) self.ui.comboPlateThick_2.setCurrentIndex(0) - def saveTopng(self,display): - display.ExportToImage('/home/Pictures/cad.png') + def retrieve_prevstate(self): uiObj = self.get_prevstate() @@ -370,6 +382,7 @@ class MainController(QtGui.QMainWindow): '''(file open for writing)-> boolean ''' fname = QtCore.QFile(fileName) + if not fname.open(QtCore.QFile.WriteOnly | QtCore.QFile.Text): QtGui.QMessageBox.warning(self, "Application", "Cannot write file %s:\n%s." % (fileName, fname.errorString())) @@ -381,8 +394,9 @@ class MainController(QtGui.QMainWindow): QtGui.QApplication.restoreOverrideCursor() #self.setCurrentFile(fileName); + QtGui.QMessageBox.about(self,'Information',"File saved") - return True + def save_yaml(self,outObj,uiObj): @@ -452,6 +466,9 @@ class MainController(QtGui.QMainWindow): self.ui.txtWeldStrng.clear() self.ui.textEdit.clear() + #------ Erase Display + self.display.EraseAll() + def dockbtn_clicked(self,widget): '''(QWidget) -> NoneType @@ -871,16 +888,14 @@ class MainController(QtGui.QMainWindow): def create2Dcad(self,connectivity): cadlist = self.connectivity.get_models() - print len(cadlist) final_model = cadlist[0] #model = cadlist[1] for model in cadlist[1:]: final_model = BRepAlgoAPI_Fuse(model,final_model).Shape() return final_model - - # Export to IGES - def save3DtoIGES(self): + # Export to IGS,STEP,STL,BREP + def save3DcadImages(self): if self.connectivity == None: self.connectivity = self.create3DColWebBeamWeb() if self.fuse_model == None: @@ -888,7 +903,8 @@ class MainController(QtGui.QMainWindow): shape = self.fuse_model files_types = "IGS (*.igs);;STEP (*.stp);;STL (*.stl);;BREP(*.brep)" - fileName = QtGui.QFileDialog.getSaveFileName(self, 'Export', "/home/Cadfiles/untitled.igs", files_types ) + fileName = QtGui.QFileDialog.getSaveFileName(self, 'Export', "/home/deepa/Cadfiles/untitled.igs", files_types ) + fName = str(fileName) file_extension = fName.split(".")[-1] @@ -917,11 +933,13 @@ class MainController(QtGui.QMainWindow): stl_writer = StlAPI_Writer() stl_writer.SetASCIIMode(True) stl_writer.Write(shape,fName) + + QtGui.QMessageBox.about(self,'Information',"File saved") + def display2DModelOriginal(self, final_model, viewName): self.display,_ = self.init_display() - self.display.ResetView() self.display.EraseAll() #self.display.SetModeWireFrame() @@ -987,6 +1005,7 @@ class MainController(QtGui.QMainWindow): '''Displays front view of 2Dmodel ''' + self.ui.btnSvgSave.setEnabled(False) self.ui.chkBxBeam.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxCol.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxFinplate.setChecked(QtCore.Qt.Unchecked) @@ -1001,12 +1020,11 @@ class MainController(QtGui.QMainWindow): self.fuse_model = self.create2Dcad(self.connectivity) self.display2DModel( self.fuse_model,"Front") - - def call_Topview(self): '''Displays Top view of 2Dmodel ''' + self.ui.btnSvgSave.setEnabled(False) self.ui.chkBxBeam.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxCol.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxFinplate.setChecked(QtCore.Qt.Unchecked) @@ -1014,20 +1032,29 @@ class MainController(QtGui.QMainWindow): self.display.EraseAll() self.ui.mytabWidget.setCurrentIndex(1) - final_model = self.create2Dcad() - self.display2DModel(final_model, "Top") + if self.connectivity == None: + self.connectivity = self.create3DColWebBeamWeb() + if self.fuse_model == None: + self.fuse_model = self.create2Dcad(self.connectivity) + self.display2DModel( self.fuse_model,"Top") + def call_Sideview(self): '''Displays Side view of the 2Dmodel' ''' + self.ui.btnSvgSave.setEnabled(False) self.ui.chkBxBeam.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxCol.setChecked(QtCore.Qt.Unchecked) self.ui.chkBxFinplate.setChecked(QtCore.Qt.Unchecked) self.ui.mytabWidget.setCurrentIndex(1) - final_model = self.create2Dcad() - self.display2DModel(final_model, "Right") + + if self.connectivity == None: + self.connectivity = self.create3DColWebBeamWeb() + if self.fuse_model == None: + self.fuse_model = self.create2Dcad(self.connectivity) + self.display2DModel( self.fuse_model,"Right") def closeEvent(self, event): ''' diff --git a/Connections/Shear/Finplate/finplate_calc1.py b/Connections/Shear/Finplate/finplate_calc1.py index 5f934c8..c7a776c 100644 --- a/Connections/Shear/Finplate/finplate_calc1.py +++ b/Connections/Shear/Finplate/finplate_calc1.py @@ -153,17 +153,17 @@ def finConn(uiObj): elif min_plate_height > max_plate_height: logger.error(": Minimum required plate height is more than the clear depth of the beam") - logger.warning(": Minimum plate height required is %2.2f mm " % (min_plate_height)) + logger.warning(": Plate height required should be more than %2.2f mm " % (min_plate_height)) logger.warning(": Maximum plate height allowed is %2.2f mm " % (max_plate_height)) logger.info(": Increase the plate thickness") #print "Error: Height of plate is more than the clear depth of the beam" #print" Maximum plate height allowed is " + str(max_plate_height) + " mm" web_plate_l = max_plate_height; - elif min_plate_height > web_plate_l: + elif min_plate_height >= web_plate_l: logger.error(": Plate height provided is less than the minimum required ") - logger.warning(": Minimum plate height required is %2.2f mm " % (min_plate_height)) + logger.warning(": Plate height required should be more than %2.2f mm " % (min_plate_height)) # print "\nERROR: Chosen plate height is not sufficient" + "\n Minimum required height = " + str(min_plate_height) + " mm"; # print "\nSuggestion: Re-design with a different plate height or thickness" @@ -282,18 +282,24 @@ def finConn(uiObj): # Design of plate: # Width input (optional) and validation - if bolt_line == 1: - web_plate_w_req = 2 * min_edge_dist - if bolt_line == 2: - web_plate_w_req = gauge + 2 * min_edge_dist + if web_plate_w != 0: + if bolt_line == 1: + web_plate_w_req = 2 * min_edge_dist + end_dist = web_plate_w/2 + if bolt_line == 2: + web_plate_w_req = gauge + 2 * min_edge_dist + end_dist = (web_plate_w - gauge)/2 if web_plate_w == 0: if bolt_line == 1: web_plate_w_req = 2 * min_edge_dist; web_plate_w = web_plate_w_req + end_dist = web_plate_w /2 if bolt_line == 2: web_plate_w_req = gauge + 2 * min_edge_dist; web_plate_w = web_plate_w_req; + end_dist = (web_plate_w - gauge)/2 + # if web_plate_w < web_plate_w_req: # web_plate_w = web_plate_w_req; @@ -376,6 +382,7 @@ def finConn(uiObj): pass else: logger.error(": Weld thickness is not sufficient") + logger.warning(": Minimum weld thickness is required is %2.2f mm " % (weld_t_req)) # End of calculation outputObj = {} @@ -389,9 +396,9 @@ def finConn(uiObj): outputObj['Bolt']['numofrow'] = bolts_one_line outputObj['Bolt']['numofcol'] = bolt_line outputObj['Bolt']['pitch'] = pitch - outputObj['Bolt']['enddist'] = min_edge_dist - outputObj['Bolt']['edge'] = min_edge_dist - outputObj['Bolt']['gauge'] = gauge + outputObj['Bolt']['enddist'] = float(end_dist) + outputObj['Bolt']['edge'] = float(min_edge_dist) + outputObj['Bolt']['gauge'] = float(gauge) outputObj['Weld'] = {} outputObj['Weld']['thickness'] = weld_t_req @@ -410,31 +417,35 @@ def finConn(uiObj): #return outputObj if web_plate_l == (min_plate_height+10) or web_plate_l == ((max_plate_height-10)//10*10): - if bolt_line==2: - if pitch < min_pitch: + if bolt_line==1: + if web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req or weld_t_req > weld_t: + for k in outputObj.keys(): + for key in outputObj[k].keys(): + outputObj[k][key] = "" + elif moment_capacity < moment_demand: for k in outputObj.keys(): for key in outputObj[k].keys(): outputObj[k][key] = "" - else: - return outputObj - elif web_plate_l == (min_plate_height+10) or web_plate_l == ((max_plate_height-10)//10*10): - if web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req: - for k in outputObj.keys(): - for key in outputObj[k].keys(): - outputObj[k][key] = "" - elif moment_capacity < moment_demand: - for k in outputObj.keys(): - for key in outputObj[k].keys(): - outputObj[k][key] = "" - elif bolt_line==2: + if bolt_line==2: if pitch < min_pitch: for k in outputObj.keys(): for key in outputObj[k].keys(): outputObj[k][key] = "" - + elif web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req or weld_t_req > weld_t: + for k in outputObj.keys(): + for key in outputObj[k].keys(): + outputObj[k][key] = "" + elif moment_capacity < moment_demand: + for k in outputObj.keys(): + for key in outputObj[k].keys(): + outputObj[k][key] = "" + else: + + pass + else: - if web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req: + if web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req or weld_t_req > weld_t: for k in outputObj.keys(): for key in outputObj[k].keys(): outputObj[k][key] = "" @@ -448,10 +459,6 @@ def finConn(uiObj): for key in outputObj[k].keys(): outputObj[k][key] = "" -# if web_plate_l == min_plate_height or web_plate_l == max_plate_height or web_plate_l < web_plate_l_req or web_plate_w < web_plate_w_req: -# outputObj = {} -# -# elif moment_capacity < moment_demand: # outputObj = {} if outputObj['Bolt']['status'] == True: diff --git a/Connections/Shear/Finplate/nutBoltPlacement.py b/Connections/Shear/Finplate/nutBoltPlacement.py index 627f9c9..5956037 100644 --- a/Connections/Shear/Finplate/nutBoltPlacement.py +++ b/Connections/Shear/Finplate/nutBoltPlacement.py @@ -54,9 +54,9 @@ class NutBoltArray(): for rw in range(self.row): for col in range(self.col): pos = self.origin - pos = pos + self.edge * self.gaugeDir + pos = pos + self.end * self.gaugeDir pos = pos + col * self.gauge * self.gaugeDir - pos = pos + self.end * self.pitchDir + pos = pos + self.edge * self.pitchDir pos = pos + rw * self.pitch * self.pitchDir self.positions.append(pos) diff --git a/Connections/Shear/Finplate/saveINPUT.txt b/Connections/Shear/Finplate/saveINPUT.txt index 478e639..54ca750 100644 --- a/Connections/Shear/Finplate/saveINPUT.txt +++ b/Connections/Shear/Finplate/saveINPUT.txt @@ -56,5 +56,5 @@ S'HSFG' p26 sS'diameter(mm)' p27 -I20 +I12 ss.
\ No newline at end of file diff --git a/Connections/Shear/Finplate/ui_finPlate.py b/Connections/Shear/Finplate/ui_finPlate.py index cb41631..5f85414 100644 --- a/Connections/Shear/Finplate/ui_finPlate.py +++ b/Connections/Shear/Finplate/ui_finPlate.py @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file 'finPlate.ui' # -# Created: Thu Jun 11 17:13:02 2015 +# Created: Fri Jun 12 17:55:33 2015 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! @@ -1484,7 +1484,7 @@ class Ui_MainWindow(object): self.btnZmOut.setText(_translate("MainWindow", "...", None)) self.btnZmIn.setToolTip(_translate("MainWindow", "Zoom Out", None)) self.btnZmIn.setText(_translate("MainWindow", "...", None)) - self.btnSvgSave.setToolTip(_translate("MainWindow", "Save Image", None)) + self.btnSvgSave.setToolTip(_translate("MainWindow", "Save 3D Images", None)) self.btnSvgSave.setText(_translate("MainWindow", "...", None)) self.btnTotatAcw.setToolTip(_translate("MainWindow", "Rotate Left", None)) self.btnTotatAcw.setText(_translate("MainWindow", "...", None)) |