Skip to content

Commit 4b50d91

Browse files
committed
fix: add a vtk grid from bb attribute
1 parent baa083a commit 4b50d91

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

LoopStructural/datatypes/_bounding_box.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ def __init__(
5252
"maxz": (1, 2),
5353
}
5454

55+
@property
56+
def global_origin(self):
57+
return self._origin
58+
59+
@property
60+
def global_maximum(self):
61+
return self._maximum
62+
5563
@property
5664
def valid(self):
5765
return self._origin is not None and self._maximum is not None
@@ -193,3 +201,19 @@ def regular_grid(self, nsteps=None, shuffle=False, order="C"):
193201
# logger.info("Shuffling points")
194202
rng.shuffle(locs)
195203
return locs
204+
205+
@property
206+
def vtk(self):
207+
208+
try:
209+
import pyvista as pv
210+
except ImportError:
211+
raise ImportError("pyvista is required for vtk support")
212+
x = np.linspace(self.origin[0], self.maximum[0], self.nsteps[0])
213+
y = np.linspace(self.origin[1], self.maximum[1], self.nsteps[1])
214+
z = np.linspace(self.origin[2], self.maximum[2], self.nsteps[2])
215+
return pv.RectilinearGrid(
216+
x,
217+
y,
218+
z,
219+
)

0 commit comments

Comments
 (0)