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
But my head limit ~~
Pls again help ~
Forum topic · Scripts Wanted
By dussla · 2019-01-08
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
But my head limit ~~
Pls again help ~
.
jahman · 2019-01-08
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
dussla · 2019-01-09
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
)
)
thank you for good advice
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
.
jahman · 2019-01-09
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
dussla · 2019-01-09
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.
.
jahman · 2019-01-09
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
there's already the answer in your own question
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
dussla · 2019-01-09
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 ~
.
jahman · 2019-01-09
setKnotSelection shp i (#{(amin sel)..(amax sel)} as array) keep:trueturns to
setSegSelection shp i (#{(amin sel)..(amax sel - 1)} as array) keep:truewow fantastic
dussla · 2019-01-09
really sorry for my very stupid
code is very good good good ~
really thank you again