# to select spline vertex between 2 vertex

First of all, I'm sorry to have asked a lot of questions.

The code I'm looking for :

pick two vertices in spline
Then select the vertices in between.

I thought many time

Pls again help ~

## Comment viewing options

### .

```for each spline in splinshape
1. get selected spline knots
2. if more than one knot is selected find min and max knot index
3. create bitarray with range min to max knot index
4. set knot selection using this bitarray```

done

### thank you 1 more question

selindex = #()

for s = 1 to (numSplines \$) do
(

for v in (getKnotSelection \$ s) do

(
append selindex v

minpoint = amin selindex
maxpoint = amax selindex

betweenvertexnum = (( maxpoint - minpoint ) + 1 )

local kArray = #{minpoint..(betweenvertexnum + 1)} as array

setKnotSelection \$ s kArray keep:true
)

)

i made this code all day long

one more question

like \$.EditablePoly.ConvertSelectionToBorder #Vertex #Edge

how can i change with knot -> segment selection in spline ?

thank you really

### .

```for i=1 to numsplines shp where (sel = getKnotSelection shp i).numberSet > 1 do
(
sel = sel as array
setKnotSelection shp i (#{(amin sel)..(amax sel)} as array) keep:true
)```

Ok. Make a circle. Select all 4 knots.
What segments do you expect to be selected after conversion?

### thank you

I run your code and get an error
So I run it again with my code.
If you look at the attached image
1. Works well with open splines
But with closed splines, the operation sometimes fails.
What is the reason?

2. When tested in a circle, all are selected
But I do not use these shapes because I do not use them

3. For example,
There is spline with knot1 ~ knot20
If I select knot 1 ~ knot 10
I want to switch the selected vertices between them to segment select

But you do not have to consider the direction.

AttachmentSize
spline_select.gif 2.18 MB

### .

I forgot that getKnotSelection returns an array
heres the code

```for i=1 to numsplines shp where (sel = getKnotSelection shp i).count > 1 do
(
setKnotSelection shp i (#{(amin sel)..(amax sel)} as array) keep:true
)```

so.. you want to select segments between 1 to 10
segments 1,2,3,4,5,6,7,8,9 are gonna be selected and 10 will not.
you have min index and max index. make bitarray out of it, convert to array and set edge selection

### thank you again

Good code too thank you
But I do not understand a little.
This is my limit.

"make bitarray out of it, convert to array and set edge selection"

sorry , i did not understand well ~

### .

`setKnotSelection shp i (#{(amin sel)..(amax sel)} as array) keep:true`
turns to
`setSegSelection shp i (#{(amin sel)..(amax sel - 1)} as array) keep:true`

### wow fantastic

really sorry for my very stupid

code is very good good good ~

really thank you again