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

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

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

Nik's picture

ok

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

miauu's picture

.

What do you mean?

Nik's picture

getSegSelection

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's picture

.

- 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)
    )
)
Nik's picture

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!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.