### Using vectors as arguments for pt3dadd

Posted:

**Mon Mar 02, 2020 3:46 pm**Looking through the documentation for pt3dadd, I see:

Gives the error
While I get other errors when trying the following:
I'm using Neuron 7.7.2:
What am I doing incorrectly when trying to supply vectors instead of scalars as arguments to pt3dadd?

I am struggling with implementing this when I have a list of values for, say, 4 points that I want to add:h.pt3dadd(xvec, yvec, zvec, dvec, sec=section)

...

Add the 3d location and diameter point (or points in the second form) at the end of the current pt3d list

...

Note: A more object-oriented approach is to use sec.pt3dclear() instead.

Code: Select all

```
from neuron import h, gui
import numpy as np
dend=h.Section(name='dend')
dend.pt3dclear()
xvec=h.Vector(np.array([-0.72,-0.72,-0.72,-0.72]))
yvec=h.Vector(np.array([-16.42,-18.16,-22.14,-24.13]))
zvec=h.Vector(np.array([0.0,0.0,0.0,0.0]))
dvec=h.Vector(np.array([2.4,2.2,2.0,1.96]))
dend.pt3dadd(xvec, yvec, zvec, dvec)
```

I get the same error with:TypeError: must be real number, not hoc.HocObject

Code: Select all

`xvec=h.Vector([-0.72,-0.72,-0.72,-0.72])`

Code: Select all

```
xvec=[-0.72,-0.72,-0.72,-0.72] # gives the error: must be real number, not list
xvec=np.array([-0.72,-0.72,-0.72,-0.72]) # gives the error: TypeError: only size-1 arrays can be converted to Python scalars
```

Code: Select all

```
print(neuron.version)
7.7.2
```