mcneel / ghpython

A Grasshopper component for Rhino.Python
http://www.food4rhino.com/project/ghpython
118 stars 34 forks source link

Can we get a GHDoc Type Hint #14

Closed scotttd closed 13 years ago

scotttd commented 13 years ago

In the the input Type Hint could use a GhDoc type. This would create an incoming geometry ID automatically. Steve know about this if you need more information.

sbaer commented 13 years ago

Here's a little more detail on what Scott is requesting.

As an example, say there is an input called "brep" and it is being fed a Brep geometry class from another component. A type hint of "ghdoc object" would take the Brep geometry and add it to the ghdoc data structure. Then the "brep" variable would be set to a Guid which represents the Brep in the ghdoc.

piac commented 13 years ago

I actually believe I've suggested that first... Can I get it :)

Together with this, probably also the output should automatically convert IDs -> geometries.

scotttd commented 13 years ago

I agree that IDS should be set back to geometries on the output.

sbaer commented 13 years ago

I'm not so sure this is always what we want as a solution. I was thinking that at some point in time we may want to have a solution scope ghdoc that the components could choose to use instead of a local component scope ghdoc. In that case, the ids would make sense as output. Is there some sort of a "type hint" concept on outputs of components that we could use to explicitly say what we want an output to be?

piac commented 13 years ago

Usually there's not much to pick on outputs. But maybe it's possible. I'll investigate.

Also, users might want to create IDs or parse them from text, or something else. And we would impede that. Having the option to turn this off would allow that and also increase performance.

scotttd commented 13 years ago

It is not normal to have Type hints on output from Grasshopper components. It would be best if there was a marshalling layer on output from the GHPython component. Depending on the structure of the output we could change the output to make sense.

piac commented 13 years ago

Something on this track occurred to me... during the night. It's probably not enlightening but it's worth some discussion. This behavior might be considered just another rhinoscriptsyntax mode/target. This could be called Automatic Input/Output marshalling. Geometry on all inputs will be converted to Ids, Ids on all outputs will be converted to geometry. Would that make sense?

sbaer commented 13 years ago

An option on the component does make a lot more sense than just auto-"magically" converting the output. An alternative would be to provide some sort of coerce function in python for the output, but I'm not sure which method is clearer to users.

piac commented 13 years ago

let us see how the new rhinoscriptsyntax marshaller works