GithubHelp home page GithubHelp logo

Comments (4)

banesullivan avatar banesullivan commented on June 19, 2024

Have you experimented with the different types of lines in this example?: https://docs.pyvista.org/examples/00-load/create-spline.html

If you sort the points in order, then you can create a poly line cell for all of them using the function:

def polyline_from_points(points):
    poly = pv.PolyData()
    poly.points = points
    the_cell = np.arange(0, len(points), dtype=np.int)
    the_cell = np.insert(the_cell, 0, len(points))
    poly.lines = the_cell
    return poly

from pyvista-support.

laserman781 avatar laserman781 commented on June 19, 2024

Upon trying the code above I receive this error:

~\Desktop\Jupyter Notebook\Plotter_R4.py in lines_from_points(points)
     64     the_cell = np.arange(0, len(points), dtype=np.int)
     65     the_cell = np.insert(the_cell, 0, len(points))
---> 66     poly.lines = the_cell
     67     return poly
     68 

~\AppData\Local\Continuum\anaconda3\lib\site-packages\pyvista\core\pointset.py in lines(self, lines)
    205         if lines.ndim == 1:
    206             div = lines.size / 3.0
--> 207             assert not div % 1, 'Invalid lines array'
    208             nlines = int(div)
    209         else:

AssertionError: Invalid lines array

My points are in order before I apply this function.

from pyvista-support.

banesullivan avatar banesullivan commented on June 19, 2024

This was fixed on the last release of PyVista. Would you please make sure you are using the latest version of PyVista:

pip install -U pyvista

from pyvista-support.

laserman781 avatar laserman781 commented on June 19, 2024

Worked perfect, thanks!

from pyvista-support.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.