Reduce mesh and upstream update script problem?

I sort of only just now discovered the Reduce Mesh command and found two scripts to use it in Grasshopper:

ReduceMesh improvements in Rhino WIP - Serengeti (Rhino WIP) - McNeel Forum

Low-res Polygons - Grasshopper - McNeel Forum

I copy pasted the scripts into the new editor and @DanielPiker version updates the input mesh which confuses me a bit.

Is this supposed to happen?

mesh_reduce_c.gh (1.2 MB)

I was also wondering how to use the locked components option in a script in Grasshopper. Is that somehow possible?

Hi @martinsiegrist, thanks for pointing this out.

It looks like there was a change in the script editor in the latest SR that alters this behaviour.
In previous versions modifying the input mesh in a script would not actually cause the upstream object to change.
The safer option when scripting is to make a copy and modify that, so the script above would become:

    private void RunScript(Mesh x, int n, ref object a)
    {
        Mesh m = x.DuplicateMesh();
        m.Reduce(n, true, 10, true);
        a = m;
    }

However, there’s maybe an argument for keeping the old behaviour where this wasn’t necessary.

1 Like

Hi Daniel, thanks for the insight. I don’t know what the benefit of the upstream change is and I’m a little affraid some existing scripts will have to be revised / verified…

@martinsiegrist The upstream change looks like a regression. Looking into it now and will make sure it is fixed for next 8.7

RH-81617 GH Script component changes upstream mesh

Are you using latest 8.7 RC for this?

Thanks. I’m using 8.7.24104.13001

System Info

Rhino 8 SR7 2024-4-16 (Rhino 8, 8.7.24107.13001, Git hash:master @ aa01e3b9820d84a48c2a812d24f0cf42379ee3d8)
License type: Kommerziell, build 2024-04-16
License details: Cloud Zoo

Windows 11 (10.0.22631 SR0.0) or greater (Physical RAM: 128GB)
.NET 7.0.18

Computer platform: DESKTOP

Standard graphics configuration.
Primary display and OpenGL: NVIDIA RTX A5000 (NVidia) Memory: 22GB, Driver date: 3-12-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 551.86
> Accelerated graphics device with 4 adapter port(s)
- Secondary monitor attached to adapter port #0
- Windows Main Display attached to adapter port #1

Secondary graphics devices.
NVIDIA Quadro K2200 (NVidia) Memory: 4GB, Driver date: 3-12-2024 (M-D-Y).
> Accelerated graphics device with 4 adapter port(s)
- There are no monitors attached to this device!

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On
Graphics level being used: OpenGL 4.6 (primary GPU’s maximum)

Anti-alias mode: 8x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 3-12-2024
Driver Version: 31.0.15.5186
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 23028 MB

Rhino plugins that do not ship with Rhino
C:\Users\martinsiegrist\AppData\Roaming\McNeel\Rhinoceros\packages\8.0\NVIDIADenoiser\0.4.3\NVIDIADenoiser.Windows.rhp “NVIDIADenoiser.Windows” 0.4.3.0

Rhino plugins that ship with Rhino
C:\Program Files\Rhino 8\Plug-ins\SolidTools.rhp “SolidTools”
C:\Program Files\Rhino 8\Plug-ins\Commands.rhp “Commands” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 8\Plug-ins\RhinoBonusTools.rhp “Rhino Bonus Tools”
C:\Program Files\Rhino 8\Plug-ins\AnimationTools.rhp “AnimationTools”
C:\Program Files\Rhino 8\Plug-ins\RhinoRenderCycles.rhp “Rhino Render” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\import_OBJ.rhp “Import_OBJ” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\RhinoRender.rhp “Legacy Rhino Render”
C:\Program Files\Rhino 8\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp “MeshCommands” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp “RhinoCycles” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp “SectionTools”
C:\Program Files\Rhino 8\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 8.7.24107.13001
C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 8\Plug-ins\Import_SolidWorks.rhp “Solidworks Import”
C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp “Displacement”

1 Like

@martinsiegrist I pushed a fix for this. It was one specific case that was missing from unit tests and I added it to my tests now so it does not happen again :smiley:

Here is a simpler test file with just a sphere mesh that captures the bug:

test_params_inputs_upstreamUpdate.ghx (74.4 KB)

I will send you a new 8.7 installer once it is ready

2 Likes

RH-81617 is fixed in Rhino 8 Service Release 7 Release Candidate

1 Like

Just confirming here that RH-81617 is fixed in Rhino 8 Service Release 7 as well.

1 Like