Share your favourite scripts, macros and plug-ins

Yes, Rhino help/documentation is top nodge!
Edit: it is even top notch, unlike my orthography.

1 Like

Didn’t know about this thread: but here’s a stl export script, I posted separately

Rhino has these two test commands to toggle the wireframe’s visibility:

Icon 32x32:
Toggle control points to front 32x32

Text: Toggle control points to front

Tooltip for the left mouse button: Toggle control points to front
Command: TestToggleControlPointsToFront

Tooltip for the right mouse button: Toggle analysis control points
Command: TestToggleAnalysisControlPoints

2 Likes

IMPORTANT: First, you have to run the ! _Block command to convert the closed curve profile into a block, then it can be selected as a profile.

Download the Super sweep plug-in from here:
https://www.food4rhino.com/en/app/super-sweep

How to use:

4 Likes

Hi all,

Just created a script for chamfering surface corners..

ChamferSrfCorner.py (7.8 KB)

It may be usefull on structural modelling..

5 Likes

Just posting the similar script for filleting surface corner (also featured in the 1st post), in case that Rhino users want to collect both of these useful scripts:
FIlletSrfCorner.py (9.0 KB)

5 Likes

here is a powershell script that closes Rhino, builds the grasshopper plugin that you are working on, starts rhino and opens a rhino and grasshopper file

