# vtkImplicitPlaneWidget - normalVisible (and other props)

**URL:** https://discourse.vtk.org/t/vtkimplicitplanewidget-normalvisible-and-other-props/10197
**Category:** Web
**Created:** [December 14, 2022, 8:05pm UTC](https://discourse.vtk.org/t/vtkimplicitplanewidget-normalvisible-and-other-props/10197 "2022-12-14T20:05:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rmar](https://discourse.vtk.org/user_avatar/discourse.vtk.org/rmar/32/6265_2.png) [@rmar](https://discourse.vtk.org/u/rmar)
#### Post date: [December 14, 2022, 8:05pm UTC](https://discourse.vtk.org/t/vtkimplicitplanewidget-normalvisible-and-other-props/10197/1 "2022-12-14T20:05:28Z")

</div>

I am trying to hide the various elements of the implicit plane widget. There appears to be support for the properties in the widget setup ([ImplicitPlaneWidget | vtk.js](https://kitware.github.io/vtk-js/api/Widgets_Widgets3D_ImplicitPlaneWidget.html)):

```auto
  // --- Widget Requirement ---------------------------------------------------

  model.methodsToLink = [
    'representationStyle',
    'sphereResolution',
    'handleSizeRatio',
    'axisScale',
    'normalVisible',
    'originVisible',
    'planeVisible',
    'outlineVisible',
  ];

```

But these properties are not affected by even the `newInstance()` arguments, demonstrated [here](https://jsfiddle.net/ow5zxL6a/36/):

```auto
/* import '@kitware/vtk.js/favicon';

// Load the rendering pieces we want to use (for both WebGL and WebGPU)
import '@kitware/vtk.js/Rendering/Profiles/Geometry';
import '@kitware/vtk.js/Rendering/Profiles/Glyph';

import vtkFullScreenRenderWindow from '@kitware/vtk.js/Rendering/Misc/FullScreenRenderWindow';
import vtkImplicitPlaneWidget from '@kitware/vtk.js/Widgets/Widgets3D/ImplicitPlaneWidget';
import vtkWidgetManager from '@kitware/vtk.js/Widgets/Core/WidgetManager';

import vtkActor from '@kitware/vtk.js/Rendering/Core/Actor';
import vtkConeSource from '@kitware/vtk.js/Filters/Sources/ConeSource';
import vtkMapper from '@kitware/vtk.js/Rendering/Core/Mapper'; */

// ----------------------------------------------------------------------------
// Standard rendering code setup
// ----------------------------------------------------------------------------

const fullScreenRenderer = vtk.Rendering.Misc.vtkFullScreenRenderWindow.newInstance({
  background: [0, 0, 0],
});
const renderer = fullScreenRenderer.getRenderer();

// ----------------------------------------------------------------------------
// Add context to place widget
// ----------------------------------------------------------------------------

const cone = vtk.Filters.Sources.vtkConeSource.newInstance();
const mapper = vtk.Rendering.Core.vtkMapper.newInstance();
const actor = vtk.Rendering.Core.vtkActor.newInstance({ pickable: false });

actor.setMapper(mapper);
mapper.setInputConnection(cone.getOutputPort());
actor.getProperty().setOpacity(0.5);
renderer.addActor(actor);

// ----------------------------------------------------------------------------
// Widget manager
// ----------------------------------------------------------------------------

const widgetManager = vtk.Widgets.Core.vtkWidgetManager.newInstance();
widgetManager.setRenderer(renderer);

const widget = vtk.Widgets.Widgets3D.vtkImplicitPlaneWidget.newInstance({
        normalVisible: false,
        originVisible: true,
        planeVisible: true,
        outlineVisible: true
});
widget.getWidgetState().setNormal(0, 0, 1);
widget.placeWidget(cone.getOutputData().getBounds());
widget.setPlaceFactor(3);

widgetManager.addWidget(widget);

renderer.resetCamera();
widgetManager.enablePicking();

```

Is there any way to toggle visibility of the widget parts on demand? The question seems related to:

> [@Customize ImplicitPlaneWidget](https://discourse.vtk.org/t/customize-implicitplanewidget/8302):
>
> I’d like to customize the actor properties of my ImplicitPlaneWidget but functions like setNormalVisible() don’t seem to be exposed via vtk.js. I see the [following lines](https://github.com/Kitware/vtk-js/blob/9cdf015a994728cea6d9f103cb8e27e6f3d9df08/Sources/Widgets/Widgets3D/ImplicitPlaneWidget/index.js#L146-L155) in the vtkImplicitPlaneWidget code: model.methodsToLink = ['representationStyle', 'sphereResolution', 'handleSizeRatio', 'axisScale', 'normalVisible', 'originVisible', 'planeVisible', 'outlineVisible',]; Are these functions callable? What more would be have to be done to expose them?

---

<div class="post-metadata">

### Author: ![Sirice](https://discourse.vtk.org/user_avatar/discourse.vtk.org/sirice/32/8328_2.png) [@Sirice](https://discourse.vtk.org/u/Sirice)
#### Post date: [January 23, 2024, 7:42am UTC](https://discourse.vtk.org/t/vtkimplicitplanewidget-normalvisible-and-other-props/10197/2 "2024-01-23T07:42:32Z")

</div>

The properties are not initialized on widget instance BUT on widgetManager.

This issue also made me confused for a period of time. You can read document here to reference:

[#Widget-Representation](https://kitware.github.io/vtk-js/docs/develop_widget.html#Widget-Representations)

> Widget state
> 
> The widget state stores widget data used across renderers. The widget state is composed of sub-states(i.e. Object) made of properties that describe particular aspects of the widget. For example, sub-states can store positions and sizes of actors to be rendered.

So I can speculate that the ‘methodsToLink’ is the array of properties belongs to widget and it will be implemented by widgetManager as setter and getter. We should call these functions on widgetManager finally.

The codes you need may be like:

```auto
const widgetManager = vtk.Widgets.Core.vtkWidgetManager.newInstance();
widgetManager.setRenderer(renderer);
const widget = vtk.Widgets.Widgets3D.vtkImplicitPlaneWidget.newInstance();
const wm = widgetManager.addWidget(widgetInstance);
wm.setNormalVisible(false);
wm.setOriginVisible(true)
wm.setPlaneVisible(true)
wm.setOutlineVisible(true)

// ...

```
