One quick question: Can the script component inputs (x,y) and outputs (a) be defined in the script or do you still have to add and type those using the GH UI? What I mean is if I want to change the function to a = x + y + z, then would I have to add the input for z myself or is there some way where these can be added automatically depending on whatās defined in the script?
Either way, I have to say all the development around script editing looks super impressive and I canāt wait to play with it more.
Currently you have to modify inputs using the component UI. Determining which variable is an input is quite hard and might need some sort of convention like adding #! input: z to the top of the script. Hopefully we can find a good workflow for this and add it in the future to all script components using a shared script can update their parameters
Thanks for the detailed answer on the script file handling problem
Do you have a clue about this topic (kind of problematic right now but we can still manually install the package) :
And this one which is really annoying :
As for this last topic, if a script component refers to code from an external file and this file uses import statement of another file next to it, I encounter a random behaviour, sometimes the import statement works properly and sometimes it cannot find the file ā¦ Iām a bit lost there.
Example : files toto.py and utils.py are in a folder, toto.py is used by the component, toto.py has āimport utilsā, the import fails randomly from time to timeā¦
Hmm this is interesting. Okay let me run a few tests on those. ( RH-75516 Python linked script does not import python files in the same directory when used in Grasshopper component)
The other two mentioned above I have YT tickets for which Iām working on in the next few days.
Hi,
Iām trying to use new script editor to debug a code that I had written in grasshopper C# component.
I have some int and double inputs with list access and im trying to use LINQ library. my script works correctly in C# component but when I try to re write in new script editor Iām getting following error:
Compile Error
cannot convert from 'System.Collections.Generic.List<object>' to 'int' (Error CS1503: Argument 1) rhinocode:///grasshopper/1/255b438e-20c1-4e9b-bcae-869665a4809e/2131910e-b5d3-4f3d-8808-c34400c33ade:[85:44]
I have already imported LINQ on top of the script. one thing I noticed in C# script editor inputs with List access are defined as List while in the new editor they are defined as System.Collections.Generic.IEnumerable. could that be the issue?
Iāve also added the both C# component and script editor components for reference in the gh file.
When I use #r "nuget: RestSharp, 106.11.7"
The following is an error message:
Info 07/10/2023 07:11:11 [RhinoCode] Execute started
Error 07/10/2023 07:11:11 [RhinoCode] Error executing code | System.Exception: Error installing nuget package RestSharp==106.11.7
ā> System.NullReferenceException: Object reference not set to an instance of an object.
at NuGet.Protocol.DownloadResourceV3.GetDownloadUrl(PackageIdentity identity, ILogger log, CancellationToken token)
at NuGet.Protocol.DownloadResourceV3.GetDownloadResourceResultAsync(PackageIdentity identity, PackageDownloadContext downloadContext, String globalPackagesFolder, ILogger logger, CancellationToken token)
at Rhino.Runtime.Code.Environments.NugetEnviron.InstallAsync(NugetEnviron environ, NuGetSpec spec)
at Rhino.Runtime.Code.Environments.NugetEnviron.<>c__DisplayClass29_0.<b__0>d.MoveNext()
ā End of stack trace from previous location ā
at Rhino.Runtime.Code.Environments.NugetEnviron.AddPackage(PackageSpec pkgSpec)
at Rhino.Runtime.Code.Environments.NugetEnviron.AddPackages(IEnumerable`1 pkgSpecs)
ā End of inner exception stack trace ā
at Rhino.Runtime.Code.Code.BeginRun(ExecuteContext context)
at Rhino.Runtime.Code.Code.Run(ExecuteContext context)
at RhinoCodeEditor.Editor.Commands.WithExecutableCodeCommand.ExecuteCodeContext.RunCode()
Info 07/10/2023 07:11:11 [RhinoCode] Execute ended
Can anyone point me in the right direction in understanding this new script window and the python 3 frame work. I see chatter about being able to install packages. Can I tap into a Rhino python virtual environment ? Is there some kind of guide showing some of the new advantages to the python3 framework ?
No virtual environment support as of yet. But you can install pip packages for your script like this. See the line specifying required package (# r: numpy)
"""Testing pip install specific packages"""
# r: numpy
import numpy
# print(numpy)
print(f"using numpy: {numpy.version.full_version}\n")
for i in numpy.random.rand(10):
print(i)
BTW: I am a fast typist, and the auto-style-correction tries to improve my typing in the background, and produces hickups and delays. This editor is hard for me at the moment.
Also I get crashes from the Script Editor, here a crash report: RhinoDotNetCrash.txt (1.2 KB)
Indeed, so does mine. You can right-click the editor window and select Language Options and then disable Diagnostics (Linting). I assume this works in the non-Grasshopper editor as well. I wasnāt able to find this under the main/top menu bar:
yes, this works. I was looking in the menu Edit/Options, and found just a lonely font setting, which seams not to work (found it, works only for new files, weird).