コード例 #1
0
ファイル: ConcreteBeam.py プロジェクト: luisggc/FConcrete
    def plotTransversalInX(self, x, **options):
        """
            Plot an image of the transversal section with the longitudinal and transversal steel.

                Call signatures:

                    concrete_beam.plotTransversalInX.getSteelArea(x)
                    
            Returns
            -------
            fig
                Figure generated by matplotlib.
                
            ax
                Axis generated by matplotlib.
                
        """
        positive_bars, negative_bars = self.long_steel_bars.getPositiveandNegativeLongSteelBarsInX(
            x=x)
        transversal_bar = self.transv_steel_bars.getTransversalBarAfterX(x)

        _, beam_element = self.getBeamElementInX(x)
        material, section = beam_element.material, beam_element.section

        ax, _ = section.plot()
        ax, _ = transversal_bar.plot(ax=ax, c=material.c)
        ax, _ = positive_bars.plotTransversal(self, x, ax=ax)
        ax, _ = negative_bars.plotTransversal(self, x, ax=ax)
        return make_dxf(ax, **options)
コード例 #2
0
ファイル: ConcreteBeam.py プロジェクト: luisggc/FConcrete
 def plotConcreteDisplacementDiagram(self, **options):
     """
         Apply concrete_beam.getConcreteDisplacementDiagram for options["division"] parts of the beam.
         
         Parameters
         ----------
         **options
             
             ``division``:
                 Number of divisions equally spaced (`int`).
             ``x_begin``:
                 Begin of the x_axis (`number`).
             ``x_end``:
                 End of the x_axis (`number`).
             
         Returns
         -------
         x : list of number
             The x position of the division in cm
         
         y : list of number
             The value of displacement for each x.
     """
     options["division"] = options["division"] if options.get(
         "division") else self.division
     x, y = self.getConcreteDisplacementDiagram(**options)
     _, ax = plt.subplots()
     ax.plot(x, y)
     return make_dxf(ax, **options)
コード例 #3
0
ファイル: TransvSteelBar.py プロジェクト: luisggc/FConcrete
 def plotLong(self, **options):
     """
         Plot the longitudinal vision of the transversal bar.
     """
     _, ax = plt.subplots()
     for x, height in zip(self.x, self.heights):
         ax.plot([x, x], [0, height])
     return make_dxf(ax, **options)
コード例 #4
0
    def plotDecalagedMomentumDesignDiagram(self, ax=None, fig=None, **options):
        """
            Plot DecalagedMomentumDesignDiagram.
        """
        fig, ax = getAxis() if ax == None else (fig, ax)
        ax.set_aspect("auto")

        x, momentum_positive, momentum_negative = self.getDecalagedMomentumDesignDiagram(
            **options)
        ax.plot(x, momentum_positive)
        ax.plot(x, momentum_negative)
        plt.gca().invert_yaxis()
        return make_dxf(ax, **options)
コード例 #5
0
ファイル: TransvSteelBar.py プロジェクト: luisggc/FConcrete
    def plot(self, c=2, ax=None, fig=None, color_plot="blue", **options):
        """
            Plot the transversal vision of the transversal bar.
        """
        height, width, diameter = self.height, self.width, self.diameter
        x0, y0 = -width / 2, c

        fig, ax = getAxis((x0, diameter),
                          (x0 + diameter + width - diameter,
                           c + height)) if ax == None else (fig, ax)

        left_bar = plt.Rectangle((x0, y0),
                                 diameter,
                                 height,
                                 hatch="/",
                                 fill=False)
        right_bar = plt.Rectangle((width / 2 - diameter, y0),
                                  diameter,
                                  height,
                                  hatch="/",
                                  fill=False)
        top_bar = plt.Rectangle((x0 + diameter, y0 + height - diameter),
                                width - 2 * diameter,
                                diameter,
                                hatch="/",
                                fill=False)
        bottom_bar = plt.Rectangle((x0 + diameter, y0),
                                   width - 2 * diameter,
                                   diameter,
                                   hatch="/",
                                   fill=False)
        anchor = plt.Rectangle(
            (width / 2 + diameter / 2, y0 + height - diameter / 2),
            diameter,
            self.anchor,
            hatch="|",
            fill=False,
            angle=135)  #anchor

        ax.add_artist(left_bar)
        ax.add_artist(right_bar)
        ax.add_artist(top_bar)
        ax.add_artist(bottom_bar)
        ax.add_artist(anchor)

        return make_dxf(ax, **options)  # if return_ax else None
コード例 #6
0
    def plotTransversal(self,
                        concrete_beam,
                        x,
                        ax=None,
                        fig=None,
                        color_plot="red",
                        **options):
        """
            Plot the transversal vision of the longitudinal bars.
        """
        fig, ax = getAxis((-20, 0), (20, 50)) if ax == None else (fig, ax)

        for long_bar in self.getBarTransversalPosition(concrete_beam, x):
            circle = plt.Circle((long_bar[0], long_bar[1]), long_bar[2])
            ax.add_artist(circle)

        return make_dxf(ax, **options)  # if return_ax else None
