(self, plot_file=None, save_fig=False)
return figure
Method to plot an stl file. If `plot_file` is not given it plots
        `self.infile`.

        :param string plot_file: the stl filename you want to plot.
        :param bool save_fig: a flag to save the figure in png or not. If True
            the plot is not shown. The default value is False.
            
        :return: figure: matlplotlib structure for the figure of the chosen
            geometry
        :rtype: matplotlib.pyplot.figure
Method to plot an stl file. If `plot_file` is not given it plots
        `self.infile`.
Method to plot an stl file . If plot_file is not given it plots self . infile .
def plot(self, plot_file=None, save_fig=False):
        """
        Method to plot an stl file. If `plot_file` is not given it plots
        `self.infile`.

        :param string plot_file: the stl filename you want to plot.
        :param bool save_fig: a flag to save the figure in png or not. If True
            the plot is not shown. The default value is False.
            
        :return: figure: matlplotlib structure for the figure of the chosen
            geometry
        :rtype: matplotlib.pyplot.figure
        """
        if plot_file is None:
            plot_file = self.infile
        else:
            self._check_filename_type(plot_file)

        # Read the source file.
        reader = vtk.vtkSTLReader()
        reader.SetFileName(plot_file)
        reader.Update()

        data = reader.GetOutput()
        points = data.GetPoints()
        ncells = data.GetNumberOfCells()

        # for each cell it contains the indeces of the points that define the cell
        figure = plt.figure()
        axes = a3.Axes3D(figure)
        vtx = np.zeros((ncells, 3, 3))
        for i in range(0, ncells):
            for j in range(0, 3):
                cell = data.GetCell(i).GetPointId(j)
                vtx[i][j][0], vtx[i][j][1], vtx[i][j][2] = points.GetPoint(
                    int(cell))
            tri = a3.art3d.Poly3DCollection([vtx[i]])
            tri.set_color('b')
            tri.set_edgecolor('k')
            axes.add_collection3d(tri)

        ## Get the limits of the axis and center the geometry
        max_dim = np.array(
            [np.max(vtx[:, :, 0]),
             np.max(vtx[:, :, 1]),
             np.max(vtx[:, :, 2])])
        min_dim = np.array(
            [np.min(vtx[:, :, 0]),
             np.min(vtx[:, :, 1]),
             np.min(vtx[:, :, 2])])

        max_lenght = np.max(max_dim - min_dim)
        axes.set_xlim(-.6 * max_lenght + (max_dim[0] + min_dim[0]) / 2,
                      .6 * max_lenght + (max_dim[0] + min_dim[0]) / 2)
        axes.set_ylim(-.6 * max_lenght + (max_dim[1] + min_dim[1]) / 2,
                      .6 * max_lenght + (max_dim[1] + min_dim[1]) / 2)
        axes.set_zlim(-.6 * max_lenght + (max_dim[2] + min_dim[2]) / 2,
                      .6 * max_lenght + (max_dim[2] + min_dim[2]) / 2)

        # Show the plot to the screen
        if not save_fig:
            plt.show()
        else:
            figure.savefig(plot_file.split('.')[0] + '.png')

        return figure
def plot ( self , plot_file = None , save_fig = False ) : if plot_file is None : plot_file = self . infile else : self . _check_filename_type ( plot_file ) # Read the source file. reader = vtk . vtkSTLReader ( ) reader . SetFileName ( plot_file ) reader . Update ( ) data = reader . GetOutput ( ) points = data . GetPoints ( ) ncells = data . GetNumberOfCells ( ) # for each cell it contains the indeces of the points that define the cell figure = plt . figure ( ) axes = a3 . Axes3D ( figure ) vtx = np . zeros ( ( ncells , 3 , 3 ) ) for i in range ( 0 , ncells ) : for j in range ( 0 , 3 ) : cell = data . GetCell ( i ) . GetPointId ( j ) vtx [ i ] [ j ] [ 0 ] , vtx [ i ] [ j ] [ 1 ] , vtx [ i ] [ j ] [ 2 ] = points . GetPoint ( int ( cell ) ) tri = a3 . art3d . Poly3DCollection ( [ vtx [ i ] ] ) tri . set_color ( 'b' ) tri . set_edgecolor ( 'k' ) axes . add_collection3d ( tri ) ## Get the limits of the axis and center the geometry max_dim = np . array ( [ np . max ( vtx [ : , : , 0 ] ) , np . max ( vtx [ : , : , 1 ] ) , np . max ( vtx [ : , : , 2 ] ) ] ) min_dim = np . array ( [ np . min ( vtx [ : , : , 0 ] ) , np . min ( vtx [ : , : , 1 ] ) , np . min ( vtx [ : , : , 2 ] ) ] ) max_lenght = np . max ( max_dim - min_dim ) axes . set_xlim ( - .6 * max_lenght + ( max_dim [ 0 ] + min_dim [ 0 ] ) / 2 , .6 * max_lenght + ( max_dim [ 0 ] + min_dim [ 0 ] ) / 2 ) axes . set_ylim ( - .6 * max_lenght + ( max_dim [ 1 ] + min_dim [ 1 ] ) / 2 , .6 * max_lenght + ( max_dim [ 1 ] + min_dim [ 1 ] ) / 2 ) axes . set_zlim ( - .6 * max_lenght + ( max_dim [ 2 ] + min_dim [ 2 ] ) / 2 , .6 * max_lenght + ( max_dim [ 2 ] + min_dim [ 2 ] ) / 2 ) # Show the plot to the screen if not save_fig : plt . show ( ) else : figure . savefig ( plot_file . split ( '.' ) [ 0 ] + '.png' ) return figure