Forum Allplan

[Domanda] Creating a custom node in Visual Scripting

Tags:
  • Allplan
  • 2022-0-7
  • Visual
  • Scripting
  • Custom
  • Node

Hello,

I have been exploring the Allplan API (https://pythonparts.allplan.com/), PythonPartsScripts and VisualScripts lately. The reason for this is because I think there are some useful functionalities that aren't included in today's version of Visual Scripting. In this case I'm looking for automated dimension lines.

I came across a couple of PythonParts that contain these functionalities, where the model gets it's own dimensionlines, reinforcement labels, sectionviews etc. The following path is where I found most of these PythonPartScripts: C:\ProgramData\Nemetschek\Allplan\2021\Etc\PythonPartsScripts

My initial idea was to create a simple custom Visual Script Node by copying a simple existing node (NodeLine in my case) and adding (copy+pasting) some of the code out of the PythonPartsScripts that create dimension lines. I quickly realized it wasn't as simple as that because the model gets generated without the dimension lines. One of my obstacles is that my Python skills are quite poor, so using the correct variables and syntaxes are difficult for me.

I was wondering if there's anyone who could help me out with the following questions:

1. What's the best way to get to know Custom Nodes better?
Eventually, I'd like to create my own custom Node, "NodeDimensionline" for example, where it generates a dimline based on "GetVertex" or "GetEdge" nodes for instance. I feel like starting out with this example gives me a good basic/general idea of creating custom nodes for when I want to start looking at reinforcement labeling nodes or anything else.

2. Does anyone have some sort of documentation about working with custom nodes in Allplan?
The Allplan API (https://pythonparts.allplan.com/) is quite difficult to read for me as I'm not that experienced with Python. This website also does not provide a workflow on how to work with custom VS nodes. Any useful documentation about modeling 3D objects with Python is welcome.

Kind regards.

Show most helpful answer Hide most helpful answer

We currently don't have documentation about how to create a custom node. The best way is to check the existing nodes to understand the file structure of nodes better.

Basically, a node contains three different files:

  • .py is the python scripts contains functions in python. It is similar to a coded-PythonPart and utilizes the Python API. You can also check existing PythonPart interactor examples (C:\ProgramData\Nemetschek\Allplan\2022\Etc\Examples\PythonParts\InteractorExamples) to start with. If you have further question regarding PythonPart, you can post it in the PythonPart sub forum.
  • .pypsub defines UI elements of a node in VS Editor. Make sure to generate a unique UUID for your customer node. The filename of the node must start with "Node".
  • .xml is the localization files, in case you want to translate your node.

Please save all of them under <STD>\VisualScripts\ and don't under <ETC>, as any change made in the <ETC>\VisualScripts\ might be restored after you re-install or update the Allplan. If you do that correctly, the new node will appear in the library under the section office.

Product Owner API, Allplan GmbH

Allegati (1)

Type: image/png
432 scaricato
Size: 56,65 KiB

We currently don't have documentation about how to create a custom node. The best way is to check the existing nodes to understand the file structure of nodes better.

Basically, a node contains three different files:

  • .py is the python scripts contains functions in python. It is similar to a coded-PythonPart and utilizes the Python API. You can also check existing PythonPart interactor examples (C:\ProgramData\Nemetschek\Allplan\2022\Etc\Examples\PythonParts\InteractorExamples) to start with. If you have further question regarding PythonPart, you can post it in the PythonPart sub forum.
  • .pypsub defines UI elements of a node in VS Editor. Make sure to generate a unique UUID for your customer node. The filename of the node must start with "Node".
  • .xml is the localization files, in case you want to translate your node.

Please save all of them under <STD>\VisualScripts\ and don't under <ETC>, as any change made in the <ETC>\VisualScripts\ might be restored after you re-install or update the Allplan. If you do that correctly, the new node will appear in the library under the section office.

Product Owner API, Allplan GmbH

Allegati (1)

Type: image/png
432 scaricato
Size: 56,65 KiB