コード例 #7
0
ファイル: Beam.py プロジェクト: luisggc/FConcrete
    def plot(self, column_height=30, beam_color="b", **options):
        _, ax = getAxis()

        first_beam_element = self.beam_elements[0]
        last_beam_element = self.beam_elements[-1]
        ax.plot([first_beam_element.n1.x, first_beam_element.n1.x], [
            first_beam_element.section.y0,
            first_beam_element.section.y0 + first_beam_element.section.height
        ],
                color=beam_color)
        ax.plot([last_beam_element.n2.x, last_beam_element.n2.x], [
            last_beam_element.section.y0,
            last_beam_element.section.y0 + last_beam_element.section.height
        ],
                color=beam_color)

        # print beam
        for beam_number, beam_element in enumerate(self.beam_elements):
            positions = [beam_element.n1.x, beam_element.n2.x]
            ax.plot(positions,
                    np.repeat(beam_element.section.y0, 2),
                    color=beam_color)
            ax.plot(positions,
                    np.repeat(
                        beam_element.section.y0 + beam_element.section.height,
                        2),
                    color=beam_color)
            if beam_number + 1 != len(self.beam_elements):
                ax.plot([beam_element.n2.x, beam_element.n2.x], [
                    beam_element.section.y0 + beam_element.section.height,
                    self.beam_elements[beam_number + 1].section.y0 +
                    self.beam_elements[beam_number + 1].section.height
                ],
                        color=beam_color)

        # print column
        for node in self.initial_beam_elements.nodes:
            if node.length != 0:
                ax.plot((node.x - node.length / 2, node.x - node.length / 2),
                        (0, -column_height),
                        color=beam_color)
                ax.plot((node.x + node.length / 2, node.x + node.length / 2),
                        (0, -column_height),
                        color=beam_color)

        return make_dxf(ax, **options)
コード例 #8
0
ファイル: Section.py プロジェクト: luisggc/FConcrete
    def plot(self, N=100, color_plot="red", ax=None, fig=None, **options):
        """
            Plot the section.
        """
        height = self.height

        fig, ax = getAxis() if ax == None else (fig, ax)
        y = np.linspace(0, height, N)
        x = np.array([self.function_width(xi) for xi in y])

        x_base = np.linspace(-x[0], x[0], 100)
        x_top = np.linspace(-x[-1], x[-1], 100)

        ax.plot(x, y, color=color_plot)  # plot right simetry
        ax.plot(2 * y[0] - x, y, color=color_plot)  # plot left simetry
        ax.plot(x_base, np.zeros(len(y)), color=color_plot)  # plot base
        ax.plot(x_top, height * np.ones(len(y)), color=color_plot)  # plot top

        return make_dxf(ax, **options)
コード例 #9
0
ファイル: Beam.py プロジェクト: luisggc/FConcrete
 def plotRotationDiagram(self, **options):
     """
         Simply applies the beam.getRotationDiagram method results (x,y) to a plot with plt.plot(x, y).
     
         Parameters
         ----------
         **options
             
             ``division``:
                 Number of divisions equally spaced (`int`).
             ``x_begin``:
                 Begin of the x_axis (`number`).
             ``x_end``:
                 End of the x_axis (`number`).
             
     """
     x, y = self.getRotationDiagram(**options)
     _, ax = plt.subplots()
     ax.plot(x, y)
     return make_dxf(ax, **options)
コード例 #10
0
    def plot(self, prop='area_accumulated', **options):
        """
            Plot the lonfitudinal vision of the longitudinal bars.
        """
        _, ax = getAxis()
        ax.set_aspect("auto")

        if prop == 'area_accumulated':
            plt.gca().invert_yaxis()

        #xs, ys = [], []
        for steelbar in self.steel_bars:
            x, y = steelbar.getPlotInfo(prop)
            ax.plot(x, y)
            #xs, ys = [*xs, x[np.invert(np.nan(x))]], [*ys, y[np.invert(np.nan(y))]]

        #min_y = min(ys)
        #for x, y in zip(xs, ys):
        #    min_y += space_between_bars
        #    ax.plot(x, min_y)

        return make_dxf(ax, **options)
コード例 #11
0
ファイル: Beam.py プロジェクト: luisggc/FConcrete
 def plotMomentumDiagram(self, **options):
     """
         Simply applies the beam.getMomentumDiagram method results (x,y) to a plot with plt.plot(x, y).\n
         Also invert y axis.
         
         Parameters
         ----------
         **options
             
             ``division``:
                 Number of divisions equally spaced (`int`).
             ``x_begin``:
                 Begin of the x_axis (`number`).
             ``x_end``:
                 End of the x_axis (`number`).
             
     """
     _, ax = plt.subplots()
     x, y = self.getMomentumDiagram(**options)
     plt.gca().invert_yaxis()
     ax.plot(x, y)
     return make_dxf(ax, **options)