def __init__(self, parent,Nodos,Bars,Shells,NodosPath,BarsPath,ShellsPath,base): super(RightPanelDown_Clips,self).__init__( parent,Nodos,Bars,Shells,NodosPath,BarsPath,ShellsPath) self.base=base self.display.SetDefaultStyle(wx.TextAttr(wx.GREEN)) self.display.AppendText('Frame Joints Input Data Dictionary: ' + " \n") self.display.SetDefaultStyle(wx.TextAttr(wx.BLUE)) self.display.AppendText(str(self.base.Analysis.geo) + " \n") self.display.SetDefaultStyle(wx.TextAttr(wx.GREEN)) self.display.AppendText('Frame Joints Input Load Dictionary: ' + " \n") self.display.SetDefaultStyle(wx.TextAttr(wx.BLUE)) self.display.AppendText(str(self.base.Analysis.lcs) + " \n") self.display.SetDefaultStyle(wx.TextAttr(wx.RED)) print self.base.Analysis.MinimoMinimorum[1][0][1] print self.base.Analysis.MinimoMinimorum[0] print self.base.Analysis.MinimoMinimorum[1][1][0] self.display.AppendText("RF min = " + str(truncate(self.base.Analysis.MinimoMinimorum[1][0][1],2)) + ' at ' + str(self.base.Analysis.MinimoMinimorum [0]) + ' ' + self.base.Analysis.MinimoMinimorum [1][1][0] ) self.display.Refresh() #self.sizer.Add(self.display,1, wx.EXPAND, 40) self.SetSizer(self.sizer) self.sizer.Fit(self)
def AccionarButton1(self,event): #print self.base.Analysis #print self.base.Analysis.geo '''print self.base.Analysis.Analysis print self.base.Analysis.Analysis.keys() a=self.base.Analysis.Analysis.keys()[0] print self.base.Analysis.Analysis[a] print self.base.Analysis.Analysis[a].minimorum''' myfile= wx.FileDialog(self, " Save Frame Joints ", "", "","Result Files (*.RES.1)|*.RES.1", wx.FD_SAVE ) if myfile.ShowModal() == wx.ID_CANCEL: return # the user changed idea... f=open(myfile.GetPath(),'w') if self.chb1.GetValue(): f.write(' #### MINIMUM MINIMORUM #### \n') f.write('\n') minimo= self.base.Analysis.MinimoMinimorum[0] factor='' if self.base.Analysis.elementDict[self.base.Analysis.MinimoMinimorum[0]]=="TYPICAL": factor=" (" + str("%2f"% float(self.base.Analysis.Analysis[self.base.Analysis.MinimoMinimorum[0]].former_allw_factor)) + ")" print factor f.write(' Element: ' + str(self.base.Analysis.MinimoMinimorum[0]) + ' --- ' + str(self.base.Analysis.geo[minimo][0][0]) + ': ' + str(self.base.Analysis.geo[minimo][0][1]) + '; ' + str(self.base.Analysis.geo[minimo][0][2]) + '; ' + str(self.base.Analysis.geo[minimo][0][3]) + ': ' + str(self.base.Analysis.geo[minimo][0][4]) + ' and ' + str(self.base.Analysis.geo[minimo][0][5])+'; ' + self.base.Analysis.elementDict[self.base.Analysis.MinimoMinimorum[0]] + factor + '\n') #+ str(self.base.Analyisis.geo[minimo][0][3]) + '\n') f.write( ' ' + poner_espacios(str(self.base.Analysis.MinimoMinimorum[1][1][0]),10) + ' ' + poner_espacios('Mat. = ' + str(self.base.Analysis.MinimoMinimorum[1][1][2]),15) + ' ' + poner_espacios('Proc. = ' + str(self.base.Analysis.MinimoMinimorum[1][1][3]),15) + ' ' + poner_espacios('Rivet = ' + str(self.base.Analysis.MinimoMinimorum[1][1][5]),21) + ' ' + poner_espacios('Allw. = ' + str("%.1f" % self.base.Analysis.MinimoMinimorum[1][1][7]),18) + ' ' + poner_espacios('Lc = ' + str("%.1f" % self.base.Analysis.MinimoMinimorum[1][0][2]),17 ) + ' ' + poner_espacios('LcId. = ' + str(self.base.Analysis.MinimoMinimorum[1][0][0]),17 ) + ' ' + 'RF = ' + str(truncate(self.base.Analysis.MinimoMinimorum[1][0][1],2)) +'\n') f.write('\n') f.write('\n') if self.chb2.GetValue(): f.write(' #### MINIMUM PER ELEMENT #### \n') f.write('\n') a=self.base.Analysis.Analysis g=self.base.Analysis.geo e=self.base.Analysis.elementList for i in e: factor='' if self.base.Analysis.elementDict[i]=="TYPICAL": factor=" (" + str("%2f"% float(self.base.Analysis.Analysis[i].former_allw_factor)) + ")" print factor at=a[i].minimorum gt=g[i] f.write(' Element: ' + str(i) + ' --- ' + str(gt[0][0]) + ': ' + str(gt[0][1]) + '; ' + str(gt[0][2]) + '; ' + str(gt[0][3]) + ': ' + str(gt[0][4]) + ' and ' + str(gt[0][5])+'; ' + self.base.Analysis.elementDict[i]+factor+'\n') #+ str(self.base.Analyisis.geo[minimo][0][3]) + '\n') f.write( ' ' + poner_espacios(str(at[1][0]),10) + ' ' + poner_espacios('Mat. = ' + str(at[1][2]),15) + ' ' + poner_espacios('Proc. = ' + str(at[1][3]),15) + ' ' + poner_espacios('Rivet = ' + str(at[1][5]),21) + ' ' + poner_espacios('Allw. = ' + str("%.1f" % at[1][7]),18) + ' ' + poner_espacios('Lc = ' + str("%.1f" % at[0][2]),17) + ' ' + poner_espacios('LcId. = ' + str(at[0][0]),17) + ' ' + 'RF = ' + str(truncate(at[0][1],2)) +'\n') f.write('\n') f.write('\n') if self.chb3.GetValue(): f.write(' #### MINIMUM PER ELEMENT JOINT #### \n') f.write('\n') a=self.base.Analysis.Analysis g=self.base.Analysis.geo e=self.base.Analysis.elementList for i in e: factor='' if self.base.Analysis.elementDict[i]=="TYPICAL": factor=" (" + str("%2f"% float(self.base.Analysis.Analysis[i].former_allw_factor)) + ")" print factor gt=g[i] f.write(' Element: ' + str(i) + ' --- ' + str(gt[0][0]) + ': ' + str(gt[0][1]) + '; ' + str(gt[0][2]) + '; ' + str(gt[0][3]) + ': ' + str(gt[0][4]) + ' and ' + str(gt[0][5])+'; '+ factor + '\n') if a[i].Skin<>[]: atsk=a[i].minSkin atclsk=a[i].minClipSk minimo=[] if float(atsk[0][1])>float(atclsk[0][1]): minimo=[atclsk] elif float(atsk[0][1])==float(atclsk[0][1]): minimo=[atsk,atclsk] else: minimo=[atsk] for ii in minimo: f.write( ' ' + poner_espacios(str(ii[1][0]),10) + ' ' + poner_espacios('Mat. = ' + str(ii[1][2]),15) + ' ' + poner_espacios('Proc. = ' + str(ii[1][3]),15) + ' ' + poner_espacios('Rivet = ' + str(ii[1][5]),21) + ' ' + poner_espacios('Allw. = ' + str("%.1f" % ii[1][7]),18) + ' ' + poner_espacios('Lc = ' + str("%.1f" % ii[0][2]),17) + ' ' + poner_espacios('LcId. = ' + str(ii[0][0]),17) + ' ' + 'RF = ' + str(truncate(ii[0][1],2)) + '\n') if a[i].Former<>[]: atfr=a[i].minFormer atclfr=a[i].minClipFr minimo=[] if float(atfr[0][1])>float(atclfr[0][1]): minimo=[atclfr] elif float(atfr[0][1])==float(atclfr[0][1]): minimo=[atfr,atclfr] else: minimo=[atfr] for ii in minimo: f.write( ' ' + poner_espacios(str(ii[1][0]),10) + ' ' + poner_espacios('Mat. = ' + str(ii[1][2]),15) + ' ' + poner_espacios('Proc. = ' + str(ii[1][3]),15) + ' ' + poner_espacios('Rivet = ' + str(ii[1][5]),21) + ' ' + poner_espacios('Allw. = ' + str("%.1f" % ii[1][7]),18) + ' ' + poner_espacios('Lc = ' + str("%.1f" % ii[0][2]),17) + ' ' + poner_espacios('LcId. = ' + str(ii[0][0]),17) + ' ' + 'RF = ' + str(truncate(ii[0][1],2)) +'\n') f.write('\n') f.close self.Destroy()
def OnSelect(self, event): self.base.Freeze() if self.comboboxAnalysis.GetValue() == 'Geometry Importation': if self.tree: self.tree.Destroy() self.tree = wx.TreeCtrl(self, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS) root = self.tree.AddRoot('Import Geometry') NodosBranch = self.tree.AppendItem(root, 'Nodes') BarsBranch = self.tree.AppendItem(root, 'Bars') ShellsBranch = self.tree.AppendItem(root, 'Shells') #self.tree.setItemTextColour(wx.GREEN) self.tree.AppendItem(NodosBranch,str(len(list(set(self.Nodos.keys()))))+ ' Nodes taken into accout') self.tree.AppendItem(BarsBranch, str(len(list(set(self.Bars.keys()))))+' Bars taken into accout') self.tree.AppendItem(ShellsBranch, str(len(list(set(self.Shells.keys()))))+' Shells taken into accout') self.ssizer.Add(self.tree, 1, wx.EXPAND) self.SetSizer(self.ssizer) #self.comboboxAnalysis.SetValue('Import Geometry') self.ssizer.Fit(self) #self.base.panel.SetSizer(self.base.sizer) self.base.sizer.Fit(self) if self.base.IsMaximized(): self.base.Restore() self.base.Maximize() else: self.base.Maximize() self.base.Restore() elif self.comboboxAnalysis.GetValue() == 'Load Cases': if self.tree: self.tree.Destroy() self.tree = wx.TreeCtrl(self, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS) root = self.tree.AddRoot('Load Cases') for i in self.base.Analysis.elementList: r = self.tree.AppendItem(root, str(i)) for ii in self.base.Analysis.lcs[i]: self.tree.AppendItem(r,str('Lc: ' + ii[0] + ' -- ' + ii[1])) self.ssizer.Add(self.tree, 1, wx.EXPAND) self.SetSizer(self.ssizer) #self.comboboxAnalysis.SetValue('Import Geometry') self.ssizer.Fit(self) #self.base.panel.SetSizer(self.base.sizer) self.base.sizer.Fit(self) if self.base.IsMaximized(): self.base.Restore() self.base.Maximize() else: self.base.Maximize() self.base.Restore() elif self.comboboxAnalysis.GetValue() == 'Properties': if self.tree: self.tree.Destroy() self.tree = wx.TreeCtrl(self, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS) root = self.tree.AddRoot('Allowables') for i in self.base.Analysis.elementList: f=self.base.Analysis.Analysis[i] r = self.tree.AppendItem(root, str(i)) if self.base.Analysis.elementDict[i]<>"TYPICAL": self.tree.AppendItem(r,str(self.base.Analysis.elementDict[i])) else: self.tree.AppendItem(r,str(self.base.Analysis.elementDict[i]+" (" + str(self.base.Analysis.Analysis[i].former_allw_factor) + ")")) # for ii in self.base.Analysis.Analysis[i]: if f.Skin<>[]: for ii in f.Skin: rr= self.tree.AppendItem(r,str('Skin')) self.tree.AppendItem(rr,str('Thickness: '+ str(ii.thickness))) self.tree.AppendItem(rr,str('Material: '+str(ii.material))) self.tree.AppendItem(rr,str('Process: '+str(ii.process))) self.tree.AppendItem(rr,str('Rivet: '+str(ii.rivet))) self.tree.AppendItem(rr,str('Numb. of rivets: '+str(int(ii.nrivet)))) self.tree.AppendItem(rr,str('Unit. Allowable: '+str(ii.allow))) self.tree.AppendItem(rr,str('Allowable: '+ str(float(ii.allow) * float(ii.nrivet)))) if f.ClipSk<>[]: for ii in f.ClipSk: rr= self.tree.AppendItem(r,str('ClipSk')) self.tree.AppendItem(rr,str('Thickness: '+ str(ii.thickness))) self.tree.AppendItem(rr,str('Material: '+str(ii.material))) self.tree.AppendItem(rr,str('Process: '+str(ii.process))) self.tree.AppendItem(rr,str('Rivet: '+str(ii.rivet))) self.tree.AppendItem(rr,str('Numb. of rivets: '+str(int(ii.nrivet)))) self.tree.AppendItem(rr,str('Unit. Allowable: '+str(ii.allow))) self.tree.AppendItem(rr,str('Allowable: '+ str(float(ii.allow) * float(ii.nrivet)))) if f.ClipFr<>[]: for ii in f.ClipFr: rr= self.tree.AppendItem(r,str('ClipFr')) self.tree.AppendItem(rr,str('Thickness: '+ str(ii.thickness))) self.tree.AppendItem(rr,str('Material: '+str(ii.material))) self.tree.AppendItem(rr,str('Process: '+str(ii.process))) self.tree.AppendItem(rr,str('Rivet: '+str(ii.rivet))) self.tree.AppendItem(rr,str('Numb. of rivets: '+str(int(ii.nrivet)))) self.tree.AppendItem(rr,str('Unit. Allowable: '+str(ii.allow))) if self.base.Analysis.elementDict[i]<>"TYPICAL": self.tree.AppendItem(rr,str('Allowable: '+ str(float(ii.allow) * float(ii.nrivet)))) else: self.tree.AppendItem(rr,str('Allowable: '+ str("%.2f"%(float(ii.allow) /self.base.Analysis.Analysis[i].former_allw_factor)))) if f.Former<>[]: for ii in f.Former: rr= self.tree.AppendItem(r,str('Former')) self.tree.AppendItem(rr,str('Thickness: '+ str(ii.thickness))) self.tree.AppendItem(rr,str('Material: '+str(ii.material))) self.tree.AppendItem(rr,str('Process: '+str(ii.process))) self.tree.AppendItem(rr,str('Rivet: '+str(ii.rivet))) self.tree.AppendItem(rr,str('Numb. of rivets: '+str(int(ii.nrivet)))) self.tree.AppendItem(rr,str('Unit. Allowable: '+str(ii.allow))) if self.base.Analysis.elementDict[i]<>"TYPICAL": self.tree.AppendItem(rr,str('Allowable: '+ str(float(ii.allow) * float(ii.nrivet)))) else: self.tree.AppendItem(rr,str('Allowable: '+ str("%.2f"%(float(ii.allow) / self.base.Analysis.Analysis[i].former_allw_factor)))) self.ssizer.Add(self.tree, 1, wx.EXPAND) self.SetSizer(self.ssizer) #self.comboboxAnalysis.SetValue('Import Geometry') self.ssizer.Fit(self) #self.base.panel.SetSizer(self.base.sizer) self.base.sizer.Fit(self) if self.base.IsMaximized(): self.base.Restore() self.base.Maximize() else: self.base.Maximize() self.base.Restore() elif self.comboboxAnalysis.GetValue() == 'Results': if self.tree: self.tree.Destroy() self.tree = wx.TreeCtrl(self, 1, wx.DefaultPosition, (-1,-1), wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS) root = self.tree.AddRoot('Allowables') for i in self.base.Analysis.elementList: f=self.base.Analysis.Analysis[i] r = self.tree.AppendItem(root, str(i)) # for ii in self.base.Analysis.Analysis[i]: if f.Skin<>[]: rr= self.tree.AppendItem(r,str('Skin')) self.tree.AppendItem(rr,str('RF: '+ str(truncate(f.minSkin[0][1],2)))) self.tree.AppendItem(rr,str('Load Case Id.: '+ str(f.minSkin[0][0]))) self.tree.AppendItem(rr,str('Load Case Val.: '+ str(f.minSkin[0][2]))) if f.ClipSk<>[]: rr= self.tree.AppendItem(r,str('ClipSk')) self.tree.AppendItem(rr,str('RF: '+ str(truncate(f.minClipSk[0][1],2)))) self.tree.AppendItem(rr,str('Load Case Id.: '+ str(f.minClipSk[0][0]))) self.tree.AppendItem(rr,str('Load Case Val.: '+ str(f.minClipSk[0][2]))) if f.ClipFr<>[]: rr= self.tree.AppendItem(r,str('ClipFr')) self.tree.AppendItem(rr,str('RF: '+ str(truncate(f.minClipFr[0][1],2)))) self.tree.AppendItem(rr,str('Load Case Id.: '+ str(f.minClipFr[0][0]))) self.tree.AppendItem(rr,str('Load Case Val.: '+ str(f.minClipFr[0][2]))) if f.Former<>[]: rr= self.tree.AppendItem(r,str('Former')) self.tree.AppendItem(rr,str('RF: '+ str(truncate(f.minFormer[0][1],2)))) self.tree.AppendItem(rr,str('Load Case Id.: '+ str(f.minFormer[0][0]))) self.tree.AppendItem(rr,str('Load Case Val.: '+ str(f.minFormer[0][2]))) self.ssizer.Add(self.tree, 1, wx.EXPAND) self.SetSizer(self.ssizer) #self.comboboxAnalysis.SetValue('Import Geometry') self.ssizer.Fit(self) #self.base.panel.SetSizer(self.base.sizer) self.base.sizer.Fit(self) if self.base.IsMaximized(): self.base.Restore() self.base.Maximize() else: self.base.Maximize() self.base.Restore() else: if self.tree: self.tree.Destroy() self.base.Thaw()