pyvista.Plotter.add_plane_widget#
- Plotter.add_plane_widget(
- callback,
- normal='x',
- origin=None,
- bounds=None,
- factor=1.25,
- color=None,
- assign_to_axis=None,
- tubing: bool = False,
- outline_translation: bool = False,
- origin_translation: bool = True,
- implicit: bool = True,
- pass_widget: bool = False,
- test_callback: bool = True,
- normal_rotation: bool = True,
- interaction_event: pyvista.InteractionEventType = 'end',
- outline_opacity=None,
シーンに平面ウィジェットを追加します.
これは,コールバック関数なしでは使用できません.このウィジェットから出力されるプレーンの法線と原点の順序という2つの引数を取る呼び出し可能関数を渡して,そのプレーンでタスクを実行することができます.
- パラメータ:
- callback
callable() このメソッドは,プレーンが更新されるたびに呼び出されます.平面の法線と原点の順序で2つの引数を取ります.
- normalpython:str か python:tuple(python:float)
平面の開始法線ベクトル.
- origin
tuple(float) 平面の中心の開始座標.
- bounds
tuple(float) ウィジェットが配置されるバウンディングボックスの長さ6のタプル.
- factor
float,optional 配置時に境界を拡張するための膨張係数.
- color
ColorLike,optional 文字列,RGBリスト,または16進カラー文字列.
- assign_to_axispython:str または python:int, optional
平面の法線を指定された軸と平行になるように割り当てます.オプションは
(0, 'x'),(1, 'y'),または(2, 'z')です.- tubingbool,
optional When using an implicit plane widget, this controls whether or not tubing is shown around the plane's boundaries.
- outline_translationbool,
optional Falseの場合,プレーンウィジェットは移動できず,指定された境界に厳密に配置される.インプリシット平面を使用する場合にのみ有効です.- origin_translationbool,
optional Falseの場合,プレーンウィジェットは原点によって移動できず,指定された原点に厳密に配置される.インプリシット平面を使用する場合にのみ有効です.- implicitbool,
optional When
True, a vtkImplicitPlaneWidget is used and whenFalse, a vtkPlaneWidget is used.- pass_widgetbool,
optional Trueの場合,ウィジェットはコールバックの最後の引数として渡されます.- test_callbackbool,
optional Trueの場合,ウィジェットの作成後にコールバック関数を実行します.- normal_rotationbool,
optional 法線ベクトル矢印の不透明度を0に設定して,実質的に無効にします.これにより,ユーザは法線を回転できなくなります.
assign_to_axisが設定されている場合,これは強制的にFalseになります.- interaction_event
InteractionEventType,optional The VTK interaction event to use for triggering the callback. Accepts either the strings
'start','end','always'or a vtkCommand.EventIds.バージョン 0.38.0 で変更: Now accepts either strings and vtkCommand.EventIds.
- outline_opacitybool or
float,optional アウトラインの可視を設定します.インプリシット平面を使用している場合のみ有効.boolまたはfloatのどちらか.
Added in version 0.44.0.
- callback
- 戻り値:
- vtkImplicitPlaneWidget | vtkPlaneWidget
平面ウィジェット.
例
ランダムヒルの例で,特定の距離xで最大高度をマークするために使用される,x軸に沿って移動するインタラクティブな平面を示します.
>>> import pyvista as pv >>> from pyvista import examples >>> mesh = examples.load_random_hills() >>> pl = pv.Plotter() >>> _ = pl.add_mesh(mesh) >>> def callback(normal, origin): ... slc = mesh.slice(normal=normal, origin=origin) ... origin = list(origin) ... origin[2] = slc.bounds.z_max ... peak_plane = pv.Plane( ... center=origin, ... direction=[0, 0, 1], ... i_size=20, ... j_size=20, ... ) ... _ = pl.add_mesh(peak_plane, name='Peak', color='red', opacity=0.4) >>> _ = pl.add_plane_widget(callback, normal_rotation=False) >>> pl.show()