Quantcast
Channel: Scripting - McNeel Forum
Browsing all 4120 articles
Browse latest View live

Python print() error msg

For what reason does print(d) give an error message? def f(x, y): return (x**2 + y**2 if x < 0 else 2*x**2 - y**2 + x*y if 0 <= x < 1 else x**2 + 2*y**2 -x + y ) a = {f(x == 1, y == 2) for x...

View Article


Difference between two 'functions'?

What distinguishes a from b? a = any(x for x in range(4) if x > 0) b = any(x > 0 for x in range(4)) print(a) print(b) 10 posts - 4 participants Read full topic

View Article


Bug: IntelliSense quits working in Script Editor following some strings

8.16.25042.13001, 2025-02-11 In Script Editor, IntelliSense quits working for code following strings that contain quotation marks or apostrophes. For example, to the following code in Script Editor,...

View Article

Out Parameters Large Data Grasshopper

I have a c# component with a large amount of data that is re-writing per time-step. The data update within the component happens in 10-12 miliseconds, because I have pre-allocated all the variables....

View Article

Def() output

How would you obtain the x values without modifying the code’s structure or making only a minor adjustment? def f(): return (x for x in range(-100, 100) if any(math.sqrt(x**2 + x - 12)) == y for y in...

View Article


Image may be NSFW.
Clik here to view.

Error inside Try: Invalid literal for in() with base 10: ''

Hi All, I’m getting the error below, and I have no idea why. It’s a simple function intended to convert integers stored as strings into proper integers. It’s been working well, but for no apparent...

View Article

Issue with Geometry Serialization from Grasshopper to Unity in Rhino 8

Hello everyone, I’m having trouble sending geometry from Grasshopper to Unity 3D via UDP using the gHowl plugin after upgrading to Rhino 8. This setup was working fine in Rhino 7, but now the...

View Article

Moving Control Points of a Line Relative to the Surface Normal

Hello, I want to move the control points I selected on a line according to the normal direction of a surface. But I couldn’t do this. I tried writing it with script but I wasn’t successful. I want to...

View Article


Why I do get "( ResetEngine )" when running script from a macro?

I do have a script for which I do created a macro button and every time I do launch the script from the macro button I do get an “( ResetEngine )” in the console and also the script runs painfully...

View Article


Image may be NSFW.
Clik here to view.

Control edge continuity using SweepTwoRail or similar in RhinoCommon?

Hi all, I am trying to create a surface with G2 continuity with its adjacent faces. In Rhino, there is a “edge continuity” option in Sweep2 command. However, I could not find similar option in...

View Article

How to shorten the code? - Def()

What is the most effective method for rewriting this code in a manner that is both concise and elegant? def xy(): xset = {x for x in range(-4, 6)} yset = {y for y in range(-3, 4)} A = {(x, y) for x in...

View Article

Hash() and (un)hashable type: set()

Is my analysis correct? unhashable set(): (We are aware that) the location of elements in a set() is interchangeable. However, the concealed hash function’s rule is ‘unhashable’ on set() in...

View Article

Image may be NSFW.
Clik here to view.

Issue with PolylineCurve Output in Custom Plugin (GHPython)

Hi everyone, I’m developing a custom Rhino 8 plugin using the RhinoScript editor, and I’m encountering an issue when trying to output PolylineCurves generated from a CPython script. My script...

View Article


No Title - Different type of 'error'? (True, False)

a, b in RealNumber, it should be always ‘TRUE’… a > (a+b)/2 > b AND a**2 + b**2 >= 2*a*b But, why ‘False’? r = range A = {(a > (a+b)/2 > b) is True for a in r(-10, 10) for b in r(-10,...

View Article

[Request] Quick & Dirty lay flat

If someone is interested, can you make this one (in Python): Call the script via macro or keystroke if object wasn’t pre-selected, an option to select the object click on a planar face of the object...

View Article


Image may be NSFW.
Clik here to view.

Orienting the control points of a curve to the normal of a surface

Hello, I want to quickly move the control points of the white line shown in the picture to the normal of a surface, but I can’t do this without the red line. Is it possible to do this? I explained it...

View Article

Image may be NSFW.
Clik here to view.

ScriptEditor Development Mode

I click this button hundred of times a day: Because I change code in vscode my of a locally installed package that is in constant development. @eirannejad is it possible to force reloading packages...

View Article


RunPythonScript still runs in IronPython on Rhino 8

Hi:) I wanted to run a python script through the “RunPythonScript” command but this still runs on ironpython and not cpython. Can I change that somewhere ? Best Niclas 2 posts - 2 participants Read...

View Article

Image may be NSFW.
Clik here to view.

Python error only when ran inside GH

Hello, I have been calling the SAP2000 API inside Grasshopper since Rhino 8 release. However, last week I started getting this error in my previously working components: The API (comtypes library) is...

View Article

Image may be NSFW.
Clik here to view.

EtoUI, slider controls

I am using python to learn the Eto module How can slider controls in EtoUI in python be tracked in real time by tag controls I gave self.m_slider.Value to self.x_label.Text in the code, but I found...

View Article
Browsing all 4120 articles
Browse latest View live