ScriptSpot

Forum topic · General Scripting

How to select Knots Using Segment of Spline? Or How to convert selection Segment to Knots?

By Nik · 2015-03-01

Description

please tell me

Comments (7)

Advanced spline sub-object manager

rode3d · 2019-02-20

Here's a great plugin for managing subobject selections and material IDs for editable splines.

SubSpline: http://www.splinedynamics.com/subspline/

.

miauu · 2015-03-02

Easy

If segIdx is the index of the segment

for open spline the knots always are:

knot1 = segIdx
knot2 = SegIdx + 1

For closed spline:
last segment have knots
knot1 = 1
knot2 = segIdx

the rest segments have knots idx the same as open spline

ok

Nik · 2015-03-05

but how to access to segments without selecting splines (subobject 3)?

.

miauu · 2015-03-05

What do you mean?

Nik · 2015-03-06

getSegSelection $ <spline_index_integer>
spline_index_integer=(getSplineSelection $)[1]

- to get the segment you want to select the spline :(
- чтобы получить сегмент нужно выделить сплайн :(
I need this for my Subobjects Converter
Мне это надо для моего Subobjects Converter

.

miauu · 2015-03-06

- to get the segment you want to select the spline :(

No. Create a spline, select some segments. The name of the spline should be Shape001. Deselect the spline and run this code:



(
    curSpl = $Shape001
    getSegSelection curSpl 1
)

In the listener will be printed the indexes of the selected segments.

If you want to know how many splines the Shape001 have then this will gives you the answer:



numSplines $Shape001

So, using the following code will gives you the selected segments of all splines in the Shape001 when the Shape001 is not selected.



(
    curSpl = $Shape001
    subSplCnt = numSplines curSpl
   
    for ss = 1 to subSplCnt do
    (       
        format "splineIdx: % Selected segments: %\n" ss (getSegSelection curSpl ss)
    )
)

As he himself did not guessed

Nik · 2015-03-07


text isSelected:on
converttosplineShape $
ShapeObj  = $Text001
'Spl.Count' = numSplines ShapeObj
arSplSeg=for spl=1 to 'Spl.Count' collect  (getSegSelection ShapeObj spl)
--getSegSelection ShapeObj 1

Listener Return
$Text:Text001 @ [0.000000,0.000000,0.000000]
$Editable_Spline:Text001 @ [0.000000,0.000000,0.000000]
$Editable_Spline:Text001 @ [0.000000,0.000000,0.000000]
9
#(#(), #(), #(), #(), #(), #(), #(), #(), #())
OK

This is what need.
Kostadin, Thank you so much!