passing name

i tried to pass a name to a function but it does like when pass directly !

name= [‘bev1’ ]
and pass directly as setBevOb(‘bev1’) does not work
but if i write it as setBevOb (name[0]) then it works!

if i pass the name directly it does not recognise it ?

why is there a difference between theses 2

Thanks for any help on this

I think it is because you are trying to give it a string in the first occasion and you are giving it a list in the second.

Does setBevOb([‘bev1’]) work?

first one

setBevOb(‘bev1’) does not work
‘bev1’ is the real object name
but does not recognise it as a name of object

second case

name= [‘bev1’ ] the name is inside a list of names
setBevOb (name[0]) pass the list number to get the name of the object

and this one is working!

i mean the 2 seems the same to me
but it’s not the same why ?

i mean num[0] is equal to the name of the object ?

i can give a small script for this testing but it’s basically the same than up here

it has something to od with how the get data inside a list i think
but not certain about it !

Thanks

You have assigned a string to setBevOb. The documentation says it should be a “Curve type Blender Object”, that is not the name of the object but the object itself.

setBevOb(object)

              Assign a Bevel Object (BevOb) to the Curve.  Passing None as the    object parameter removes the bevel.

Parameters:

  • object (Curve type Blender Object) - Blender Object to assign as Bevel Object (BevOb)

ok but is there a way to pass the object directly or only indirectly

i know how to make it work indirectly - see second example

but i would like to do it directly but how and if it’s possible at all!

Thanks

Your second example assigns a string as well, so this should not work, unless it is an undocumented feature. A string is a sequence of letters. It has no more meaning then that. For it to have meaning, setBevOb would have to get the blender curve object with the matching name. But nowhere in the documentation is it stated that setBevOb can take a string parameter, and get the object with that name. So it appears that the program needs to do this for setBevOb.

I have not used curves yet, but I presume from the documentation it could be done as such:

from Blender import Curve

cu = Curve.New() # for a new curve object
cu = Curve.Get(‘name’) # for an existing curve object

cu is then the curve object to be used in setBevOb

setBevOb(cu)

ok got it to work another way

like you’v shown

at beginning i had theses

NewCurve1 = Curve.New( ‘Curvebevel’ )
CurveOb1 = scn.objects.new( NewCurve1 )

so by putting the object name it work fine CurveOb1

like this one here -

NewCurve.setBevOb(CurveOb1) # set the bevel curve

one problem :

but that still does not explain why in the first case it is able to convert from the name to the object name ( from bev1 to CurveOb1 )

there is a conversion done that i don’t understand how it is done in one case but not in the other case ?
passing the name through a list and it’s ok
but directly it does not do the conversion!

sorry i’m trying to have a better understanding of theses conversion
which in this case seems a little strange!

also i look at the 2.5 API and seems that everything ahs been change for other names
and that all script will hve to be re written
have you seen any doc or tut on this yet ?

Thanks for the help