🏛️ Bundle 2023-07
Add displays to your bot

Add displays to your Bot

This page explains how to add displays to the workflow so that they appear when the user opens the results of their workflow run.

1. The different displays

There are four displays that you can add to your workflow:

  • Markdown: This can be used to present what the bot does or to present the results in text format.
  • Multiplot: This is a graph that represents the relationship between the data of your object.
  • Plot_data: This allows the representation of an object in 2D view.
  • Cadview: This allows the representation of an object in 3D format.

2. How to add displays to your bot

  1. First, you have to implement a plot_data function (e.g. 2D plot) or volmdlr_primitives for CAD in your code.
  2. After coding your functions, you can add blocks to your workflow that allow you to read these functions.
  3. By clicking on the three dots of the workflow identification card, you can open a small modal page and then click on "Edit" to modify your workflow and add display blocks.

Edit

  1. By clicking on Edit, you will be redirected to the page where you can edit your workflow. In this example, we see our workflow with different blocks (methods, class) and we will add display blocks.

WFB

  1. To add a block, click on the "Add Block" button. This will open a drop-down menu where you can select the type of block to add.

Add block1

Add block2

In this example, we will present the installation of the four blocks of displays presented above. Before that, we will talk about the output results and the workflow. At the output, we have a list of "objects" represented by the block named "extract", as we can see with the red dot at the output of this block.

Extract

Markdown: We will add the markdown on the output of the block named "DATASET". This block contains all the solutions and is represented by the class named "DataSet". By clicking on "Add Block" and then "Markdown", a new window opens which allows you to fill in a few fields.

  1. Reset form: This allows you to go back by deleting the filled fields.
  2. Diff: By clicking on Diff, a window opens allowing you to see the modifications made in your form.
  3. Close: This closes the form.
  4. Save: This allows you to save the new block and have it in your workflow.
  5. Name: This represents the name of your block.
  6. Position: This represents the position of the blocks in the workflow.

Markdown1

By clicking on Save, the block will be added to your workflow and you just have to attach its input to the output of the previous block.

Markdown2

Multiplot: We will add the multiplot on the output of the block named "extract". This block contains all the solutions and is represented by a list. The multiplot block has as input a list of objects to make a graph that represents the relationship between the data of your objects.

  1. Attributes: This represents the attribute list of your object (an object from your list output) in this example, the attribute list of an object from the list output from the block named "extract". In other words, it represents the characteristics of the object (e.g. length, width, mass...).
  2. Order: This is an optional parameter that shows the order of the parameters that we will put in our scatter plot. If we put 0 in our scatter plot, we will have the first parameter and the second. If we put 1, we will have the second and the third, and so on.

Multiplot

Once all the fields are filled, we save and we link the input of the new block, in this case, it is a list of objects.

Pipe

Plot_data: This block allows the representation of an object in 2D view. At the output of our workflow, we have a list of objects. For this, we will extract a solution from this list using the Unpacker block. Then we will add the block plot_data.

For this example, we take the first solution (the index 0 of our output list).

Plotdata1

Name: This represents the name of your block.

The plot_data block does not require parameters in its input (like Markdown). It depends on what function you have programmed for your object.

Plotdata2

Pipe2

Cadview: This block allows the representation of an object in 3D view. We will present the 3D view of the first object of the output list. The cadview block does not require parameters in its input (like Markdown or plot_data). It depends on what function you have programmed for your object.

Cadview

Pipe3

This is what the new version of the workflow looks like after adding the display blocks. You just have to launch it to see the result after adding the display blocks.

Workflow

3. Displays in the WorkflowRun page

After launching your new workflow, you open the result page. On this page, you will see the names of your new blocks appear in the part named DISPLAYS. The first two displays are by default. They represent the workflow documentation and the workflow, respectively. By checking the desired box, the display is shown. You can also display the display while checking the very first box.

Displays

Markdown:

Display markdown

Multiplot:

Display multiplot

Note that the displayed solution for this workflow in plot_data and cadview is random. If you want to visualize another solution, you can select many solutions in multiplot and then click to display them.

Display multiplot2

Display multiplot3

Plot_data:

Display plot_data

CAD view:

Display CADview

Go to the chapter Master 2D and 3D displays to learn more about display manipulation.