Closed co-ord closed 4 years ago
Apologies, I just found that I needed to unblock the components (.gha
+ .dll
) from the document properties.
I now have another problem, the component doesn't seem to work. In administrator mode I dropped GH_CPython on the canvas, went to the menu Python>Choose Interpreter
and specified the path to my Python interpreter.
I notice 2 things:
print
I tried with different Python interpreters (2 and 3), restarted my computer several times... without success. I would really appreciate some help @MahmoudAbdelRahman .
Upon fiddling with the component I realized that another component had to be plugged-in first (in input) before running a script. It is probably a bug but at least it works.
Another problem that I have now is when I want to loop a script (for an animation) with a timer. With the bundled GhPython component you can set a variable to a specific value and then increment it with a timer (component) like this:
def setup():
global n
n = 0
if iDraw: #iDraw is a boolean toggle
n += 1
ouput_ = n
else:
setup()
However, the very same script in GH_CPython will return the following error:
NameError: global name 'n' is not defined
as if setting the boolean to True
was erasing all the globals
defined in setup()
.
As a result any form of variable mutation over time seems impossible.
Is there any way to overcome this issue ?
Any help would be immensely appreciated
Hi @solub, Sorry, it doesn't support this feature, because the component is re-run each time the inputs changed. The only solution in my mind now is to save the global variable in a file outside and each time, the file is updated and read. Another solution would be to save the variable in a specific address in memory and each time you update and read the data from this address. https://stackoverflow.com/questions/8250625/access-memory-address-in-python
I hope this would help to solve the problem.
Hi @MahmoudAbdelRahman ,
Thank you for this pluggin.
One question, is it compatible with Rhino 6 ?
I have followed the instructions from the wiki (
.gha
and.dll
files inlibrary
folder + open Rhino as administrator) but:The only dialogue box that I have is when I double-click on .gha file directly from the library folder, Rhino opens and displays the following message
Is it just me or a Rhino 6 compatibility issue ?