Project > Quantities

Zone Takeoff

Measures objects by zone, from grid levels, rooms or areas, grid bays or square tiles, and by group. Exports an Excel pivot with a sheet per zone.

Tab and panelProject > Quantities
KindButton
Live whenA model is open

Status

Untested Never executed inside Navisworks. Passed the headless checks only.

Related asks to confirm

No quote is on record yet. These threads look related, but a person still has to open and read them.

Events it listens to

None. It runs only when you click it.

Files

Paths are relative to the Playground.extension folder.

  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/bundle.yaml
  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/icon.dark.png
  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/icon.png
  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/icon.small.dark.png
  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/icon.small.png
  • Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Zone Takeoff, tick it and click Install.
  2. The whole extension. Download Playground.extension.zip, unzip it, put the Playground.extension folder in %APPDATA%\pyNavis\extensions\, and click pyNavis > Reload. Zone Takeoff is on the Project tab, Quantities panel.

You need pyNavis 1.3.0 or later.

Tried it? Tell us whether it worked or not. That report is what moves a tool up the status ladder.

Report

Source

The tool's own files, word for word as published in pynavis/Playground. Paths are relative to the Playground.extension folder.

script.py

The script that runs on a click.

Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Measures objects by zone (grid levels, rooms or areas, grid bays or tiles) and by group, with an Excel pivot."""
from pynavis import script, toast

from namo import fourd_common, items, qty_run, qty_ui, reports, takeoff, ui

TITLE = 'Zone Takeoff'
PIVOTS = [('Count', 'count'), ('Length', 'length'), ('Area', 'area'), ('Volume', 'volume'), ('Weight', 'weight')]


def run():
    if ui.is_runner():
        result = reports.run('zone_takeoff', script.get_config(takeoff.default_zone_config()),
                             interactive=False)
        toast.show(result['level'], result['message'], result['detail'])
        return
    doc = fourd_common.active_doc()
    if not fourd_common.has_models(doc):
        toast.info('No model is open', 'Open or append a model first.')
        return
    values = script.get_config(takeoff.default_zone_config())
    selected = items.selected(doc)
    sample = items.objects(selected if selected else items.roots(doc), budget=300)
    choices, specs = qty_ui.group_choices(takeoff.property_options(sample))
    levels = takeoff.grid_levels(doc)
    fields = qty_ui.zone_fields(values)
    fields += qty_ui.quick_fields(values, bool(selected), choices, zone=True)
    fields.append({'kind': 'choice', 'key': 'pivot', 'label': 'Pivot sheet shows', 'options': PIVOTS,
                   'default': values.get('pivot_measure') or 'count', 'fallback': 'count'})
    intro = ('The active grid has %s.' % fourd_common.plural(len(levels), 'level') if levels
             else 'The model has no grid levels; use zone objects, grid bays or tiles.')
    answer = ui.form(TITLE, fields, intro=intro, ok='Measure', width=580, validate=qty_ui.validate_zone)
    if answer is None:
        return
    config = qty_ui.config_from(answer, specs, zone=True)
    script.save_config(config)
    qty_run.run_zone(doc, config)


run()

Library modules this tool uses

From the shared namo library, which installs with every tool. Each name opens the module on GitHub.

  • namo.fourd_commonHelpers the 4D, Quantities and Field tools share: scopes, default files, text.
  • namo.itemsModel items: walking, collecting, identifying, measuring and showing them.
  • namo.qty_runRuns a Quick or Zone Takeoff configuration and shows its result window: shared by the two takeoff buttons and Takeoff Templates.
  • namo.qty_uiForms and windows of the Quantities panel (Quick Takeoff, Zone Takeoff, Takeoff Templates, COG Calculator), built on namo.ui.
  • namo.reportsThe registry of automation-ready reports, and the helpers every report shares.
  • namo.takeoffQuantity takeoff: measures from properties (and geometry), grouping, zones, workbooks.
  • namo.uiWPF building blocks for Playground tools, themed from the pyNavis design system.

bundle.yaml

The bundle contract: the keys pyNavis reads for this tool.

Project.tab/Quantities.panel/Zone_Takeoff.pushbutton/bundle.yaml View on GitHub
title: Zone\nTakeoff
tooltip: Measures objects by zone, from grid levels, rooms or areas, grid bays or square tiles, and by group. Exports an Excel pivot with a sheet per zone.
context: doc