Array.append() or array.extend()?



I am trying to pass the intersection of some planes with a brep from a python script to an Extrude component, using the IntersectBreps() function of rhinoscriptsyntax and appending to an array, as shown in the screenshot:

The Extrude component is generating the error: “Data conversion failed from Goo to Geometry

The screenshot below shows how the data is received by the Extrude component:

The screenshot below shows how it looks like if just the planes are exported to the Extrude component and it extrudes them successfully:

But what is required is to have the intersection curves of these planes and the rhino geometry to be extruded.

If this extrusion is performed within the python script, it fails as show below:

The balloon error is as below:

How can the array of the results of rhinoscriptsyntax.IntersectBreps(brep1, brep2) be passed to the Extrude component OR this extrusion be performed within the python script itself?

Thank you.


If you only need a flatten list of all intersections, it’s better to do it like this:

    breps.extend(brepResult) (45.5 KB)


Thank you @Mahdiyar.

It worked by replacing breps.append(brepResult) with breps.extend(brepResult)
if(brepResult): was necessary to avoid the TypeErrorException: NoneType is not iterable (as shown below)

Then I tried to extrude the resulting breps and create the array again as:
but it threw:
Runtime error (TypeErrorException): Guid is not iterable

Replacing extend with append worked this time though:

So now I’m confused as to which entities do extend and append apply to?


rs.IntersectBreps() returns a list of guid whenever the input breps intersected each other.
rs.ExtrudeCurve() return a single guid whenever the extrusion was successful.
both of these functions return none if there was any problem.

If you want to add a list to another list you have to use extend but if you want to add a single item to a list you have to use append.


Thanks @Mahdiyar, this clarifies it.

Even when there is just a single intersection?


Yes, if there was a single intersection, this function would return a list with only one item in it.


Okay. Thanks a lot! :slightly_smiling_face: