Grasshopper

algorithmic modeling for Rhino

Python: longer version of Rhino.Geometry.CreatePatch expected IEnumerable[GeometryBase], got list?

There are three CreatePatch commands in Rhinocommon:

http://4.rhino3d.com/5/rhinocommon/?topic=html/Overload_Rhino_Geome...

Two of them work normally but the pro version with full control won't take the same list of curves as the others?! The starting surface works fine too with the version that only takes a starting surface instead of the full list of options, so really it's the Curves input that is saying my list isn't an IEnumerable. Not a common error as far as Google lets on.

Printing Curves gives:

[<Rhino.Geometry.NurbsCurve object at 0x00000000000007E0 [Rhino.Geometry.NurbsCurve]>, <Rhino.Geometry.NurbsCurve object at 0x00000000000007E1 [Rhino.Geometry.NurbsCurve]>]

Views: 3048

Replies to This Discussion

Nice tutorial.

General question: do you know what sort of Rhinocommon container I can place arbitrary geometry for feeding into CreatePatch? I'm stuck with curves, using:

CURVES_CONTAINER = Rhino.Collections.CurveList()

I have to create a Rhino container to escape an IEnumerate error.

Yikes ... but the patch C# thingy provided ... er ... hmm ... does that or not?

You are lost in the P cyber space (wrong language, he he [ hoping that no P aficionado reads this]). The only way the C# way IS (Top Dog Jedi Master YodaTheLimeGreen claims that).

Any List or Array can cut the mustard on that matter, but I'll try to find some more "simple" patch demos in some home workstation (I'm away from the source of all sources: the practice).

In the mean time try to solve the flip/swap puzzle and get the juicy sardines, he he.

I think you can create a .NET list of GeometryBase and feed it to createpatch: 

from System.Collections.Generic import List
import Rhino.Geometry

myContainer = List[GeometryBase]()

myContainer.Add(SomeCurveOrMesh)

Here's a more complete example based on your posted file of how to use the full version of CreatePatch in python:

import Rhino
from System import Array
from Rhino.Geometry import GeometryBase
from System.Collections.Generic import List

DotNetCollection = List[GeometryBase]()
DotNetCollection.AddRange(Curves)
fixEdges = Array[bool]([False,False,False,False])
P = Rhino.Geometry.Brep.CreatePatch(DotNetCollection,Starting_Surface,10,10,True,False,10,30,0,fixEdges,1)

BTW: With regard samples et all per Method - when available - try Rhino 6 SDK (not on par - by any means - with what Bentley Systems delivers for Generative Components ... but a big improvement VS R5 SDK).

If the weird black mini Icon (kinda some stacked "lines") appears on the Method link it means that some sample code is available (see GetObjects Method, for instance).

Oh, my, so I found at least a curve container in Rhino.Collections, and I can get past the first error as long as I'm just using various curves, with:

CURVES_CONTAINER = Rhino.Collections.CurveList()
for c in Curves:
CURVES_CONTAINER.Add(c)

Then I get a new error that's better explained but not in detail. One of the Boolean flags is expected to be an *array* of four Booleans (True/False).

More work....

Menno over at the discourse link posted this simple answer, confirming Andrew's first answer:

"Instead of using a Python list, use a .NET generic list."

from System.Collections.Generic import List

geomBaseList = List[GeometryBase]()
# add stuff to list (curves, points)

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service