ScriptSpot home

Forum topic · General Scripting

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

By Nikolay Litvinov · 2015-03-01

Description

please tell me

Comments (7)
Hernan Rodenstein

Advanced spline sub-object manager

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

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

miauu

.

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

Reply to miauu
Nikolay Litvinov

ok

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

Reply to miauu
Nikolay Litvinov
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

.

- 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)
    )
)

Reply to miauu
Nikolay Litvinov

As he himself did not guessed


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!