public Control CreateEditorControl(Action<string> helpCallback)
{
if (m_py == null) return null;
var control = m_py.CreateTextEditorControl("", helpCallback);
return control; //error comes up at this 'control'
}
Technically I guess you can cast explicilty, and if you wrote “return (Control) control;” that error would probably disappear, but I’d assume this points to a larger problem,
I wanted to build it to use it as a training while figuring out how it all works. Later on I want to add additional DLLs so I can call them from python without clr. I am not sure if this is the appropriate way, but I’ll try.
Do you know what should I rename ghpython_OBSOLETE in order to make the v6 one and my build of the old version to work together inside GH. Currently it’s asking me which one I wanna load.
I assume other way would be to change their GUIDs but there are several *Component.cs in ghpython project and they all have different guids.
yes, as it stands, you can build the GhPython source for V5 into V6 with that change. V6 looks explicitly for the new version, so you will have to bypass that (just rename the project and create new IDs and you will be good to go). Now GhPython is part of Grasshopper, and is bundled there in the same way. We no longer publish its source code for that reason. This obsolete source code is just kept there as a record.
The main changes introduced in V6 regard the editor, which is a facility which Rhino itself provides, the addition of the advanced scripting mode, the compilation of GHPYs, the iteration support (slightly faster iterations in V6). There’s also a change in the results of clicking the “Test” button: in V5 it used to keep all previous variables; in V6, user-defined variables are cleared. And a few more bug fixes and type supports (Guids, Planes etc).
Thanks,
Giulio
–
Giulio Piacentino
for Robert McNeel & Associates giulio@mcneel.com
So you say from the old build I cannot compile to GHPY?
After making them both appear in my GH can I compile ghpython(obsolete)component using ghpython(v6)?
I do not fully understand this question. You can compile a new GhPython (that you should call differently, let’s say “GhCobra” with another GUID). I do not really see many advantages in doing this, though. It’s just older and buggier code.
Adding them to where? GhPython? It could be done. Math.Numerics’ license is relatively open. I seem to remember that @DavidRutten wants to add it to Grasshopper 2.
Now I have both the new ghpython component and the old one.
Can I use the compiling-sdk.gh from this thread:
In order to compile ghpython_old_component?
Reasons:
I want to not have to use clr.addreference for
DotNetZip.dll
MathNet.Numerics.dll
System.Xml.ReaderWriter.dll
TensorFlowSharp
etc.
I would like to make
import Grasshopper, GhPython
become this (as default)
import Grasshopper as gh
import GhPython
import scriptcontext as sc
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
Another thing that I requested before is to make SDK mode as default, you said to make it another UserObject, could be done by simply changing the code.
Another one, re-arranging the code automatically when you click SDK mode. You know moving all imports together and moving the description comment on top, these kind of things.
If all of the above are not possible due to incompatibility, are you planning on releasing the source of the new ghpython so I can try to make these changes myself?
You can do whatever you want if you change the source code. Directly after compiling nothing will work properly, though, because you will need to change 1. the name and 2. the ID of all components and of the assembly, as I already mentioned several times.
For this, just make a Grasshopper User Object with the normal GhPython component. It will remember whatever code is set at the moment you made the User Object (same for Hints and same for number of inputs, outputs, etc). You can set your own icon. Then you can just use that component from the tab.
This will likely follow McNeel’s decisions with Grasshopper 2.0. There is no incompatibility if you just change the name and the ID, as it’s essentially another add-on.