algorithmic modeling for Rhino
Hi everyone,
I am trying to use the K2 Collider Goal in Python, but I am having hard times understanding what does a 'List[Object]' is.
This is the error I am getting when feeding in a list of Lines:
"Runtime error (ArgumentTypeException): expected List[object], got list".
I tried to check in the C# example goal in Daniel Piker GitHub (https://github.com/Dan-Piker/K2Goals/blob/master/Collisions.cs) but I am pretty new in scripting and I could not figure out which is the problem.
Any help would be much appreciated,
Thanks.
Luca
Tags:
It's referring to the .NET generic list type. To instantiate one using IronPython you can do like so:
# Import the type
from System.Collections.Generic import List
# Instantiate a list
myDotNetList = List[object]()
Edit: Object might be capitalized, I forget. Also, If you're making a list which contains a specific type (like say, Kangaroo2 goals) you might want to declare this instead of object (for instance: ks.IGoal with the KangarooSolver.dll imported under the alias ks).
Wow, cool!
And seems like object doesn't need to be capitalised.
Cheers,
Mange tak
EDIT: I get the following error.
Runtime error (NullReferenceException): Object reference not set to an instance of an object.
But if I capitalise Object, then it simply says:
expected Array[Type], got list
Think we'll need a definition to troubleshoot further, otherwise it'd just be guesswork. Or, pop downstairs :)
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by