How to 'cap' result of 'Trim with Regions'?

Hi, as this photo shows, I’m looking for a way to ‘cap’ the result of a Trim With Regions component:

The shape on the left is a result of the trim, in the next photo the object with which it is trimmed can be seen:

Maybe my trim isn’t the best way to achieve this, find my file enclosed with examples of the shapes I’m working with:
close_curve_endpoints_v1.gh (447.3 KB)

My goal is to end up with a collection of closed shapes that I can extrude. These shapes can only exist on the ‘voronoi islands’.

Does anyone know a solution? I’ve already taken a considerable amount of time to find a solution, but the ones I came up with, such as finding the closest pairs of points did not yield any results. I think I’m missing one hint when it comes to the actual intersection/trim with regions component, maybe there is a better component to use for this.

What I also tried, was to convert the shape to a mesh, but this makes it considerably slower to work with as the Boundary Surface component creates a very heavy surface.

Thanks for your time!

Capping the polyline segments in the correct order is complicated…

The quick way to do this is by splitting the boundary surface with the 40 closed regions.

split_surface.gh (134.0 KB)

3 Likes

Hello Martin, thanks a lot for your suggestion. I decided to rebuild your suggestion for max learning and have to say it works well. I knew it was better to do it with some type of split but I’m not that experienced with all the intersection tools. This solution gets me exactly what I’m looking for.

You must have a better computer than I do as I get 838ms on the Surface Split component instead of your 551ms. Do you by any chance have an Intel CPU instead of my AMD CPU?

Here’s my system info:

System Info

Rhino 8 SR5 2024-2-20 (Rhino 8, 8.5.24051.15001, Git hash:master @ 8ad7c99e58df0a8c09e572ba1ae2b52a6f429060)
License type: Kommerziell, build 2024-02-20
License details: Cloud Zoo

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

Computer platform: DESKTOP

Standard graphics configuration.
Primary display and OpenGL: NVIDIA RTX A5000 (NVidia) Memory: 22GB, Driver date: 2-7-2024 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 551.52
> 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: 2-7-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: 2-7-2024
Driver Version: 31.0.15.5152
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\8.0\Plug-ins\KeyShot9RhinoPlugin (ecfe8d1f-876a-460f-aa5e-3dd816936811)\1.0.0.0\KeyShot9RhinoPlugin\Rhino 5.0\KeyShot9RhinoPlugin.rhp “KeyShot9RhinoPlugin” 1.0.0.0
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\Commands.rhp “Commands” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\WebBrowser.rhp “WebBrowser”
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\RhinoRenderCycles.rhp “Rhino Render” 8.5.24051.15001
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.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 8\Plug-ins\MeshCommands.rhp “MeshCommands” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\IronPython\RhinoDLR_Python.rhp “IronPython” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\RhinoCycles.rhp “RhinoCycles” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\SectionTools.rhp “SectionTools”
C:\Program Files\Rhino 8\Plug-ins\Grasshopper\GrasshopperPlugin.rhp “Grasshopper” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\RhinoCode\RhinoCodePlugin.rhp “RhinoCodePlugin” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 8.5.24051.15001
C:\Program Files\Rhino 8\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 8\Plug-ins\Displacement.rhp “Displacement”

I think it’s time to upgrade my machine, but it would probably also be worth it to seek better ways to perform solid booleans.

Luckily a lot can be improved on:

My machine info:

Summary

Rhino 7 SR36 2023-12-12 (Rhino 7, 7.36.23346.16351, Git hash:master @ 11a364321297eb8cdb34405a3308d8911f58706d)
License type: Educational, build 2023-12-12
License details: Cloud Zoo

Windows 10 (10.0.19045 SR0.0) or greater (Physical RAM: 31Gb)

Computer platform: LAPTOP - Plugged in [60% battery remaining]

Non-hybrid graphics configuration.
Primary display and OpenGL: NVIDIA GeForce RTX 2060 (NVidia) Memory: 6GB, Driver date: 6-23-2023 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 536.40
> Integrated accelerated graphics device with 4 adapter port(s)
- Laptop lid is possibly closed
- Windows Main Display attached to adapter port #1

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: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 6-23-2023
Driver Version: 31.0.15.3640
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 6 GB

