Grasshopper

algorithmic modeling for Rhino

# Removing inner Faces of a Mesh

Hi,

take a look at these to Meshes in rendered Mode (with snow - since Christmas is coming up).

This is one Mesh and I would like to cull the inner "ribs" and only keep the outer faces.

So I was wondering, how to do that. Is there a standart Algorithm, I could apply to this kind of mesh. The Faces in this case consist of Quads - but I would like to also find a solution, that potentially also works for szenario in which the Quads are triangulated.

Thanks

- Karl

Views: 5105

### Replies to This Discussion

I had a similar situation where I wanted to remove the inner faces of stacked blocks. If you know or can identify the plane that the intersection occurs on you can use that to help select and cull the mesh faces. You could also investigate their normals and try to match normal direction(and center point proximity as a double check)

best way I have found. Since interior faces back to back will always be a duplicate we can cull all duplicate area centroids and use that index to call out only exterior faces.

I think the method would depend on how your mesh is constructed...if your internal faces are duplicated, then you can extract the centerpoints from the mesh face polylines and test them for adjacency to one another...then identify all of the faces where the centerpoint is sitting on another face centerpoint and use the "delete faces" component.

However, if your internal faces are not duplicated, this should do it...use a VB component, set an input to be M, and type hint to "mesh":

Private Sub RunScript(ByVal M As Mesh, ByRef A As Object)

Dim f_idx As New List(Of Int32)

For i As int32 = 0 To M.Faces.Count - 1
Dim f_c() As Int32 = M.Faces.AdjacentFaces(i)
Dim e_c() As Int32 = M.TopologyEdges.GetEdgesForFace(i)
If f_c.Length - 1 > e_c.Length Then
End If
Next

A = f_idx

End Sub

Basically what it's doing is looking for any mesh face that is connected to more other faces than it has edges, and appending its index to a list that it outputs.  Feed your mesh and this index into a "delete faces" component and it'll pull them out.

Nice concept to know, about edges to faces. Thanks for sharing :)

Hi David,

thanks for sharing the concept. But isn't it true, that the outer faces have one edge in common with the inner faces. (And therefore also have more edges in common than their edge count).

Thanks

-Karl

can you share your model?  it's difficult to understand the specific challenge created by your topology from an image alone.

Well, the Problem I'm facing is to create better quality Models of Large Scale Urban Masterplan Models. It's not so much a "for this model" Problem.

I'm looking for a general solution to "cleanup" after Sketchup.

Please find attached a Part of the Model. I usually Join the Faces all into one mesh first, then weld the vertices and explode the meshes again.

Thanks

- Karl

Attachments:

I was thinking of somehow maybe evaluating "ambient occlusion" values through Rhino Common (if possible). I haven't checked that yet.

http://meshlabstuff.blogspot.de/2009/04/how-to-remove-internal-face...

Ah, I see what you're looking to do now.  Yes...messy meshes to begin with...and great call on the occlusion thing...Looks like a very promising start...joined + welded with weaverbird, split disjoint mesh, then took each face centerpoint and tested it against the mesh for occlusion in x,-x,y,-y,z,-z directions...each centerpoint that tested true for occlusion for each direction defines an index for face extraction.  Super quick + easy!

Attachments:

David,

Thanks for sharing this great script. I'm trying to achieve something similar as the original poster - I have a series of stacked closed meshes who then as a result share adjacent inner faces - I'm trying to remove these inner faces as a result of the objects being stacked.

It seems like your script will do just this. I've setup the vb component and copied your script inside and followed your directions, plugging the mesh into an M input.

My question is nothing seems to happen. Do I need to setup some form of output coming out of the vb component?

Thanks!

David,

My mistake, I read further and created the deletefaces component and fed the mesh and A output of the VB component into the deletefaces component.

It seems to be duplicating the meshes without removing the inner faces. I also tried running the mesh through the weaverbird "join meshes and weld" component before feeding it to your script but that didn't help. I've attached the gh and 3dm file if that is helpful...

Thanks!

Attachments:

• View All