def __init__(self): ACStructural.__init__(self) UnitList = self.UnitList NoneList = self.NoneList # Strut parameters self.NoneList['StrutL'] = None UnitList['StrutL'] = Length self.__dict__['StrutW'] = 1 * IN UnitList['StrutW'] = Length self.__dict__['StrutH'] = 1 * IN UnitList['StrutH'] = Length self.__dict__['Theta'] = 0 * ARCDEG UnitList['Theta'] = Angle self.NoneList['GearHeight'] = None UnitList['GearHeight'] = Length # Wheel parameters self.__dict__['WheelDiam'] = 1 * IN UnitList['WheelDiam'] = Length self.__dict__['WheelThickness'] = 0.1 * IN UnitList['WheelThickness'] = Length # Internal variables self.__dict__['Strut'] = ACMassBox() self.Strut.Weight = 1e-5 * LBF self.Strut.name = 'Strut' self.__dict__['Wheel'] = ACMassCyl() self.Wheel.Weight = 1e-5 * LBF self.Wheel.name = 'Wheel'
def _DrawSide(self, Drawing): """ Draws a side view of the component. """ ACStructural._DrawSide(self, Drawing) # # Do any additional drawing for a side view here # This is called from ACComponent # Axial, Radial1, Radial2 = self._XYZOrient() if abs(Axial[1]) > 0.: xi, eta, zeta = self.Xat[0], self.Xat[1], self.Xat[2] # # Remember X is [Unum, Unum, Unum] # L = self.LenDi[0] D = self.LenDi[1] / IN R = D / 2 X = (self.GetX() - Axial * L * xi) / IN Axial *= L / IN Radial1 *= R Radial2 *= R # # Get the current axis so the ellipse patch can be added to it # FrontAxis = pyl.gca() # # Create the ellipse # x = X[0] z = X[2] W = D # Fix later H = D # Fix later el1 = Ellipse((x, z), W, H, 0.0, fill=False, edgecolor=Drawing.color) el2 = Ellipse((x + Axial[0], z + Axial[2]), W, H, 0.0, fill=False, edgecolor=Drawing.color) # # Add it to the axis # FrontAxis.add_patch(el1) FrontAxis.add_patch(el2)
def __init__(self): ACStructural.__init__(self) UnitList = self.UnitList self.__dict__['LenDi'] = [1 * IN, 1 * IN] ; UnitList['LenDi'] = Length self.__dict__['Axis'] = [1, 0, 0] ; UnitList['Axis'] = Unitless self.__dict__['Xat'] = [0, 0.5, 0] ; UnitList['Xat'] = Unitless self.__dict__['Color'] = 'b' # # This is new, it is a dictionary of drawings # You create what should be drawn and fill it's arrays instead # self.Drawings.Side1 = ACComponent.ComponentDrawing() self.Drawings.Side2 = ACComponent.ComponentDrawing()
def Refresh(self): """ Update drawing array Virtual function used to recompute attributes All derived instances of this methods must set self.param.refreshing = True at the beginning of the method and self.param.refreshing = False when completed. Otherwise an infinite loop will be created!!! """ ACStructural.Refresh(self) self.param.refreshing = True # # Perform all calculations # Drawings = self.Drawings.__dict__ length, width, height = self._XYZOrient() length *= self.LWH[0] / IN width *= self.LWH[1] / IN height *= self.LWH[2] / IN X = self.GetX() / IN xi, eta, zeta = self.Xat[0], self.Xat[1], self.Xat[2] class Rectangle: def __init__(self, length, height, origin): self.NodesX = npy.array([ 0, length[0], length[0] + height[0], height[0], 0 ]) + origin[0] self.NodesY = npy.array([ 0, length[1], length[1] + height[1], height[1], 0 ]) + origin[1] self.NodesZ = npy.array([ 0, length[2], length[2] + height[2], height[2], 0 ]) + origin[2] origin = X - length * xi - width * eta - height * zeta Sides = {} Sides['Front'] = Rectangle(width, height, origin) Sides['Back'] = Rectangle(width, height, origin + length) Sides['Top'] = Rectangle(length, width, origin + height) Sides['Bottom'] = Rectangle(length, width, origin) Sides['Left'] = Rectangle(length, height, origin) Sides['Right'] = Rectangle(length, height, origin + width) for key, rec in Sides.iteritems(): Drawings[key].yf = rec.NodesY Drawings[key].zf = rec.NodesZ Drawings[key].xs = rec.NodesX Drawings[key].zs = rec.NodesZ Drawings[key].xt = rec.NodesX Drawings[key].yt = rec.NodesY Drawings[key].color = self.Color self.param.refreshing = False
def __init__(self): ACStructural.__init__(self) UnitList = self.UnitList self.__dict__['LWH'] = [1 * IN, 1 * IN, 1 * IN]; UnitList['Dim'] = Length self.__dict__['Axis'] = [1, 0, 0] ; UnitList['Axis'] = Unitless self.__dict__['Xat'] = [0, 0.5, 0] ; UnitList['Xat'] = Unitless self.__dict__['Color'] = 'b' # # Setup the drawings for each face of the mass box # self.Drawings.Front = ACComponent.ComponentDrawing() self.Drawings.Back = ACComponent.ComponentDrawing() self.Drawings.Top = ACComponent.ComponentDrawing() self.Drawings.Bottom = ACComponent.ComponentDrawing() self.Drawings.Left = ACComponent.ComponentDrawing() self.Drawings.Right = ACComponent.ComponentDrawing()
def Draw(self, fig=1, top=221, side=222, front=223): """ Draws this lifting surface and it's control surfaces Inputs: fig - Integer number of figure to draw into top - Subplot for top view side - Subplot for side view front - Subplot for front view """ ACStructural.Draw(self, fig, top, side, front) self.Wheel.Draw(fig, top, side, front) self.Strut.Draw(fig, top, side, front)
def Refresh(self): """ Update drawing array Virtual function used to recompute attributes All derived instances of this methods must set self.param.refreshing = True at the beginning of the method and self.param.refreshing = False when completed. Otherwise an infinite loop will be created!!! """ ACStructural.Refresh(self) self.param.refreshing = True self._CheckConsistent() Strut = self.Strut Wheel = self.Wheel Theta = self.Theta / RAD # # Calculate strut parameteres # StrutAxis = npy.array([0, sin(Theta), -cos(Theta)]) StrutVect = StrutAxis * self.StrutL # # Set the strut parameters # Position the height such that the wheel sits on the ground # Strut.Axis = StrutAxis Strut.LWH = [self.StrutL, self.StrutW, self.StrutH] Strut.X = self.X # # Position the wheel # WheelHub = npy.array([0 * IN, self.StrutH, 0 * IN]) Wheel.X = npy.array(Strut.X) + StrutVect + WheelHub Wheel.Axis = [0, 1, 0] Wheel.LenDi = [self.WheelThickness, self.WheelDiam] # # Make the wheel and strut symmetric if desired # Strut.Symmetric = self.Symmetric Wheel.Symmetric = self.Symmetric self.param.refreshing = False