Viewpoints panel

Copy State

Copy the section planes, the hidden items or the appearance overrides to disk, to put back later.

On the ribbonStacked button, Viewpoints panel
NeedsAn open document

What it does#

The answer to setting up a section, a set of hidden items or a colour scheme and then needing to look at something else. Pick a kind of state and it is written under %APPDATA%\pyNavis\viewstate\ keyed to the document, so it is still there in another session.

The Copy State switch: section, hidden items, appearance.
The Copy State switch: section, hidden items, appearance.

How to use it#

  1. Click Copy State and pick section, hidden items or appearance.
  2. Change whatever you need to.
  3. Click Paste State to put it back.

Limitations#

  • One copy of each kind per document. Copying section again replaces the earlier copy.

Other uses#

  • Copy the appearance overrides of a colour-coded review, clear them to take clean screenshots, paste them back.

Source#

The tool's own files, word for word as shipped in Viewpoints.panel/State.stack/Copy_State.pushbutton. Every pyNavis tool is an ordinary bundle: copy these into your own extension and change what you like.

script.py Runs on a click. View on GitHub
"""Copies one kind of view state to disk, per document.

Pick section state, hidden items, or appearance overrides; Paste State brings
it back later in this document, including in another Navisworks session.
"""

from pynavis import forms, toast, viewstate

# prompt=None gives the chromeless quick switch: the button labels ARE the
# question, so the window carries no titlebar and no prompt text.
label = forms.ask_options(
    None,
    [viewstate.label_for(kind) for kind in viewstate.KINDS],
    title='Copy State',
)

if label is not None:                          # None means cancelled: say nothing
    result = viewstate.copy_state(viewstate.kind_for(label))
    toast.show(result.level, result.message, result.detail)
bundle.yaml The bundle contract: the keys pyNavis reads for this tool. View on GitHub
title: Copy State
tooltip: Copy the section planes, hidden items, or appearance overrides to memory for this document
context: doc