Beispiel #1
0
Internally, it's a visual effect, which means we have to manually activate the cross-section mode
with 'v.set_cross_section(True). This activates the cross-section with default values for the plane.

You can change the plane description with v.cross_section(origin, normal), where 'origin' is a point
on the plane, and 'normal' is the normal of the plane.

To deactivate the cross-section, just use 'v.set_cross_section(False)'.

"""

v = Viewer()
mesh_path = f'{pathlib.Path(__file__).parent.parent}/test_files/caseron.off'
block_path = f'{pathlib.Path(__file__).parent.parent}/test_files/rainbow.csv'

mesh = v.load_mesh(mesh_path, color=[1.0, 0.8, 0.0])
blocks = v.load_blocks(block_path)
low, high = v.bounding_box()


def scan(origin):
    v.cross_section(origin, np.array([1.0, 0.0, 0.0]))


def scan_left(*args, **kwargs):
    v.signal_animation_finished.disconnect()

    v.animate(high, low, scan, duration=2000, steps=60)
    v.signal_animation_finished.connect(scan_right)


def scan_right(*args, **kwargs):
Beispiel #2
0
from blastsight.view.viewer import Viewer
"""
In this demo, a mesh and a block set will be dynamically sliced by yourself,
by clicking in two parts of the screen.
"""

viewer = Viewer()
title = viewer.windowTitle()
viewer.setWindowTitle(f'{title} - Click two points in the screen.')

mesh_path = f'{pathlib.Path(__file__).parent.parent}/test_files/caseron.off'
block_path = f'{pathlib.Path(__file__).parent.parent}/test_files/rainbow.csv'

mesh = viewer.load_mesh(mesh_path, color=[0.0, 0.8, 0.6], alpha=0.2)
blocks = viewer.load_blocks(block_path, alpha=0.1)

original_size = blocks.block_size


def slice_elements(description: dict) -> None:
    """
    The method slice_elements reacts to viewer.signal_slice_description,
    and receives a description of the slice, so you can do whatever you
    want with that information.

    :param description: Description of the cross-section
    :return: None
    """
    origin = description.get('origin')
    normal = description.get('normal')