Summary
# Set error preference to stop on the first error.
$ErrorActionPreference = 'Stop'
# Ensure PowerShell console can display UTF-8 characters.
try { [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 } catch {}

# --- User Configuration ---
$Rhino3dmPath   = "PATH_TO_FILE"
$SolutionFolder = "PATH_TO_PROJECT_DIR"
$GrasshopperGH  = "PATH_TO_GRASSHOPPER_FILE"

$RhinoExe       = "C:\Program Files\Rhino 8\System\Rhino.exe"
$Configuration  = "Debug"

# --- Robust Rhino Shutdown ---
Write-Host "==> Closing any running Rhino instances..."
$procs = Get-Process -Name Rhino -ErrorAction SilentlyContinue

if (-not $procs) {
    Write-Host "==> No Rhino instances found to close."
} else {
    foreach ($p in $procs) {
        if ($p.HasExited) { continue }
        Write-Host "--> Attempting to close Rhino PID $($p.Id)..."
        try {
            $p.CloseMainWindow() | Out-Null
            if ($p.WaitForExit(4000)) {
                Write-Host "    ...PID $($p.Id) closed gracefully."
            } else {
                Write-Warning "    ...PID $($p.Id) did not respond. Forcing termination."
                $p.Kill()
                $p.WaitForExit(2000)
                Write-Host "    ...PID $($p.Id) terminated."
            }
        } catch {
            Write-Warning "    ...An error occurred while closing PID $($p.Id): $($_.Exception.Message)"
            try {
                if (-not $p.HasExited) {
                   Write-Warning "    ...Attempting to force-terminate PID $($p.Id) as a fallback."
                   $p.Kill()
                }
            } catch {
                Write-Error "    ...FAILED to terminate PID $($p.Id). It may require manual closing."
            }
        }
    }
    Write-Host "==> Rhino shutdown process complete."
}

# --- Guard clauses to check for file and folder paths ---
if (-not (Test-Path $RhinoExe))       { throw "Rhino.exe not found at: $RhinoExe" }
if (-not (Test-Path $Rhino3dmPath))   { throw "3DM file not found: $Rhino3dmPath" }
if (-not (Test-Path $GrasshopperGH))  { throw "GH file not found: $GrasshopperGH" }
if (-not (Test-Path $SolutionFolder)) { throw "Project/Solution folder not found: $SolutionFolder" }

# --- Build the .NET project ---
Write-Host "==> Building .NET project in $SolutionFolder ..."
$buildOutput = & dotnet build $SolutionFolder -c $Configuration --nologo 2>&1
$exitCode = $LASTEXITCODE

$buildOutput | ForEach-Object { Write-Host $_ }

if ($exitCode -ne 0) {
    Write-Host "==> dotnet build failed (exit code: $exitCode)" -ForegroundColor Red
    throw "Build failed. Please see the errors above."
} else {
    Write-Host "==> Build succeeded."
}

# --- Create RhinoPython bootstrap script ---
Write-Host "==> Writing RhinoPython bootstrap script (UTF-8)..."
$pyPath = Join-Path $env:TEMP 'rhino_bootstrap_gh.py'

$pythonScript = @"
# -*- coding: utf-8 -*-
import Rhino
import rhinoscriptsyntax as rs
import os

rhino_file = os.path.normpath(r"$Rhino3dmPath")
gh_file    = os.path.normpath(r"$GrasshopperGH")

Rhino.RhinoApp.WriteLine("[bootstrap] 3DM Path: {0}".format(rhino_file))
Rhino.RhinoApp.WriteLine("[bootstrap] GH Path : {0}".format(gh_file))

if os.path.exists(rhino_file):
    Rhino.RhinoApp.WriteLine("[bootstrap] Opening 3DM file...")
    Rhino.RhinoApp.RunScript('-_Open "{0}" _Enter'.format(rhino_file), True)
else:
    Rhino.RhinoApp.WriteLine("[bootstrap][WARNING] 3DM file not found. Skipping.")

try:
    Rhino.RhinoApp.WriteLine("[bootstrap] Loading Grasshopper plugin...")
    rs.Command('_Grasshopper', True)
    gh = rs.GetPlugInObject('Grasshopper')
    
    if gh and os.path.exists(gh_file):
        Rhino.RhinoApp.WriteLine("[bootstrap] Opening GH document...")
        gh.OpenDocument(gh_file)
        gh.HideEditor(False)
        gh.Enabled = True
        Rhino.RhinoApp.WriteLine("[bootstrap] Grasshopper document loaded and enabled.")
    elif not gh:
        Rhino.RhinoApp.WriteLine("[bootstrap][ERROR] Could not get Grasshopper plugin object.")
    else:
        Rhino.RhinoApp.WriteLine("[bootstrap][ERROR] GH file not found at: {0}".format(gh_file))

except Exception as e:
    Rhino.RhinoApp.WriteLine("[bootstrap][ERROR] An exception occurred: {0}".format(e))
"@

Set-Content -Path $pyPath -Encoding UTF8 -Value $pythonScript

# --- Launch Rhino ---
$runScriptArg = '/runscript="_-RunPythonScript ""{0}"""' -f $pyPath
$argsList = @('/nosplash', '/notemplate', $runScriptArg)

Write-Host "==> Launching Rhino with arguments:"
Write-Host ("`"$RhinoExe`" " + ($argsList -join ' '))
Start-Process -FilePath $RhinoExe -ArgumentList $argsList

5 Likes

Drag strength toggle that aligns to the active Cplane. The LMB command resets the Gumball and turns off the drag strength.

Icon:
Drag strength

Icon inside RAR to preserve the quality:
Drag strength.rar (1.7 KB)

LMB Tooltip:
Drag strength 100%

LMB Command:
!_SetRedrawOff '~_Dragmode _CPlane '_Gumball _On '~_-DragStrength _ShowDialog=No _DragStrength=100 _Enter '~_GumballAlignment _CPlane '_EnterEnd _SetRedrawOn

RMB Tooltip:
Drag strength 10%

RMB Command:
!_SetRedrawOff '~_Dragmode _CPlane '_Gumball _On '~_-DragStrength _ShowDialog=Yes _DragStrength=10 _Enter '~_GumballAlignment _CPlane '_EnterEnd _SetRedrawOn

P.S. You can set a different percentage for the RMB command in case that the 10% are too fast for you.


Move UVN toggle that aligns the Gumball to the object.

Icon:
Move UVN 2

Icons inside RAR to preserve the quality (two icons: 2% and 5%):
Move UVN 2.rar (2.3 KB)

LMB Tooltip:
Move UVN 100%

LMB Command:
!_SetRedrawOff '~_Dragmode _UVN '_Gumball _On '~_-DragStrength _ShowDialog=No _DragStrength=100 _Enter '~_GumballAlignment Object '_EnterEnd _SetRedrawOn

RMB Tooltip:
Move UVN 2%

RMB Command:
!_SetRedrawOff '~_Dragmode _UVN '_Gumball _On '~_-DragStrength _ShowDialog=Yes _DragStrength=2 _Enter '~_GumballAlignment Object '_EnterEnd _SetRedrawOn

2 Likes

As a follow up to this topic:

https://discourse.mcneel.com/t/wish-simplifycrv-with-tolerance/109857/1

I just sketched a script with the help of AI to achieve ”SimplifyCrv with Tolerance” to primarily work with polylines:

CollapseControlPointsWithTolerance.py (3.6 KB)

My results:

Input polyline with 15 control points:

image

After running the script, 8 control points as expected:

image

The geometry OFC changes within the allowed tolerance, but that is expected for operations involving tolerances.

Feel free to improve it, or build your own upon it !

Hope is usefull,

Dani

2 Likes

I can’t seem to get this to run, does it work in V8 ?

Many people have contacted me about that, including those running Rhino 7. Initially, I was also unable to do anything with the plug-in. This is why, I wrote the warning in my post above.

  1. The curve profile must be a closed curve.

  2. The curve profile must be converted to a block.

my two favorites that I used, not often, but they really made a difference when they were used:

Feels like this should be part of the default tools.

12 Likes

Works quite well. Takes a bit of time to calculate, but the results from the test I did so far are always good.

What’s the command to evoke that rvb script?

Some really helpful stuff in there - thank you.

I have a folder full of stuff, and most of it I can’t remember what I was using it for :sweat_smile:

Here are a couple:

FaceCamera.rvb (5.0 KB)

Self-explanatory - but you can have planes facing the camera for silhouettes of ppl etc.

ProjectPersp.rvb (4.8 KB)

Really helpful if you want to project your current view onto a group of surfaces for Anamorphic Art.

I can’t share all my Pascal gold though :face_savoring_food:

(Could be from Rhino 5 but I think they work in Rhino 7 (I don’t have 8, yet))

1 Like

yes I have a closed curve, made as block, and a path, the plugin is loaded, I run the SuperSweep command, its there, but nothing, no dialogue box, nada, zilch :person_shrugging:

The path must be a single curve. The plug-in does not support multiple curves. The same goes for the profile curve, too. It’s very sensitive to what’s used as an input geometry.

Unfortunately, this particular script causes some issues with my Rhino 7. When I run Rhino and try to open any model, the script runs automatically (I have never put it into the list of scripts to run upon opening Rhino) and awaits for a user input to select objects to calculate minimum bounding box. The scene is empty, so I can’t choose any object. Then Rhino will not open the file which I wanted. Never.

I remove the marked link, yet it always comes back. I can’t recommend this script for obvious reasons…

Here is a simple macro i did for drawing 3d Polyline without any interruption. That helped me a lot for Isometric plumbing drawings..

ORTHO must be ON

Isometric ON

'_CPlane _World _Front

Isometric OFF

'_CPlane _World _Top

5 Likes

well, the alternative was the Galapagos setup to evolve a solution.

A great script by @Helvetosaur meant to extend one or multiple curves within a boundary. Also works if a curve (or multiple curves) is located inside an open cylinder or other 3d objects etc. Not limited to just 2d.

ExtendCrvsBothEndsToBoundaryObjs.py (739 Bytes)

7 Likes