GithubHelp home page GithubHelp logo

Comments (6)

banesullivan avatar banesullivan commented on June 19, 2024

Hi @Quadius - at this time, clipping an entire scene is not implemented and the pyvista.Clip tool only handles a single mesh in the scene. I could hack together a solution for you soon here but not immediately.

The errors you are experiencing have to do with the arguments for the Clip tool. It takes the mesh you'd like to clip and an optional BackgroundPlotter object (not a standard Plotter).

Try this in the meantime:

p = pv.BackgroundPlotter()
for i in range(0, len(DH)):
    p.add_mesh(globals()['segment{}'.format(i)],color='white',)
p.view_yz()
p.show_axes()

clipper = pv.Clip(points, plotter=p, display_params=dict(color='blue', 
                                                         render_points_as_spheres=True))

from pyvista-support.

banesullivan avatar banesullivan commented on June 19, 2024

Also, reference this currently closed issue: pyvista/pyvista#162

from pyvista-support.

laserman781 avatar laserman781 commented on June 19, 2024

Basically, I have rendered each line using pv.Line and each point using PolyData. Maybe I could combine all of them into one vtk object so I can then clip at a given elevation? Also, with your last solution I received the following without any viewer:

image

from pyvista-support.

banesullivan avatar banesullivan commented on June 19, 2024

Also, with your last solution I received the following without any viewer

Sometimes the BackgroundPlotter appears in the background behind your current application (which is not intended given the name - the "Background" refers to the fact that it runs in a background thread)

from pyvista-support.

banesullivan avatar banesullivan commented on June 19, 2024

Basically, I have rendered each line using pv.Line and each point using PolyData. Maybe I could combine all of them into one vtk object so I can then clip at a given elevation?

Ah, yes!! You could easily merge these all into one pyvista.UnstructuredGrid - there are a few ways to do this...

  1. Create a pyvista.MultiBlock dataset containing everything and run its .comine() filter
blocks = pv.MultiBlock
blocks.append(points)
for i in range(0, len(DH)):
    blocks.append(globals()['segment{}'.format(i)])
merged = blocks.combine()
  1. Use the .boolean_add() filter on the PolyData objects or the + operator which is pretty nifty (if poth inputs are PolyData):
merged = points.copy()
for i in range(0, len(DH)):
   merged = merged + globals()['segment{}'.format(i)]

from pyvista-support.

banesullivan avatar banesullivan commented on June 19, 2024

Then if you still want to color the points and the line segments differently, you could add scalar values to them before merging:

import numpy as np
points['chunk'] = np.zeros(points.n_points)
for i in range(0, len(DH)):
    m = globals()['segment{}'.format(i)]
    m['chunk'] = np.ones(m.n_points)

Then when plotting the merged grid, simply choose a colormap (cmap) that you like, specify n_colors=2, and make sure the scalars are set to 'chunk'

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.