As you can see in that linked topic, it seems the processing time can be affected by one bad object.

If you post your file, I can take a look

// Facepalm

… 290ms here, with a Ryzen 7700X.

Do not look for brand, look for actual performance.
This kind of tasks are probably single-threaded, so look for single threaded comparison lists, like:
https://www.cpubenchmark.net/singleThread.html

From my experience, cpu+motherboard performance/price ratio, AMD is better than Intel’s …


Optimize your code.
Optimize until is decently fast on old machines, then on moder machine will run real-time.

If you have solid difference going for minutes, it’s likely you have badly optimized your algorythm … or working with millions of solids? Hard to tell without seeing the actual case.

Sometime I end up replacing solid boolean operations with many pre-cut surfaces (task that can also be multithreaded) and later join them…

2 Likes

Absolutely right, this is why I went for AMD Ryzen in the first place back in 2020 when I realized I wanted to create artworks in Grasshopper :slight_smile:

I have three Boolean operators running where the heaviest one runs for 5 minutes. This does a difference on one Closed BREP with 154 other Closed BREPs. I checked all of my data and there don’t seem to be any errors regarding accidentally using a Grafted tree where it needs to be flattened as well.

I’m thinking the main reason why it takes so long is because the outlines I shared in my OP original file are segmented instead of using a curve. I noticed this made it a lot heavier to process. I discovered that other thread about performing booleans through a script and am currently trying to see if that makes a difference. If it doesn’t, I will have to go and see if I can find another reasonable way of offsetting my original curves and lines with something else other than Clipper’s offset method. Beyond that the GH solid boolean operators are just notoriously slow to begin with.

I’m not in the position to share the entire file sadly as it contains an artwork I’m still working on. I’ll give the scripted boolean methods a chance and if I still feel it’s not optimized enough I’ll definitely open a new topic for it as I feel that that would be the best thing to do, also to make it so others can find a solution when looking for a similar issue and not to pollute this topic any further.

2 Likes

Check this

regions_.gh (134.1 KB)

1 Like

Okay, just a small addition as I couldn’t let this rest :innocent:
I’ve done lots and lots of optimization to the point where I am not sure I can improve it further:

But as you can see, also thanks to this topic: Boolean difference in gh much slower than in Rhino - #18 by gustojunk

Before I found the previous topic, some booleans took over 5 minutes, so in total it was around a ten minute wait. Now it’s around one minute but it feels even shorter. I’ve done a complete rework of every group of components to make it as efficient as possible to my knowledge.

This includes, but isn’t limited to:

  • using the scripted boolean calls
  • simplifying geometry (creating an outline of segments, extruding the outlines, instead of extruding a profile along the segments)
  • changing how some geometry is built by using extrusions and adding a roof instead of extruding a bigger and a smaller shape and then BooleanDifference them
  • many more

I have a few more ideas, such as something I read about performing booleans on surfaces instead of solids.

Thanks to those that help out here on the forum. Some day I hope to show the end results in a showcase. It’s been a while, but I have to say… I love Grasshopper so much :heart_eyes: It keeps being useful in all kinds of areas.

That’s interesting as well, multiple region trims that relate to the length of the segment and the position in the list. Thanks for sharing this. I’ll have to study it some more!

1 Like

Multithreading could be helpful. I’ve observed that memory size affects calculation time (16GB vs 24GB in my comparison), though it’s not a scientific setting (some other apps were open)

For splitting, my attempts has been to split one by one, and use heuristic (e.g. take smallest piece) to filter the results, so that the result of this divide-and-conquering actually adds up correctly.

1 Like

Nothing to add here except a benchmark running @martinsiegrist’s code on my new computer, which looks great so far: (code is yet another victim of R8/R7 incompatibility due to Area)

HP Victus 15L Gaming Desktop Computer 12th Gen Intel 12-Core i7-12700 Processor [only 2.10 GHz] 64GB RAM 2TB SSD + 1TB HDD Nvidia Geforce RTX 3060 12GB for $1,249.

1 Like