Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Discussion options

You must be logged in to vote

How about this?

import numpy as np
import pyvista as pv

n_r = 200
n_theta = 300
r_min = 0.0
r_max = 10.0
height = 10
flatness = 1  # Increase to flatten overall shape, decrease to make it more "pointy"

r = np.linspace(r_min, r_max, n_r)
theta = np.linspace(0, 2 * np.pi, n_theta)
r, theta = np.meshgrid(r, theta)

x = r * np.cos(theta)
y = r * np.sin(theta)
z = height / (r + flatness)

grid = pv.StructuredGrid(x, y, z)
pl = pv.Plotter()
pl.add_mesh(grid, smooth_shading=True, pbr=True, metallic=True, color='banana')
pl.show()

If you want PolyData, you can use grid.extract_geometry()

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@OlekPop
Comment options

@user27182
Comment options

@OlekPop
Comment options

@user27182
Comment options

Answer selected by user27182
@OlekPop
Comment options

@OlekPop
Comment options

@user27182
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants