예제 #1
0
    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
예제 #2
0
    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