Notifications
Clear all

[Closed] Unique id for splines

do all objsects ie splines have unique identification. If so how do i access it and store it in a variable.

regards

Nebille

2 Replies

Hi Nebille,

You can access objects by name:

$myspline01

you can assign a node to a variable:

x=$myspline
x.name

If you want to access the sob onject splines of a aplineshape, they are numbered ie 1, 2, 3… and this is the same as the number you see in the sub object spline level when you select one spline.
This script takes the first object in the selection (hopefully an editable spline! and makes an array containing the positions of all of the selected vertices)


--make array of selected knot poisitions
vr=#()
spl=selection[1]
for i=1 to spl.numsplines do
(
 v=getknotselection spl i
 for j=1 to v.count do
 (
  append kn (getknotpoint spl i j) 
 )
)


Hi Josh

Thanks for the help. I have written a script below and wondered if you could tell me why it is not working. regards Nebille

–create lines in top view. Clone some lines so they lay on top of each other as copies.
–put lines in a named selection set called MyLines

– This script should check for lines occupying the same space and delete the doubles.

myset = selectionSets[“MyLines”]

mycount = myset.count

wow = 0

for i = 1 to mycount do

(—begin i loop

myspline = myset[i]

fstpnt = getknotpoint myspline 1 1

fstX = fstpnt.x

fstY = fstpnt.y

lstpnt = getknotpoint myspline 1 (numknots myspline)

lstX = lstpnt.x

lstY = lstpnt.Y

myspline.name

for j = 1 to mycount do

(—begin j loop

mysplineCompare = myset[j]

mysplineCompare.name

( if myspline.name == mysplineCompare.name do continue )

newfstpnt = getknotpoint mysplineCompare 1 1

newfstX = newfstpnt.x

newfstY = newfstpnt.y

newlstpnt = getknotpoint mysplineCompare 1 (numknots mysplineCompare)

newlstX = newlstpnt.x

newlstY = newlstpnt.y

if fstX == newfstX then ( wow = wow + 1 )

if fstY == newfstY then ( wow = wow + 1 )

if lstX == newlstX then ( wow = wow + 1 )

if lstY == newlstY then ( wow = wow + 1 )

if wow == 4 then (select mysplineCompare)

[color=white]delete mysplineCompare — when this is greened out the script runs ok?

[/color]–Select All

wow = 0

)—end j loop

)—end i loop