GH Python Guid Error


(Jessyesterday) #1

I’m having a weird error in one of the Python components of the GH file I’m attaching to this. The component ‘Cluster’ is taking polygons and grouping them in sequence; the number in each group is determined by a number slider. The component ‘Single Cluster Algo’ then separates any polygon groupings that aren’t touching the rest of their group.

This feature is working perfectly fine if I have the number slider set to anything less than 9 it seems, but if I try inputting a larger number, I get this runtime error:
1. Solution exception: Parameter must be a Guid or a string representing a Guid

I’m not sure what this means or why I only get this error sometimes, and other times it works perfectly. Any help is greatly appreciated.

See the screenshots included for successful and unsuccessful outcomes.

Thanks!

Python Error.gh (801.6 KB)
Test.3dm (9.8 MB)


#2

@jessyesterday,

the method rs.DuplicateMeshBorder returns a list of border polylines. So you’re passing a list of polylines to rs.ConvertCurveToPolyline which results in the error, it expects a single curve GUID.

btw. do not understand why you’re trying to convert polylines (mesh borders) to a polyline. There is nothing to convert. You might just remove line 26 and change line 25 and 27 to this:

mesh_borders = rs.DuplicateMeshBorder(mesh)
if mesh_borders:
    border.extend(mesh_borders)

_
c.


(Jessyesterday) #3

That solution seems to have done it! I’m not well-versed in Python, so this script is a combination of many different people helping me.

Thanks!