Manually "paint-select" mesh faces - How?

I’m desperately in need of a convenient way to manually “paint-select” or “brush-select” limited areas of mesh faces, but I can’t find among the standard selection commands any way to do that.

One of the problems frustrating me is that SHIFT + mouse picking (individual mesh faces) unconditionally selects faces on the BACKside of the mesh instead of the frontmost faces. Drives me crazy (If I’m not nuts already before trying).

How has people out there solved this?

Fig 1. Example of what I mean with “brush-” or “paint-selecting” mesh faces :


(Image from this page: https://www.mmmanual.com/triangle-meshes/ )

// Rolf

I have not tested this in the rhino 6 beta, but this plug-in allows you to paint meshes by face or vertex.

There are two options I know of for this that may help…

  • In v5 or the v6 beta turn on the control points for the mesh>Run CullControlPolygon so it is ‘on’>Use SelBrush to paint select control points>Run the Invert command and Delete>Turn off control points.
  • In the v6 beta>Run ExtractMeshFaces>Type SelBrush in the command line while the ExtractMeshFaces command is running>Paint your selection> Rotate the view and drag a fence selection with ctrl held to deselect the faces in the back that you don’t need>Enter to extract the painted faces. The need to be able to prevent the paint selection of occluded faces in this workflow is a logged feature request but unfortunately hasn’t been done yet. I’ll add this thread as another request.
    https://mcneel.myjetbrains.com/youtrack/issue/RH-35034

Hi @BrianJ, I couldn’t find any command CullContolPolygon in R5.

However, I played around with GrassHopper making my own scripted selection tool by “inclusion” using a Brep (Sphere). Only problem is that the processing (SolveInstance() method) of my components runs only on Mouse-Up, as demonstrated in the clip below:

Fig 1. “Brep-Select” with GrassHopper :

If it’d be possible to run the SolveInstance() method every N-th pixels of mouse movement in my PointInSphereAccumulate (PtInSphAcc) component, which then feeds the FacesByPt component (within 6+10ms), then I’d have a redneck solution for brush-selecting Mesh Faces… < looking blushed >

In this case I used point Inclusion and found the corresponding Faces, but something even better could just as well be achieved by using Intersection of the Face normals against the sphere, etc.

Perhaps @DavidRutten would know if it’s possible to run the solver at N pixels of Mouse movement?

// Rolf

1 Like

That’s odd, maybe I’m forgetting something about where this command came from in v5… @mikko should it be available by default?

Agreed, I don’t have a suggestion on that one.

@BrianJ, it is, you had a typo in the name. The command is CullControlPolygon, and I think has been in since version 2.

Oops! Thanks.

Sorry about that @RIL maybe it will help some with the added r.

Hi Rolf,

i thought this would be a good addition to Rhino 5 so you might give the attached script a try. It allows highlighting of mesh faces by brushing and works without selecting occluded faces, even in wireframe mode. You can use CTRL to unhighlight by brushing.

Since subobject selection in Rhino 5 can not persist after a scriptrun is completed, i used highlighting instead. After pressing Enter the script performs one of the available command line options, either Delete or Extract.

Rolf_FaceBrush.py (2.9 KB)

_
c.

1 Like

No problem, I corrected the spelling. :slight_smile:

There’s a problem with the command though. it selects only vertices (OK, I can look up the corresponding Mesh Faces with a script), but worse is that it paints/selects “through” the Mesh, so that surfaces behind the nearest surface is also “painted”. Like so :

Vieved from the painted angle :
bild

And viewed from a little different angle:

Not useful for my needs (for an end user application I’m working on).

// Rolf

Even if CullControlPolygon is on? Can you post a small sample mesh if so?

Yes.

Forum Sample - CullControlPolygon.3dm (791.3 KB)

// Rolf

1 Like

I think the logic with the CullControlPolygon is that It only hides (culls) points for “backfaces” but not for faces behind the “front” face with the same direction as the front face. Like so:

Fig 1. Lines belonging to the same mesh object. Backfaces drawn in blue:

// Rolf

I see what you mean now, thanks for the file. The occluded backface verts aren’t selected but then front facing verts are hit by the selection in another area of the mesh. I don’t have a solution to prevent this other then the extra step of rotating the view to deselect the unwanted selection.

I’ve filed a new request for ExtractMeshFaces to support SelBrush and also respect visibility.
https://mcneel.myjetbrains.com/youtrack/issue/RH-42731

1 Like

Wow @clement, This is just perfect and it does exactly what I want…

Somehow I didn’t see your post earlier, I only saw it now (sorry for that) when I was planning for a new post on the subject.

It would be great if I could provide or initiate a command like thi from my GH definition so that the end user of my intended GH plugin wouldn’t have to install multiple plugins. Any hints on that?

// Rolf

Hi @RIL, i am not so fluent with GH but would imagine this is possible. Either create a component which references a Rhino object (your mesh) and give it an output of selected subobject indices (faces, vertices). Then create a component which can be run with a button to perform subobject selection or highlighting with the code in my script. I’ve tried some baby steps to show how to get highlighted mesh face indices:

SubObjectHighlight.gh (6.8 KB)

It may also be possible to create your own getter funtion for a component but that is over my head. Btw. do you run Rhino 5 or 6 ? It makes a difference in regards to persistent subobject selection, which is only possible in Rhino 6 as far as i know.

_
c.

I develop for Rhino 5 for the foreseeable future.

The problem I have is mainly determining what faces (or vertices) are selected as seen from the GH Components. For the further processing I already have the algorithms with components. I’ll take a look at your definition to see if it fills the gap I have on determining UI selections.


Edit: When I connect the mesh to your GH definition and try your python script then I get the following error message, so there seems to be a conflict between the two. Only if I disable the gh timer I can run your MeshFaceBrush command. That’s not a big problem though, since I can manually trig the GH component only after the manual brush-selection is done.

bild

However, your scripts really does what I want so this is Gold. Thank you very much @clement. :medal_military:

// Rolf

Hi Rolf, my definition above was done in GH for Rhino 6. If you do this in Rhino 5 i suggest to not use GetSelectedSubObjects but use GetHighlightedSubObjects. It is faster on large meshes and also finds the eg. mesh face or mesh vertex indices which where sub-selected using standart Rhino commands, since selection usually also highlights.

The reason to prefer highlighting over subobject selection in V5 is only because sub-object selection is not preserved after a scriptrun. But highlighting is.

happy coding :slight_smile:
_
c.

Yes, only GetHighlightedSubObjects actually returns the faces in RH5 (I tried GetSelectedSubObjects without luck). Anyway, your script works very well. :+1:

// Rolf

Geat!