Allplan 2023-0-0 Visual Scripting Changes & Improvements

Теги:
  • 2023-0-0
  • VisualScripting
  • Avsprj
  • ProjectFile
  • CreateObjects
  • Copy
  • QuickInsert
  • Stop
  • VisualStatus

TLDR

  • The project file (avsprj) was introduced for script creator.
  • Use new "Create Object" button to generate object.
  • Copy nodes between different scripts.
  • Quick Insert won't be cropped by the boundary of the canvas.
  • Stop button.
  • New visual states for nodes (require registry key).

avsprj Project File
One of the main changes in Allplan 2023 Visual Scripting is the new avsprj format for developing a PythonPart script with VS editor. With that new file format, we want to make it clear for a user:

  • avsprj is the format for editing in VS editor used by the VS script developer. The Allplan library won't be able to start avsprj files.
  • pyp is the format for starting a PythonPart script in Allplan used by an end-user. The PythonPart object in Allplan is associated with the pyp file, not the avsprj file.

loading
Some reasons and benefits behind that changes are:
  • VS Editor can't open coded pyp files, but the script it creates is also a pyp file. A dedicated format for VS editor will reduce the confusion between VS pyp and coded pyp files.
  • As we continuously introduce new features to the VS editor, some information is unnecessary for running a script. Putting more of them into the pyp file creates unnecessary overhead at runtime.
  • In Allplan 2023 and beyond, VS editor won't support opening any new versions of the VS pyp file. Therefore, it can provide some protection to the original graph. Due to the backward compatibility, the VS editor can still open the current version of the VS pyp (v1.4.1) file, but not any newer version.

Create Objects in Allplan
The second main change in Allplan 2023 Visual Scripting is how to create objects in Allplan from Visual Scripting.
In all previous versions, a user must close the VS Editor to create objects in Allplan. Depending on different situations, it will ask the user to save the script, geometry in Allplan, or both.
The new method is to use the Create Object function. It will ask the user to save pyp first and then use that pyp file to generate geometry in Allplan. With that behavior change, closing VS Editor won't create geometry in Allplan anymore.
loading
Known issues:

  • VS Editor will ask to save the pyp file each time a user clicks on Create Object. It doesn't remember the last used path for saving.
  • A user can create objects from the editor, even if the script occurs some errors.

Copy Nodes across Scripts
The VS editor now supports copying & pasting nodes from one script to another. It currently requires a user to close the existing script. It is only an interim solution for reusing existing nodes.
loading
Known issues:

  • Copy nodes from a large script may take a little bit longer.

Quick Insert UX Improvement
The Quick Insert is now hovering over the canvas. Thus, its boundary won't crop the Quick Insert anymore, including the result list.
loading

Stop a Script
Stop a script will remove the previews and empty the PythonPart palette in Allplan.
loading
Known issues:

  • Stop a script won't reset the value in the tooltip or watchlist.

New Visual Status for Nodes (preview)
To help a user to understand a script better, we introduce the new visual status for nodes. Depending on the evaluation result, a node will change its color to one of the following colors.

  • blue = not evaluated (not calculated)
  • green = success
  • yellow = warning
  • red = error

The difference between a warning and an error is:
  • In the case of a warning, the script will continue to run.
  • But it won't continue if occurring an error.

loading
Known issues:
  • If a script occurs an error after running, the VS Editor can't update the visual status. A user must re-run to update the status.
  • Some input nodes, which require an ESC to complete the input, will update their status after a re-run.
  • Stop currently won't reset the visual status.
  • Sometimes it looks unlogic that VS editor didn't evaluate a node before a failed one. That's because the first added branches will have a higher priority if the script has several ones. If that first branch fails, others won't continue, even if the others are shorter or visually in front. Please check the blue Point3D node in the screenshot below.

loading
How to activate:
Add a new DWORD key VisualStateFeatureFlag under Computer\HKEY_CURRENT_USER\SOFTWARE\Nemetschek\Allplan\2023.0\VisualScripter and set it to 1.
loading

Product Owner API, Allplan GmbH

Вложения (8)

Type: image/png
Загружено 49 раз
Size: 55,52 KiB
Type: image/gif
Загружено 66 раз
Size: 440,29 KiB
Type: image/gif
Загружено 50 раз
Size: 292,05 KiB
Type: image/gif
Загружено 46 раз
Size: 45,80 KiB
Type: image/gif
Загружено 36 раз
Size: 110,01 KiB
Type: image/gif
Загружено 44 раз
Size: 41,72 KiB
Type: image/png
Загружено 58 раз
Size: 38,36 KiB
Type: image/png
Загружено 83 раз
Size: 17,26 KiB

Show most helpful answer Hide most helpful answer

For the states of the Nodes: I'am missing additional visual feedback for

