Grasshopper

algorithmic modeling for Rhino

Just curious as to what the rules of thumb are when creating a User object, cluster, or component how much should the path change afterwards if the component is not one that changes data structure?

example. Should (0;0) become (0;0;0) or stay (0;0).

Some Gh components add one path while others keep the path length, but I cant see the clear rules. Would be nice for some more explanation. Thanks.

Views: 332

Replies to This Discussion

The rules are quite complex and sometimes change per version, but there are two important reasons for the behaviour:

  1. The ways datatrees change should be predictable per component. I.e. if you provide a single number the output should not differ fundamentally from when you provide two numbers as input.
  2. A component should not destroy information stored in datatrees, as they are a sort of history record telling you where data came from.

The current logic is outlined in this document.

In short:

  • If all inputs have item access and all outputs have item access then the datatree layout is copied from the master input parameter.
  • If all inputs have list access and all outputs have list access, then the datatree layout is copied from the master input parameter.
  • If some inputs have item while some outputs have list access, those outputs will have their trees grown by one layer.
  • Input and outputs which have tree access are completely at the mercy of the component and their behaviour will differ on a per component basis.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Thanks a lot this really helped. The reason I ask is sometimes when making lengthy definitions my list can grow from say (0;0) to (0;0;0;0;0;0) which is fine, but when I package as a user object I want the output to be either (0;0) or (0;0;0) depending on as you say on inputs and outputs. So I wanted to be sure I was formatting correctly as simplify isn't the best solution in this situation. Thanks again. 

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service