Grasshopper

algorithmic modeling for Rhino

Hi, guys, i have a weird problem.

i defined a function, and test it. it totally work.

but when i call this function, an error occurred. but i 've never met the problem before.

can anyone tell me why?

Views: 396

Replies to This Discussion

Can you upload the gh file? and I can try test it.

T

Attachments:

Aroving,

It seems to be failing because you haven't imported System.Object so when you say 

"outTree = DataTree[object]()" Python doesn't know what object is.

I got your code to work by putting 'from System import Object' in the top line of your script. Also note it's case sensitive so you'd need to change the 'object' in line 6 to 'Object'.

EDIT: Okay something very odd going on. It worked when I wrote it from scratch, however after I opened your script to check it worked in your function it started getting the __index__ error. In your script AND the one I wrote from scratch. The only way I could get it t work properly was to close grasshopper and rhino and open it again... Maybe there is something wrong with your file? What version of Python are you using - if not the latest I would update your python component.

hello McDonnell, sorry so late to reply your message. Thanks for your patience. But i still have a problem want to figure out. In outTree = DataTree[Object](), what does Object stands for? the input data type or the output data type??? I once used Object for a list and it works. so, can Object stands for all type?

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service