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

Iteration over non-sequence of type NoneType

$
0
0

@ivelin.peychev wrote:

I can’t figure out what is happening here:

import rhinoscriptsyntax as rs
import Rhino.Geometry as rg
import scriptcontext as sc


surfaces = rs.GetObjects("sel all",rs.filter.surface)
names = []
for srf_ids in surfaces:
    srf = rs.coercerhinoobject(srf_ids)
    
    names.append(srf.Attributes.Name)
normalized_names = list(dict.fromkeys(names))
set_names = list(set(names))


print normalized_names
print len(normalized_names)
print set_names
print len(set_names)
""""""
for i in range(len(surfaces)):
    for nm in normalized_names:
        ps = []
        for srf_ids in surfaces:
            
            srf = rs.coercerhinoobject(srf_ids)
            try:
                tmp = srf.Attributes.Name
                if tmp == nm:
                    ps.append(srf_ids)
            except:
                pass
        ps_id = rs.JoinSurfaces(ps,True)
        #ps_obj = rs.coercerhinoobject(ps_id)
        rs.ObjectName(ps_id,nm)

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles