algorithmic modeling for Rhino
Dont use print(). Print can be called several times per iteration, so from 1 iteration, it constructs a list.
If you assign a variable output, from 1 iteration you get 1 result...
I hope this makes sense,
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio,
Nevertheless is there a method to simplify the output. There is one for the inputs with TreeAccess so there should be probably a similar method for the outputs?
Thanks,
Mostapha
Hi Mostapha
I appreciate intellectual purity here. This is just working as all other Grasshopper scripts do. There is always a balance between more options and complexity to use and debug. If you find a case where this would be absolutely necessary, I would like to hear about it (possibly not a made-up case).
Thank you!
Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com
Hi Giulio, I do have examples. I will open a separate discussion later with an example file. Thanks. -Mostapha
I don't think the component should be able to do generic a simplify.
GH has a distinct way to interact on trees.This is determined by data access on the inputs and the way, the components operate on that. (Developers please correct me if I'm wrong)
If you get inputs as single items and add results as a list, even when this list has only one item, the path is extended.
If you get single item inputs and output single items, the path is unchanged. Same for list input and list output.
If you have tree access, you could in theory override this behaviour, but in most cases where a single input generates multiple outputs, you will need to extend the path to keep things in order.
If the input insn't simplified, there might be a reason for it. Either the user doesn't care or wants the complete path conserved. The input and output parameters always have the option to simplify. The user can decide whether to simplify or keep the structure.
If you were writing a component in VisualStudio, you could enable the simplify option of your outputs by default. I don't think this is possible for Python scripts as you only have access to the solve method. Not a good idea to change anything in the parameters here, since the user might have deliberately set a different option.
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
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by