orbingol / NURBS-Python

Object-oriented pure Python B-Spline and NURBS library
https://onurraufbingol.com/NURBS-Python/
MIT License
603 stars 153 forks source link

VisPlotly not return the figure object #167

Open chenboshuo opened 11 months ago

chenboshuo commented 11 months ago

Describe the bug Look at the soource code

https://github.com/orbingol/NURBS-Python/blob/8ae8b127eb0b130a25a6c81e98e90f319733bca0/geomdl/visualization/VisPlotly.py#L485-L494

How to get the fig

When I use

help(surf.render)

I get the content

Help on method render in module geomdl.abstract:

render(**kwargs) method of geomdl.BSpline.Surface instance
    Renders the surface using the visualization component.

    The visualization component must be set using :py:attr:`~vis` property before calling this method.

    Keyword Arguments:
        * ``cpcolor``: sets the color of the control points grid
        * ``evalcolor``: sets the color of the surface
        * ``trimcolor``: sets the color of the trim curves
        * ``filename``: saves the plot with the input name
        * ``plot``: controls plot window visibility. *Default: True*
        * ``animate``: activates animation (if supported). *Default: False*
        * ``extras``: adds line plots to the figure. *Default: None*
        * ``colormap``: sets the colormap of the surface

    The ``plot`` argument is useful when you would like to work on the command line without any window context.
    If ``plot`` flag is False, this method saves the plot as an image file (.png file where possible) and disables
    plot window popping out. If you don't provide a file name, the name of the image file will be pulled from the
    configuration class.

    ``extras`` argument can be used to add extra line plots to the figure. This argument expects a list of dicts
    in the format described below:

    .. code-block:: python
        :linenos:

        [
            dict(  # line plot 1
                points=[[1, 2, 3], [4, 5, 6]],  # list of points
                name="My line Plot 1",  # name displayed on the legend
                color="red",   # color of the line plot
                size=6.5  # size of the line plot
            ),
            dict(  # line plot 2
                points=[[7, 8, 9], [10, 11, 12]],  # list of points
                name="My line Plot 2",  # name displayed on the legend
                color="navy",   # color of the line plot
                size=12.5  # size of the line plot
            )
        ]

    Please note that ``colormap`` argument can only work with visualization classes that support colormaps. As an
    example, please see :py:class:`.VisMPL.VisSurfTriangle()` class documentation. This method expects a single
    colormap input.

    :return: the figure object

It should return figure object, but I got None

orbingol commented 11 months ago

Thanks for reporting this issue. There will be a fix coming for the visualizers (hopefully) very soon.