AI (beta) panel
Ask AI
Beta. A chat panel that turns a plain-words request into a working pyNavis tool on the ribbon, and revises it when you ask.
What it does#
You type what the tool should do. The panel sends that, together with the pyNavis
authoring guide, to the model you chose in AI Settings. The reply comes back as a short
explanation plus the files of one bundle: bundle.yaml, script.py
and sometimes config.py. Nothing touches disk until you click
Create tool. Then the bundle is written into AI.extension
under your pyNavis extensions folder, the ribbon reloads, and the tool is on the AI tab.
How to use it#
- Click AI Settings once, pick a provider, paste your key, and click Test until the status line says it connected.
- Click Ask AI to show the panel and dock it beside the view.
- Describe the tool in plain words. If it depends on property names, select a few representative items first and tick Attach selection: the model then sees the real category and property names instead of guessing. Names only, never values. Ctrl+Enter sends.
- Read the reply. View files shows exactly what would be written. If the model asked a question instead, answer it.
- Click Create tool. The ribbon reloads and the button is on the AI tab. Click it.
- Keep talking to change it: "make it also hide the rest" sends the files as they are on disk and comes back with a new version, and the card now reads Update tool. If the tool failed when you ran it, Send last error to AI pastes the traceback into the chat for a fix.
- New tool starts a fresh conversation. The dropdown beside it lists every tool Ask AI has made so far; pick one to continue it in a new conversation, with its files put in front of the model.
What leaves your machine#
Every request carries the authoring guide and your chat so far. Only when you ticked the box, it also carries the selection summary: the item count, the category names and the property names under each, capped at a few kilobytes. Never a value: a value is project data (a source file, a client, a project number in a custom tab), so the reader does not even ask Navisworks for one. No file name, no path, no geometry, no user name. The request goes to the provider you configured and nowhere else; pyNavis has no server in the middle.
Limitations#
- Beta. Read the code before you run it. The model works from the guide and from what you say; it cannot see your model unless you attach the selection, and it cannot run the tool itself.
- One bundle per conversation, with only those three files. The model cannot write helper modules, hooks, dock panels or icons; generated tools get a lettered icon in one of five colours, never the blue of the shipped tools, so you can always tell them apart.
- It rewrites only tools it made, inside
AI.extension. Hand-written bundles are never touched. - The conversation lives for the Navisworks session. Closing Navisworks forgets it; the tools stay, and the dropdown in the panel header brings any of them back for editing.
- It takes one of the five dock panel slots.
Other uses#
- Use it as a starting point: create the tool, then open the folder and edit
script.pyby hand like any other bundle. Reload is not even needed for a script edit. - Prefer your own chatbot? Copy authoring guide in the panel's footer
puts the same guide on the clipboard. Paste it, ask for the tool, and save the files it
gives you into a
*.pushbuttonfolder yourself. The authoring docs walk through that path.
Good to know#
Anthropic requests send the guide as a cached prompt block, so from the second message on most of it is read from the provider's cache rather than billed in full. The Longest answer setting caps a reply; if the transcript says the answer hit the limit, raise it and ask again.
Source#
The tool's own files, word for word as shipped in AI_(beta).panel/Ask_AI.dockpane. 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# -*- coding: utf-8 -*-
"""The Ask AI panel (beta): a chat that writes pyNavis tools.
Everything is in the runtime's AiChatPane. The control is built once per
Navisworks session and handed back on every Reload, because creating a tool
triggers a Reload, and a chat that forgot itself at that exact moment would be
useless. This script only parents that control into the pane's grid.
"""
import clr
clr.AddReference('PyNavis.Runtime')
from PyNavis.Runtime.Forms import AiChatPane
pane = __pane__
host = pane.Find('Host')
host.Children.Clear()
host.Children.Add(AiChatPane.LiveContent())
AiChatPane.OnShown()pane.xaml The dock panel's content. View on GitHub<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Name="Host">
<!-- The chat lives in the runtime (PyNavis.Runtime.Forms.AiChatPane) so its
conversation survives the Reload that creating a tool triggers. script.py
drops that one shared control into this grid on every build. -->
</Grid>bundle.yaml The bundle contract: the keys pyNavis reads for this tool. View on GitHubtitle: Ask AI
tooltip: Beta. A chat panel that writes pyNavis tools for you. Describe the button you want, read what the model proposes, click Create, and it appears on the AI tab. Needs an API key from AI Settings, or a local OpenAI-compatible server. You can also build tools with any other assistant using the authoring guide the panel copies for you.
keytip: AA