Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

Rhino point with no object name

$
0
0

I have a list of 3d points in rhino 8 workspace some don’t have Names so when I interrogate the points in a list for their name I get returned a “None” value so I want to give the point a random number name. No matter how I try I keep getting the error message that "the parameter must be a Guid or a string representing etc " but if you print AssocPt it is a Guid so why doesn’t rhino see it as one. I have tried so many permutation including coerceguid to no avail any help will be greatly appreciated.

Spoints = rs.GetObjects("Pick some points", rs.filter.point)

AssocPts = rs.CopyObjects(Spoints, translation=None)

for AssocPt in AssocPts:

    #objectname = rs.ObjectName(rs.coerceguid(str(AssocPt)))
    if rs.ObjectName(str(AssocPt)) is None: rs.ObjectName(str(AssocPt),"No name")

         
    if rs.ObjectName(str(AssocPt)) == "No name":
        ASname = rs.ObjectName(str(AssocPt), id_generator() )
        ASname = rs.ObjectName(AssocPt)
        AssocPts.append(ASname)
        print( "Random gen name =", ASname)
            
    else:
            
        #rs.ObjectName(AssocPt,rs.ObjectName(AssocPt))
        ASname = rs.ObjectName(AssocPt)
        AssocPts.append(ASname)
        print ("Exisiting name =", ASname)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles