# Drawing points and lines with COMPAS for Blender

**URL:** <https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251>\
**Category:** compas\_blender\
**Created:** [August 9, 2019, 2:28pm UTC](https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251 "2019-08-09T14:28:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![solub](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@solub](https://forum.compas-framework.org/u/solub)\
**Post date:** [August 9, 2019, 2:28pm UTC](https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251/1 "2019-08-09T14:28:25Z")

</div>

Hi,

I’m really excited to start learning COMPAS and though the best way to get my head around was to port a couple of sketches I did in Processing.

To get me started I would like to know how to draw some points and lines in Blender, play with it, connect them, etc…

I see COMPAS has different classes named `compas_blender.utilities.` `draw_points`, `compas_blender.utilities.` `draw_pointcloud` or `VolMeshArtist.` `draw_points`. Could someone kindly explain:

- if they are appropriate to draw points (in Blender)
- how they differ
- how to use them

I tried the following (extracting vertices from a .obj and display them as points):

```
import compas

from compas_blender import utilities
from compas_blender.artists import NetworkArtist
from compas.datastructures import Network

# make a network from sample data

network = Network.from_obj(compas.get("C:/Users/solub/Desktop/rocket.obj"))

xyz = network.get_vertices_attributes(('x', 'y', 'z'))

utilities.draw_points(d)

```

… but got a `AttributeError: 'int' object has no attribute 'get'` . Does this mean I have to store the vertices in a dictionnary or convert the list array to another data type ?

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [August 9, 2019, 3:31pm UTC](https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251/2 "2019-08-09T15:31:41Z")

</div>

Hi @solub,

If you already have your geometry in a `Datastructure` like the `Network` in your example, it would be easiest to draw vertices using the `NetworkArtist`:

```python
import compas

from compas.datastructures import Network
from compas_blender.artists import NetworkArtist
from compas_blender.utilities import clear_layer

network = Network.from_obj(compas.get('grid_irregular.obj'))

artist = NetworkArtist(network=network, layer='Collection')

clear_layer(layer='Collection')

artist.draw_vertices(radius=0.1)
artist.draw_vertexlabels()

```

Blender doesnt have a **Point** type of object, so I plot the closest thing I could find, an **Empty** object, which you can change its size with the `radius` argument. The code above would produce the following:

 ![empties](https://us1.discourse-cdn.com/flex015/uploads/compas_framework1/original/1X/5f5b994f99ab42bf8dfa91a0f2e7e49e23e2f88a.png)

You are on the right track with the `draw_points()` function, you need to give it a _list_ of point _dict_ data, for example:

```python
import compas

from compas.datastructures import Network
from compas_blender.utilities import clear_layer
from compas_blender.utilities import draw_points

network = Network.from_obj(compas.get('grid_irregular.obj'))

xyz = network.get_vertices_attributes('xyz')

clear_layer(layer='Collection')

points = [{'pos': i, 'radius': 0.1} for i in xyz]

draw_points(points=points)

```

 ![empties](https://us1.discourse-cdn.com/flex015/uploads/compas_framework1/original/1X/5acdbbf7da9e61c5f24a0e78e65ff0f38bc93007.png)

If you use `draw_pointcloud(points=points)` instead (without `radius` which isn’t needed), you will get a bunch of **Mesh** objects with just one vertex, which will plot quite efficiently even for many thousands of points as Blender renders meshes efficiently. Your points then appear as a single vertex **Mesh** for each point.

 ![empties](https://us1.discourse-cdn.com/flex015/uploads/compas_framework1/original/1X/beb4b6f00ccbe72ebe219181f2ecb1fdc6603d4e.png)

---

<div class="post-metadata">

**Author:** ![solub](https://avatars.discourse-cdn.com/v4/letter/s/ad7895/32.png) [@solub](https://forum.compas-framework.org/u/solub)\
**Post date:** [August 9, 2019, 3:34pm UTC](https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251/3 "2019-08-09T15:34:15Z")

</div>

Thank you so much for the swift and comprehensive reply. That helps a lot.

---

<div class="post-metadata">

**Author:** ![andrewliew](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.compas-framework.org/andrewliew/32/88_2.png) [@andrewliew](https://forum.compas-framework.org/u/andrewliew)\
**Post date:** [August 9, 2019, 4:59pm UTC](https://forum.compas-framework.org/t/drawing-points-and-lines-with-compas-for-blender/251/4 "2019-08-09T16:59:04Z")

</div>

Very welcome. You could join all the mesh points in the last example with **CTRL+J** if you wanted one mesh.
