Grasshopper

generative modeling for Rhino

Hi,

 

I'm using the python component for grasshopper, and have wondered to access to the data structure which grasshopper consists. 

 

using a=ghdoc seems to be efficient for output, but I can't get the right data structure as input.

 

anything will help.

 

I'm sure that I'm using the latest component(v0.4.1.1)

 

Tags: datatree, item, list, python

Views: 3527

Reply to This

Replies to This Discussion

Hi Guilio.

Is there and overview of functions to call for the DataTree? Like here you mention .AddRange and .Add. Is there some documentation somewhere?

 

If there was a help dropdown list it would be great, but I don't get that.

 

Thanks Rasmus

You get dropdowns when you write a type. Check out signatures by using Python's type.method(self, [args])
syntax for calls. Later you can change it to

self.method([args])
which is more object-oriented.

Also, here you can read about the way to download the Grasshopper SDK.
I hope this helps

Giulio

--

Giulio Piacentino
Piacentino Consulenze

Could you upgrade that file Giulio??

I am quite struggling with the data trees in python but i cannot see your code here  because the component is old and it appears empty

Hi Manuel!

Steve is the maintainer of the GhPython component now. You might want to let him know of this problem. I fixed the script for you, so it will work in Gh 0.9.14 and GhPython 0.5.1.0.

I hope this helps!

Giulio

--

Giulio Piacentino
Weaverbird development

Attachments:

Thanks.

Will try not to bother you then with this stuff.

Regards from Barcelona Giulio

Well now and then it's nice to help if I am able to.

Thanks for the greetings, I salute back! :)

Giulio

--

Giulio Piacentino
Weaverbird development

Hi. 

It seems this is the right place to ask this question. I have similar problems. I am trying to merge two data trees, with branches consisting of points. 

I´m getting an output that I can't really use in grasshopper afterwards. (See picture) Any thoughts?

Cheers Rasmus

Attachments:

Hi Rasmus,

just as in the Vb.Net & C# components, you cannot return lists of lists. You need to create DataTree objects explicitly. This is how the Grasshopper SDK works and all scripting components must simply comply to this rule.

I'd suggest, if you can, to use list access or even item access if you can conceive a logic that can only require that. Also, I'd try to dissuade you from replicating the logic for tree components that are already available as this is a slightly hostile territory of the Grasshopper SDK: if you can, use the components that are already available.

Finally, from what I see, you can use item access and this code will suffice:

a = (Midpoint, Endpoint)

I will be on my way to the RhinoDay in Padua, so I might now be able to answer further questions till next week. An example using the internal iteration logic of Grasshopper is attached.

Thanks,

- Giulio
_______________
giulio@mcneel.com

Attachments:

Hi Giulio.

Thanks for answering me. It has been a while now, but I managed to work around the data tree because of your answer. Still thinks that it would be nice to be able to work with the tree structure though.

I can't seem to really use you definition, maybe it was created in earlier versions? :)

Im just curios to see what it is about now...

 

Cheers Rasmus

For some months already I am no longer the maintainer of the GhPython project. I thought to lend a hand though, so, here is an update for the uploaded file to Gh 0.9 and GhPython 0.5.1. The component seems not to behave correctly now when trying to change the presentation style, so maybe a workaround for now is not to change it.

Attachments:

RSS

Translate

Search Grasshopper

Photos

  • Add Photos
  • View All

© 2013   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service