Tutorial: creating a Grasshopper component with the Python GHPY compiler

python
ghpy
compiler
gha
(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


Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

0 Likes

(Santiago Garay) #48

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

0 Likes

(Giulio Piacentino) split this topic #52

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

0 Likes

(Giulio Piacentino) split this topic #53

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

0 Likes

(Giulio Piacentino) split this topic #54

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

0 Likes

(IVELIN PEYCHEV) #55

@piac,

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

image

Thanks

0 Likes

Unexpected token '<newline>'
(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).

1 Like

(Justtoid) #59

QQ%E6%88%AA%E5%9B%BE20190126222010
I like this battery. How is this battery code written??

0 Likes

(Ondrej Vesely) #60

Sorry, I’m not sure what you mean from your post.
But if you are wondering about the name tag above the component, that probably comes from the Bifocals plugin.

0 Likes