Allplan 2020 IL VisualScripting
Allplan 2020 IL VisualScripting
E-learning
Contents
Welcome to Allplan Visual Scripting ....................................... 1
Your feedback............................................................................................................... 2
Introduction ....................................................................................... 3
What is visual programming? .............................................................................. 3
Why visual scripting? ................................................................................................ 3
Where to find visual scripting in Allplan? ....................................................... 4
Connecting lines........................................................................................................ 20
Creating connecting lines ............................................................................................20
Editing connecting lines ................................................................................................22
Index ................................................................................................... 45
Allplan Visual Scripting Welcome to Allplan Visual Scripting 1
Your feedback
We are always trying to improve the overall quality of our program
documentation. Your comments and suggestions are important to
us, and we welcome feedback.
Please do not hesitate to contact us to express criticism or praise
concerning the documentation. Feel free to contact us as follows:
Documentation
ALLPLAN GmbH
Werinherstr. 79, Eingang 32 d
81541 Munich, Germany
Email: [email protected]
Allplan Visual Scripting Introduction 3
Introduction
What is visual programming?
Visual programming is receiving more and more attention in the
construction industry. By means of visual programming, you can
program powerful, customized scripts that open up countless new
options when it comes to creativity and design. Visual scripting
facilitates any kind of work: You can automate recurring design
activities, create user-defined forms, analyze data, and generate
project-specific reports.
Parametric modeling is an excellent tool to increase efficiency in
BIM-based planning. This means that the modeled components are
smart due to the parameters assigned. To assign parameters, you
use scripting languages, such as Python. These scripting languages
facilitate the creation of parametric models and support the
automation of design workflows. Think of SmartParts or
PythonParts. When you use them in a model, you are, in fact,
modeling parametrically.
Click to select Allplan Visual Scripting. You can see the Allplan
Visual Scripting window, where you can visually link predefined code
blocks (also referred to as nodes). This results in a script. After
running this script, the program computes the algorithm. This
algorithm creates configurable and reusable objects in Allplan or runs
the defined workflow in Allplan.
But first things first.
Allplan Visual Scripting The user interface of Allplan Visual Scripting 5
1 - Toolbar
2 - Library palette
3 - Workspace
4 - Script view
Toolbar
The toolbar is above the workspace of the Allplan Visual Scripting
window:
You can find the following tools on the left side of the toolbar:
To save a script under a new name, open the Save drop-down list
on the toolbar of the Allplan Visual Scripting window and click Save
as.
You can find the following tools on the right side of the toolbar:
Library palette
The Library palette of Allplan Visual Scripting contains all available
nodes sorted alphabetically by category.
The Library palette is a tree structure that consists of folders
structured logically.
You can dock the palette window to the left or right of the
workspace. To minimize the palette, click Turn on auto-hide. To
temporarily open the palette window, point to >>. To see the palette
all the time, click Turn on auto-hide again.
The box for the search tool is below the title bar of the Library
palette. By entering the name of the node or parts thereof, you can
reduce the number of nodes listed in the library. This makes it easier
for you to find a specific node.
Allplan Visual Scripting The user interface of Allplan Visual Scripting 9
When you open a folder and point to a node (see "Nodes" on page 11),
you can see a list of input parameters and output parameters of the
node and further information (property and data type) about these
parameters. This example shows the Box node in the
Geometry\Objects folder:
10 Workspace Allplan 2020
Workspace
You create and edit scripts in the workspace of Allplan Visual
Scripting. These scripts consist of different nodes (on page 11) that
are linked by connecting lines (on page 20). You drag the nodes from
the Library palette into the workspace. After having placed the
nodes in the workspace, you connect them by means of connecting
lines.
Double-click in the workspace to open quick input (see "Your first
attempt at scripting - part 2" on page 29).
Script view
The tools for changing the script view are in the upper-right corner
of the workspace.
Components of a script
With Allplan Visual Scripting, you create visual programs in a
workspace by connecting nodes by means of connecting lines. In
doing so, you define the logic for running the resulting visual
program. This chapter introduces the elements of Allplan Visual
Scripting.
Nodes
By means of visual scripting, unexperienced users can create
complex scripts without having to understand the underlying
“Python” programming language. To create a script, you place nodes
in the required sequence in the workspace. By entering input values
for the nodes, you make them process the underlying program code,
which initiates certain actions or output. The nodes are arranged in
action networks, which run in turn.
Structure of a node
Each node consists of a title bar (1), a middle area with properties (2),
and the lower area with the settings (3).
Title bar
The title bar contains the icon and name of the node.
Click the "T” to open a box. By default, this box contains the short
description of the node. If a node creates a separate area in the
NodeScript palette in Allplan, you can enter the name of this area
(see "Interplay between Allplan Visual Scripting and Allplan" on page
28) in this box. You can also select the existing name. Use the ENTER
key to confirm the name you just entered.
Allplan Visual Scripting Components of a script 13
Properties area
The places where you can input or output data for nodes are referred
to as ports. These ports act as contacts for the connecting lines (on
page 20). By means of the input ports (4) on the left side, you enter
data into a node. Then, the node processes and outputs the data
through the output ports (5) on the right side. Data flow is always
from left to right.
Point to a port to open a ToolTip with the name, property, and data
type of the port. Input ports require you to enter data of the type
displayed. After processing the input, the node outputs data of the
types displayed through the output ports.
Allplan Visual Scripting Components of a script 15
This example shows the BoxBy2Points node. As you can see, the
StartPoint parameter consists of three values (StartPoint.X,
StartPoint.Y, and StartPoint.Z). After clicking , you can control
these values separately. This means that you can individually define
whether and under which name a value is visible in the NodeScript
palette in Allplan.
16 Nodes Allplan 2020
Note: A red value indicates that this node requires values from
another node. To run this node, you must connect it with another
node.
You can make entries for the individual values on the right side of the
Properties area. In addition, you can define whether and under which
names the values are visible in the NodeScript palette in Allplan. Use
the ENTER key to confirm the names you entered. To close the box
with the properties, open another box with properties or click in the
workspace.
Settings area
In addition to properties, each node has settings that you can use to
control the result of the object in the viewport of Allplan. With these
settings, you can also control whether the properties are visible in
the NodeScript palette of Allplan (see "Your first attempt at scripting
- part 2" on page 29).
Handling nodes
Tip: You can also select When you click to select a node, it gets a thick blue border. You can
several nodes by enclosing select several nodes in one go. To do this, select and hold the CTRL
them in a selection key and click the nodes one after the other. You can then move the
rectangle. selected nodes by means of drag-and-drop editing.
Use CTRL+V and CTRL+C to copy and paste selected nodes.
Use the DEL key to delete selected nodes. By deleting a node, you
also remove all its connecting lines.
Types of nodes
Nodes are the basic building blocks of Allplan Visual Scripting. Each
node contributes to the script as a whole.
A node is a predefined code block that processes incoming data
through input ports and outputs (partial) results through output
ports. For example, results can be objects, vectors, and values. Data
flow is always from left to right.
A node requires data so that the node can run its actions and then
output data. The incoming data and outgoing data can be completely
different, such as an integer or a list.
There are also nodes that have only output ports but no input ports.
Allplan Visual Scripting Components of a script 19
Connecting lines
Connecting lines connect nodes to create relationships and to define
how a visual program runs. Think of connecting lines as electrical
wires that transport data pulses form one node to the next node.
Connecting lines show the data flow for running the algorithm.
Connecting lines connect the output port of a node with the input
port of another node. This directionality defines the data flow in the
visual program. Although you can arrange the nodes freely in the
workspace, the program generally runs from left to right because
the output ports are on the right side of the nodes and the input
ports are on the left side.
Ports expect data of a specific type. You can connect ports of the
same data type only. If you try to connect two ports that do not
match, the program displays a symbol and cancels the operation.
Tip: You do not even need to • Reconnect start: Removes the connecting line from the output
open the shortcut menu: To port so that you can place the connecting line at another output
remove a connecting line port.
from a port, select and hold
the SHIFT key and click the • Reconnect end: Removes the connecting line from the input port
port. The connecting line is so that you can place the connecting line at another input port.
attached to the cursor and • Disconnect: Deletes the connecting line.
can be connected with
another port or deleted. To
delete the connecting line,
click in the workspace or
select ESC.
To remove a connecting line
from a port, you can also
select and hold the CTRL
key and click the port.
Allplan Visual Scripting Running a script 23
Running a script
If you have correctly connected all nodes in the current script, you
can run the script by clicking Start (toolbar). As a result, the
NodeScript palette opens in Allplan. In addition, the workspace of
Allplan shows the result of the script (object) or runs the workflow
defined.
You can change the parameters both in the NodeScript palette and
in the script itself.
Note: You cannot select the Start tool until the script is complete.
For example, look for red input ports (see "Structure of a node" on
page 11).
24 Connecting lines Allplan 2020
To create a script
1 Start Allplan.
2 Create a new project, for example, Visual Scripting.
Drawing file 1 of the new project is open.
3 Go to the Actionbar and open a role that contains the User-
Defined Objects task. For example, select the architecture role.
4 Open the User-Defined Objects task.
This task contains the Visual Scripting task area.
Tip: If you know a part of the To extend and save the script
node name, you can also use
quick input. To open quick 1 Create three copies of the initial circle. The centers of the circles
input, double-click in the are 2 m from one another.
workspace. Enter the node This operation is a geometric transformation.
name or parts thereof in the Open the corresponding folder in the Library palette. Drag the
box. PlaceByVector node into the workspace and place it to the right
of the Circle3D node.
4 To copy the circle, you must connect the Circle output port with
the ObjectsToPlace input port.
Note: If you want to correct a connection because you clicked a
wrong input port, select and hold the CTRL key (or SHIFT key) and
click the input port. The connecting line is attached to the cursor
and can be connected with the correct input port.
To delete the connection, remove the connecting line from the
input port and select the ESC key or click in the workspace.
Tip: Each connecting line has a shortcut menu (see "Editing
connecting lines" on page 22). By using the options on this
shortcut menu, you can change the start (output port) and end
(input port) of the connecting line or delete the connecting line.
Allplan Visual Scripting Your first attempt at scripting - part 2 31
6 Specify how far from one another you want to place the circles.
Open the properties of Distance and enter X = 2 m.
As you entered the Distance immediately after the Count
(number of placements), you automatically closed the Count box
by opening the Distance box.
32 Interplay between Allplan Visual Scripting and Allplan Allplan 2020
9 Allplan displays the circles in red. This means that the circles are
preview objects. If you closed the script now, there would be no
model data. To create model objects in Allplan, you need to add
this information to the nodes. To do this, select the Create model
objects button in the settings area of each node. By selecting this
button in the Circle3D node, you create the initial circle as a model
object in Allplan. By selecting this button in the PlaceByVector
node, you create the three copies of the circle as model data in
Allplan.
34 Interplay between Allplan Visual Scripting and Allplan Allplan 2020
Modifying parameters
Before you complete your small script, let’s see how you can change
parameters both in the script and in Allplan.
At the moment, the Allplan Visual Scripting window is open and the
result of the script is visible in Allplan. In this situation, you can change
parameters in various ways:
• Use the script.
• Use the NodeScript palette of Allplan.
• Use the object in the workspace of Allplan.
For example:
To modify parameters
You want to change the radius of the circle.
To do this, you can
• Enter the required value in the 3D circle area in the
NodeScript palette of Allplan (1).
or
• Enter the required value in the yellow box of the circle in the
workspace of Allplan (2).
or
• Change the radius by dragging the handle of the circle (3).
or
• Enter the required radius by opening the properties of the
Radius parameter in the Circle3D node in the workspace of
the Allplan Visual Scripting window (4).
Allplan Visual Scripting Your first attempt at scripting - part 2 37
The Allplan Visual Scripting window closes. You are in Allplan. The
drawing file with the scripted object is open.
Note: If you have not changed the script after you saved it, the
dialog box only asks whether you want to save the object:
Examples provided
Allplan comes with various scripted examples. You can find them in
the following Allplan path: ETC\Examples\VisualScripting
For example:
The script appears in the workspace. You can see the path of the
selected object on the title bar of the Allplan Visual Scripting
window.
4 Click Start.
5 The dialog line of Allplan prompts you to enter a 3D line. Draw the
line in the workspace. As an alternative, define the line by entering
dx, dy and dz in the dialog line.
42 Modifying parameters Allplan 2020
Note: The Save As dialog box also opens when you select the
Save tool. This ensures that you do not inadvertently
overwrite the examples.
7 When you close the Allplan Visual Scripting window, decide
whether you want to save the object in Allplan.
Decide whether you want to save only the script or both the
script and the object.
44 Allplan 2020
Allplan Visual Scripting Index 45
Index
A O
Allplan Visual Scripting 4 output window 6
library palette 8
selecting script view 10
Q
toolbar 6 quick input 10, 29
user interface 5 R
workspace 10
resizing 5, 25
C
S
components of a script 11, 20
connecting lines script
changing 22 creating 6, 25
creating 20, 29 displaying 10
definition 20 running 6, 23
deleting 22 save as 40
editing 22 save with object 38
reconnecting 22 saving 6, 29, 38
starting 6, 23, 25, 29, 40
D search 8, 10, 25
displaying the script 10 V
M visual programming 3
modifying parameters 36
Z
N zoom selection 10, 25
nodes zooming 10, 29
creating model objects 29
creating preview objects 11, 29
definition 11
deleting 22
entering properties 29
handling 18
modifying parameters 36
structure 11
types 18
NodeScript palette in Allplan
modifying parameters 36
renaming areas 28, 29
renaming parameters 28, 29
visibility of parameters 11