def btn_addMultiPropOnButtonClick( self, event ): # 默认第一个是放进Outer的,后面来的就放在inner里 if len(self.MP.outerLoop) == 0 : _args = self.point_list self.MP.setOuterLoop(*_args) else: _args = self.point_list self.MP.addInnerLoop(*_args) # procedure -- remove all items of list,as well as the data of point list self.m_listBox2.Clear() self.point_list = [] Path = DrawGeometry(self.MP) Path.Draw() self.plotpanel.clear() for i in Path._paths: m,n=zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open') for i in Path._dimen: m, n = zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open', linewidth=1, color='green') # 遍历字典,画上标注 for key, value in Path._text.items(): x = key[0] y = key[1] self.plotpanel.add_text(str(value), x, y, size=4)
def btn_genCompOnButtonClick( self, event ): # 如果有2个复连通的话就把他们同时画出来。然后直接计算,边上再添加一个数据清空的btn self.ShowResult(self.Comp) Comp_Path = DrawGeometry(self.Comp) Comp_Path.Draw() self.plotpanel.clear() for i in Comp_Path._paths: m,n=zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open') for i in Comp_Path._dimen: m, n = zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open', linewidth=1, color='green') # 遍历字典,画上标注 for key, value in Comp_Path._text.items(): x = key[0] y = key[1] self.plotpanel.add_text(str(value), x, y, size=4)
def showItemOnDClick( self, event ): print 'double _click' n = self.m_listBox3.GetSelection() multisection = self.Comp.dataResource[n] self.ShowResult(multisection) Path = DrawGeometry(multisection) Path.Draw() self.plotpanel.clear() for i in Path._paths: m,n=zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open') for i in Path._dimen: m, n = zip(*i) self.plotpanel.oplot(m,n,fullbox=False,axes_style='open', linewidth=1, color='green') # 遍历字典,画上标注 for key, value in Path._text.items(): x = key[0] y = key[1] self.plotpanel.add_text(str(value), x, y, size=4)
from DrawSection import DrawGeometry from wxmplot import PlotApp if __name__ == "__main__": Tsec = NshapeSection(30,12,20,80,5,5,5) geo = GeoCalculator(Tsec) geo.Solve() print geo.Area() p = geo.Centroid() alfa = geo.tan_alfa() print p print "a=" + str(alfa) app = PlotApp() Path = DrawGeometry(Tsec) Path.Draw() #newIsec = Isec.moveCoor(-p[0], -p[1]) #origin = Point(0,0) #newIsec = Isec.rotate(pi/4, p) #newIsec = Isec.transform(-p[0],-p[1],-alfa, origin) #geo1 = GeoCalculator(newIsec) #geo1.Solve() #print geo1.Area() #print geo1.Centroid() for i in Path._paths: m,n=zip(*i) app.oplot(m,n,title='Example PlotApp', label='a',
def m_btn_calculationOnButtonClick(self, event): # µã»÷btnÖ®ºó£¬»ñµÃ´«ÈëµÄ²ÎÊý¡£ # ͨ¹ý»ñµÃµÄ²ÎÊýÉú³É³ö½ØÃæ¶ÔÏó¡£ # ͨ¹ý½ØÃæ¼ÆË㣬µÃµ½¼¸ºÎÊýÖµ # ͨ¹ýDraw¶ÔÏó»Í¼£¬»³ö¼¸ºÎͼÏñ¡£ _args = list() for num in range(len(self.grid_value[self._section_type])): _args.append(float(self.m_grid_params_defs.GetCellValue(num, 1))) sectionType = self._section_type if sectionType == u"¹¤×Ö¸Ö": section = ISection(*_args) elif sectionType == u"Ö±½Ç¸Ö": section = rightAngleSection(*_args) elif sectionType == u"²Û¸Ö": section = grooveSection(*_args) #elif sectionType == u"CÐ͸Ö": #pass elif sectionType == u"TÐ͸Ö": section = TshapeSection(*_args) elif sectionType == u"JÐ͸Ö": section = JshapeSection(*_args) elif sectionType == u"ñÐ͸Ö": section = NshapeSection(*_args) geo = GeoCalculator(section) geo.Solve() self._args = geo._args if "Area" in self._args: if self._args['Area'] < 0.0000001: res = 0 else: res = self._args['Area'] self.m_propertyGridItem2.SetValue(str(res)) if "Sx" in self._args: if self._args['Sx'] < 0.0000001: res = 0 else: res = self._args['Sx'] self.m_propertyGridItem3.SetValue(str(res)) if "Sy" in self._args: if self._args['Sy'] < 0.0000001: res = 0 else: res = self._args['Sy'] self.m_propertyGridItem42.SetValue(str(res)) if "Ix" in self._args: if self._args['Ix'] < 0.0000001: res = 0 else: res = self._args['Ix'] self.m_propertyGridItem4.SetValue(str(res)) if "Iy" in self._args: if self._args['Iy'] < 0.0000001: res = 0 else: res = self._args['Iy'] self.m_propertyGridItem5.SetValue(str(res)) if "Ixy" in self._args: if self._args['Ixy'] < 0.0000001: res = 0 else: res = self._args['Ixy'] self.m_propertyGridItem7.SetValue(str(res)) if "centroid" in self._args: res = self._args['centroid'] if res[0] < 0.0000001: res = [0, res[1]] if res[1] < 0.0000001: res = [res[0], 0] self.m_propertyGridItem8.SetValue(str(res)) if "tan_alfa" in self._args: if self._args['tan_alfa'] < 0.0000001: res = 0 else: res = self._args['tan_alfa'] self.m_propertyGridItem9.SetValue(str(res)) if "ix" in self._args: if self._args['ix'] < 0.0000001: res = 0 else: res = self._args['ix'] self.m_propertyGridItem61.SetValue(str(res)) if "iy" in self._args: if self._args['iy'] < 0.0000001: res = 0 else: res = self._args['iy'] self.m_propertyGridItem62.SetValue(str(res)) Path = DrawGeometry(section) Path.Draw() self.plotpanel.clear() for i in Path._paths: m, n = zip(*i) self.plotpanel.oplot(m, n, fullbox=False, axes_style='open') for i in Path._dimen: m, n = zip(*i) self.plotpanel.oplot(m, n, fullbox=False, axes_style='open', linewidth=1, color='green') # ±éÀú×ֵ䣬»Éϱê×¢ for key, value in Path._text.items(): x = key[0] y = key[1] self.plotpanel.add_text(str(value), x, y, size=4)