> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Script Tip Friday - Plot Design Point (DP) Results

This Script Tip Friday is brought to you by [Christoffer Eriksson](https://www.linkedin.com/in/christoffer-eriksson-472a21182?miniProfileUrn=urn%3Ali%3Afs_miniProfile%3AACoAACs4w1YBMgF_zx7An1oPJqBVdpfCd6H1pnw\&lipi=urn%3Ali%3Apage%3Ad_flagship3_pulse_read%3BLxTwPZTHQu6%2FHNG7wv33wg%3D%3D), who is an Application Developer at EDRMedeso, an Ansys Elite Channel Partner.

![](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/resources/articles/images/Christoffer.PNG?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=63d2fb0ab217e9e27e44e46dafbbb0dd)

Christoffer's tip will cover how to plot design point (DP) results using PyDPF. When running parametric simulations, it can often be of value to examine results(s) from each design point to validate the inputs from a graphical point of view (i.e., to get a quick overview). This PyDPF example shows a simple way to plot a deformation result for four design points (DP) in the same window.

The plot below shows the displacement result on the named selection 'MYBODY' for DP0. The aim here is to plot the displacement result on 'MYBODY' for all 4 DPs (dp0, dp1, dp2 and dp3) and line up the results next to each other.

![](https://developer.ansys.com/sites/default/files/inline-images/pic21.png)

Import the DPF-Core module and the Dpf-Plotter.

```python theme={null}
from ansys.dpf import core as dpf
from ansys.dpf.core.plotter import DpfPlotter
import os
plotter = DpfPlotter()
```

Then, extract DP folders from project\_files and place in dictionary.

```python theme={null}
projectFolder = "C:\\Temp\\dpresultsDPF_files\\"
fileList = os.listdir(projectFolder)
dp_dict = {}

for fileName in fileList:
  if 'dp' in fileName:
      dp_dict[fileName] = projectFolder + fileName + "\\SYS\\MECH\\file.rst"
```

Next, loop over all DPs.

```python theme={null}
for i, dp in enumerate(dp_dict.keys()):
    ...
```

Extract current DP and read the corresponding result file.

```python theme={null}
    ...
    rstFilePath = dp_dict[dp]
    model = dpf.Model(rstFilePath)
    Names Selection scoping to 'MYBODY'

    ns_op=dpf.operators.scoping.on_named_selection(requested_location='Element',named_selection_name='MYBODY',data_sources=model)
    ...
```

Extract global mesh.

```python theme={null}
    ...
    myGlobalMesh = model.metadata.meshed_region
    ...
```

Create 'skin mesh' to reduce computational time (more necessary when plotting results from different time steps, since we then need to copy the mesh).

```python theme={null}
    ...
    mesh_skin = dpf.operators.mesh.skin()
    mesh_skin.inputs.mesh.connect(myGlobalMesh)
    mesh_skin.inputs.mesh_scoping.connect(ns_op)
    result_mesh = mesh_skin.outputs.mesh()
    ...
```

Get displacement field for current DP from displacement fields container

```python theme={null}
    ...
    displacement_operator = model.results.displacement()
    displacement_operator.inputs.data_sources.connect(model)
    displacement_operator.inputs.mesh.connect(result_mesh)
    displacement_set = displacement_operator.outputs.fields_container()[0]
    ...
```

Translate the mesh (here in `100*i * (-Y)` direction). The mesh from DP0 (the first DP) will be kept in its original place since i = 0. DP1 will be translated `-100*1 = -100` mm in negative Y, DP2 will be translated `-100*2 = -200` mm in negative Y,

```python theme={null}
    ...
    overall_field = dpf.fields_factory.create_3d_vector_field(1, dpf.locations.overall)
    overall_field.append([0.0, -100*i, 0.0], 1)
    coordinates_to_update = result_mesh.nodes.coordinates_field
    add_operator = dpf.operators.math.add(coordinates_to_update, overall_field)
    coordinates_updated = add_operator.outputs.field()
    coordinates_to_update.data = coordinates_updated.data
    ...
```

Add current DP field result (displacement\_set,result\_mesh) to plotter.

```python theme={null}
    ...
    plotter.add_field(
            displacement_set,
            result_mesh,
            show_max = False,
            show_min = False,
            label_text_size = 15,
            label_point_size = 1,
            )
    ...
```

Place a label on any node (here, the first node in the result\_mesh.nodes list) with text = str(dp)

```python theme={null}
    ...
    node = [result_mesh.nodes[0]]
    label = [dp]

    plotter.add_node_labels(
        node,
        result_mesh,
        label,
        italic=True,
        bold=True,
        font_size=26,
        text_color="white",
        font_family="courier",
        shadow=True,
        point_color="grey",
        point_size=1,
        )
    ...
```

Plot the final solution.

```python theme={null}
plotter.show_figure(show_axes=True)
```

![](https://mintcdn.com/synopsys-00a47cbc/Srh1_f--TdKCLyqD/resources/articles/images/pic22.png?fit=max\&auto=format\&n=Srh1_f--TdKCLyqD\&q=85\&s=f2076973287aa86b64311f3ac4132c50)
