Tutorial: creating a Grasshopper component with the Python GHPY compiler


(Giulio Piacentino) #47

Hi @sgaray

if you are doing this from an event handler, then it should be fine. Never do this within a solution.

Just keep in mind that you’ll need to use standard Grasshopper input parameters, not Hint-based scripting parameters. Compile a sample component with the Hints that you need, then choose to copy the code. It will show exactly what types are expected.


Giulio Piacentino
for Robert McNeel & Associates

(Santiago Garay) #48

I was doing it from the solution itself, will follow your suggestion.Thanks!

(Giulio Piacentino) #52

A post was split to a new topic: Problems creating GHPY files

(Giulio Piacentino) #53

2 posts were split to a new topic: Documentation strings not used in GH_Component SDK mode

(Giulio Piacentino) #54

A post was split to a new topic: clr.AddReference() for compile GHPYs



Can the other sections of the compiling window be defined from inside the code?



(Giulio Piacentino) #56

They cannot, sorry.

If you compile often or more than a single component, you must compile all components on your own using clr.CompileModules(). Do not ship dozens of components in single GHPYs, because the loading time for each single GHPY is quite long (it does not take almost any longer to load 1 to 10 components in the same file).