"Node has no data" (because unconnected inputs or empty lists)
"Node has valid geometrical Data" (this data can be displayed as preview or created in model)
-> not all data can show as Preview or created in model, alphanumerical data for instance does'nt

Enclosed the visual states of my visual scripting solution(s. node_states.png) with following explanation:

1. Node ist deaktiviert (Locked).
2. Node enthält keine Daten.
3. Node enthält Daten, die nicht im Preview angezeigt werden.
Das können alphanumerische Daten sein, oder es sind geometrische Daten, die aber durch Deaktivierung von „Visible“ in der Palette nicht angezeigt werden.
4. Node enthält geometrische Daten, die im Preview angezeigt werden.
5. Node erzeugt eine Warnung bei der Ausführung.
6. Node erzeugt eine Fehler bei der Ausführung.

...as an inspiration.

This would make it easy to see which nodes are not evaluated because of errors or empty data on his inputs!

Вложения (1)

Type: image/png
Загружено 189 раз
Size: 87,25 KiB

For the execution order of the nodes:

What you have written is not understandable, and also illogical.

A tree (and a visual scripting flowchart is such a tree) has a big advantage: When you change the parameters of a node,
you only need to recalculate the nodes that depend on that node (usually nodes to the right of that node).
All other nodes do not need to be updated and can keep their evaluated data!

In my visual scripting solution there is a flag for ValidData.
When parameters of a node change, this flag is set to False, and subsequently all nodes that depend on this node are also set to False. Then you only need to iterate over all nodes and start the evaluation for those that have ValidData=false. Other nodes data remain unchanged!

The algorithm to evaluate a node is as follows:
1. has the node ValidData? if yes, go to the next node
2. if not: search for each input the outputs of other nodes (these are usually the ones to the left of the considered node).
3. if these nodes have ValidData, use it.
4. if not, evaluate this node: perform point 2. for this node.

With this algorithm you can iterate over all nodes and the flowchart will fill itself with data. You don't need to follow any order. At the first "execution of the flowchart just set all nodes to ValidData=false, iterate over all nodes and evaluate them.

If the flowchart already contains data, invalidate only the nodes whose parameters have changed and the nodes that depend on them.

With this "intelligent data generation" you can achieve enormous speed gains.

Thanks Nemo for the feedback.

Regarding when a node will be recalculated works similar to what you described. Only the UI doesn't get updated, that also why it is locked behind a registry key. But it can still provide some value, if a user wants to test.

Regarding an error stops the evaluation, I'm not saying that the current implementation is the perfect way to evaluate the graph. I just wanted to point out the current situation and problem, as users will be confused, why one branch didn't get evaluated. I hoped the explanation can help users to understand the reason behind that. Therefore, it's a known issue, not a final solution.

Product Owner API, Allplan GmbH

For the states of the Nodes: I'am missing additional visual feedback for

"Node has no data" (because unconnected inputs or empty lists)
"Node has valid geometrical Data" (this data can be displayed as preview or created in model)
-> not all data can show as Preview or created in model, alphanumerical data for instance does'nt

Enclosed the visual states of my visual scripting solution(s. node_states.png) with following explanation:

1. Node ist deaktiviert (Locked).
2. Node enthält keine Daten.
3. Node enthält Daten, die nicht im Preview angezeigt werden.
Das können alphanumerische Daten sein, oder es sind geometrische Daten, die aber durch Deaktivierung von „Visible“ in der Palette nicht angezeigt werden.
4. Node enthält geometrische Daten, die im Preview angezeigt werden.
5. Node erzeugt eine Warnung bei der Ausführung.
6. Node erzeugt eine Fehler bei der Ausführung.

...as an inspiration.

This would make it easy to see which nodes are not evaluated because of errors or empty data on his inputs!

Вложения (1)

Type: image/png
Загружено 189 раз
Size: 87,25 KiB

Thanks Nemo for the suggestion.

Цитируется из: Nemo
1. Node ist deaktiviert (Locked).
4. Node enthält geometrische Daten, die im Preview angezeigt werden.

We are working on a solution for deactivated nodes and nodes with geometry preview. Stay tuned for further improvements regarding visual status.

Цитируется из: Nemo
2. Node enthält keine Daten.

About nodes with no data in output, we are considering using connection or/and port status to visualize them.

Цитируется из: Nemo
3. Node enthält Daten, die nicht im Preview angezeigt werden.

That is the default success or warning status.

Product Owner API, Allplan GmbH

I am Waiting for node place bar along path.

With this new feature, is it possible to run the script (pyp) in Allplan 2022?

Цитируется из: ekousr
With this new feature, is it possible to run the script (pyp) in Allplan 2022?

Yes. Basically, the PythonPart script (pyp) created from the Visual Scripting project file (avsprj) on Allplan 2023 can still be run on Allplan 2022, unless you use some nodes or API functions which aren't available on version 2022.

Product Owner API, Allplan GmbH