Select Rhino objects via Grasshopper Player

Since Rhino’s command SelShortCrv is only selecting curves short curves and I can’t find anything like SelLongCrv I thought it could be a good task to create such a command in the Grasshopper Player.

(I don’t really need it right now, so don’t bother with any scripts)

  1. Would it be possible to filter the selection of original Rhino objects based on rules described in Grasshopper?
  1. More of, would it be possible to modify them to some extent? - move, scale, array, etc.?
    No modifications of geometry such as solid or surface operations.

What is important is that I am asking about Rhino geometry, where all properties, texture mapping, and such things, are preserved.


Simple concept of Select curves within length range Grasshopper Player command.

I’m trying to think about how this could be done in Grasshopper. We allow for custom filters when selecting objects in Rhino. The Get Geometry component only has a basic filter of allow specific geometry types. It is almost like there needs to be two “Get Geometry” components that somehow know they need to work together to allow for some filtering logic in between.

I’ve made a script that is doing both of it.

You can get all the guid of your objects with Elefront grassopper’s plugin, filter them relying on their properties. Apply some rhino operation to them using scripts.

You break the law. :oncoming_police_car:

However, you pushed me a little and I also successfully implemented (hilariously small amount of code) to get it working.

But mostly I am interested if GH Player could have some components that would deal with the context and allow simple operations on Rhino geometries. It can start by selecting and deselecting and ideally it could move, copy, change color, orient, change layer, etc…

Rules:
a) no scripting
b) no recreating (baking) new geometry instead of original

This would make it very easy to create powerful compiled GH Player commands.


Ok @gaspard.bourgeois, I got it working with Elefront and Human with no scripting at all, thanks for pointing this out!

Modify Curves
modify curves layer.gh (10.9 KB)
Simple as that: (it leaves you with the get string prompt you got to cancel, but changes the attributes nonetheless)

Select Curves
For selecting objects I got this (with the help of the C# component found somewhere in forum):
select curve - length range csharp.gh (9.3 KB)

For moving RH objects I didn’t found how to do it yet.

1 Like

I need to inform you that GrasshopperPlayer is not designed to be use with blocks GUID. Even if you can trick to suceed with them.

You have to be carreful with 2 things :

For moving object, you can use those implementations of rhinoscriptcompiler


move_orient_transform.ghx (201.5 KB)


selectObjects.ghx (33.8 KB)

… why?

well, if you are making use of grasshopper player, where the .gh code is executed in background, i think it’s a bit tricky to have plugins involved. You might bring your functions to another machine and it won’t work because some plugin might be missing.
Some lines of c# would do the same, if you need simple things.
Nothing against those plugins. Those are great!

You could even consider the good old rhinoscript, or other like VB or python, instead passing through GH.

One of the many ways of doing it:
c# transform rhino geo
c# transform rhino geo.gh (6.4 KB)
it has some tricks to avoid recomputation due to the geometry itself moving…

@gaspard.bourgeois Thanks, I will take a look at that. I got a feeling that I’m a little stubborn too.

I’m just starting with my scripting, It’s not that I am against it!

It’s just about how much is already provided in GH and I already spent a good amount of time using it. Before I will catch up with my scripting skills to feel as comfortable as with wiring GH nodes a lot of time will pass. Anyway, if not GH I would probably never take a look at writing any code.

I am also thinking if this could be achieved easily. There are people who don’t even use Grasshopper, making those people learning Grasshopper, coding basics and using API just to make themselves a simple but useful command is quite a steep learning curve. I was just asking if there is a way to stick at start just with Grasshopper.

Thanks for the script, of course it is working in Grasshopper, but as a GH Player command it’s making something strange. Maybe that’s what I mean, things get tricky very quickly.


It all sums up into a simple question: Are there a new possibilities that GH Player could provide for dealing with Rhino objects or the nature of it is concentrated more about creating new geometry.

My scripts can be launched with GH player as well. I just recommand to use them by installing this plugin to prevent any caches issues