def plot(self): #画两端结点 x=[self.a1,self.a2] y=[self.b1,self.b2] plt.scatter(x,y,c='w',marker='o', s=60,edgecolors=self.pc,linewidths=self.c1*self.l, zorder=100)#s是点大小 #画杆 plt.plot(x,y,c=self.tc,linewidth=self.c2*self.l,zorder=1) #画支座 sp1=Support.Support(self.sx1,self.sy1,self.a1,self.b1,self.l,self.sc) sp1.display() sp2=Support.Support(self.sx2,self.sy2,self.a2,self.b2,self.l,self.sc) sp2.display() plt.tight_layout()
def DisplaySupportType(): """ Purpose: List all Support type for products. Argument(s): None Return: list of Suppport types. """ #SUPPORT MODULE FOR THE SUPPORT CLASS ( TABLE ) #---------------------------------------------- import Support #SUPPORT OBJECT #-------------- NewSupport = Support.Support() Supports = NewSupport.getAllSupport() count = 1 if (len(Supports) != 0): print "No. REFERENCE NO. START DATE END DATE SUPPORT LEVEL" print "--- ------------- ---------- -------- -------------" for support in Supports: print "{0} {1:15} {2:15} {3:15} {4}".format( count, support[1], support[2], support[3], support[4]) count = count + 1
def plot(self): #画两端结点 x = [self.a1, self.a2] y = [self.b1, self.b2] plt.scatter(x, y, c='w', marker='o', s=self.c8 * self.l, edgecolors=self.pc, linewidths=self.c7 * self.l, zorder=100) #s是点大小 #画杆 plt.plot(x, y, c=self.tc, linewidth=self.c6 * self.l, zorder=1) #画支座 sp1 = Support.Support(self.sx1, self.sy1, self.a1, self.b1, self.l, self.sc) sp1.display() sp2 = Support.Support(self.sx2, self.sy2, self.a2, self.b2, self.l, self.sc) sp2.display() #画力 pass #标数据 l1 = np.array([self.a1, self.b1]) l2 = np.array([self.a2, self.b2]) #计算角度 if self.a1 == self.a2: if self.b1 > self.b2: angle = -90 else: angle = 90 else: angle = math.atan((self.b2 - self.b1) / (self.a2 - self.a1)) / (2 * math.pi) * 360 plt.text((l1[0] + l2[0]) / 2, (l1[1] + l2[1]) / 2, str(self.result), fontsize=self.c5 * self.l, rotation=angle, rotation_mode='anchor', zorder=1000) #画外力 f1 = Force.Force(self.a1, self.b1, self.fx1, self.fy1, self.l, self.ax) f1.ForcePlot() f2 = Force.Force(self.a2, self.b2, self.fx2, self.fy2, self.l, self.ax) f2.ForcePlot()
def on_support_clicked(self, widget): sup = Support.Support(self) response = sup.run() if response == Gtk.ResponseType.DELETE_EVENT: sup.destroy()
def PlotSupport(self): support = Support.Support(self.x, self.y, self.support_x, self.support_y, self.size) support.Plot()